liumaolin commited on
Commit
9bda9f9
·
1 Parent(s): c543528

修复`PerformanceLogMixin`中的音频记录逻辑

Browse files

- 将`sf.write`方法中的音频源从`voice_task.audio`更改为`voice_task.user_voice`,确保正确记录用户的声音。
- 在`ASRWorker`类中,恢复`log_task_user_question`方法的调用,以记录用户提问。

src/voice_dialogue/services/mixins.py CHANGED
@@ -104,4 +104,4 @@ class PerformanceLogMixin:
104
 
105
  import soundfile as sf
106
  output_filename = output_path / (voice_task.id + ".wav")
107
- sf.write(output_filename.as_posix(), voice_task.audio, 16000, subtype="PCM_16")
 
104
 
105
  import soundfile as sf
106
  output_filename = output_path / (voice_task.id + ".wav")
107
+ sf.write(output_filename.as_posix(), voice_task.user_voice, 16000, subtype="PCM_16")
src/voice_dialogue/services/speech/recognizer.py CHANGED
@@ -38,7 +38,6 @@ class ASRWorker(BaseThread, PerformanceLogMixin):
38
  except Empty:
39
  continue
40
 
41
- self.log_task_user_question(voice_task)
42
 
43
  voice_task.language = self.language
44
  voice_task.whisper_start_time = time.time()
@@ -48,6 +47,8 @@ class ASRWorker(BaseThread, PerformanceLogMixin):
48
  if not transcribed_text.strip():
49
  voice_state_manager.reset_task_id()
50
  continue
 
 
51
 
52
  voice_task.whisper_end_time = time.time()
53
 
 
38
  except Empty:
39
  continue
40
 
 
41
 
42
  voice_task.language = self.language
43
  voice_task.whisper_start_time = time.time()
 
47
  if not transcribed_text.strip():
48
  voice_state_manager.reset_task_id()
49
  continue
50
+
51
+ self.log_task_user_question(voice_task)
52
 
53
  voice_task.whisper_end_time = time.time()
54