datbkpro commited on
Commit
38d7d2a
·
verified ·
1 Parent(s): acaa9cd

Update services/streaming_voice_service.py

Browse files
services/streaming_voice_service.py CHANGED
@@ -58,7 +58,6 @@ class StreamingVoiceService:
58
  if success:
59
  self.is_listening = True
60
  self.is_processing = False
61
- # Bắt đầu thread xử lý response
62
  threading.Thread(target=self._process_response_queue, daemon=True).start()
63
  print("🎙️ Đã bắt đầu lắng nghe với VAD tối ưu")
64
  return success
@@ -77,7 +76,6 @@ class StreamingVoiceService:
77
  """Callback khi VAD phát hiện speech - TỐI ƯU HÓA"""
78
  print(f"🎯 VAD phát hiện speech: {len(speech_audio)/sample_rate:.2f}s")
79
 
80
- # Thêm vào queue thay vì xử lý trực tiếp
81
  self.response_queue.put((speech_audio, sample_rate))
82
 
83
  def _process_response_queue(self):
@@ -367,7 +365,7 @@ class StreamingVoiceService:
367
  else:
368
  result = str(transcription).strip()
369
  short_responses = {
370
- 'ừ', 'uh', 'um', 'à', 'ờ', 'ê', 'ô',
371
  'có', 'không', 'đúng', 'sai', 'ok', 'okay', 'ừm',
372
  'vâng', 'dạ', 'ạ', 'được', 'tốt', 'hay', 'ừ ừ',
373
  'yes', 'no', 'yeah', 'yep', 'nope'
 
58
  if success:
59
  self.is_listening = True
60
  self.is_processing = False
 
61
  threading.Thread(target=self._process_response_queue, daemon=True).start()
62
  print("🎙️ Đã bắt đầu lắng nghe với VAD tối ưu")
63
  return success
 
76
  """Callback khi VAD phát hiện speech - TỐI ƯU HÓA"""
77
  print(f"🎯 VAD phát hiện speech: {len(speech_audio)/sample_rate:.2f}s")
78
 
 
79
  self.response_queue.put((speech_audio, sample_rate))
80
 
81
  def _process_response_queue(self):
 
365
  else:
366
  result = str(transcription).strip()
367
  short_responses = {
368
+ 'ừ', 'um', 'à', 'ờ', 'ê', 'ô',
369
  'có', 'không', 'đúng', 'sai', 'ok', 'okay', 'ừm',
370
  'vâng', 'dạ', 'ạ', 'được', 'tốt', 'hay', 'ừ ừ',
371
  'yes', 'no', 'yeah', 'yep', 'nope'