Davidliu 2 months ago
parent
commit
527aacd5f3
2 changed files with 4 additions and 1 deletions
  1. 1 1
      src/core/voip/asr.py
  2. 3 0
      src/core/voip/bot.py

+ 1 - 1
src/core/voip/asr.py

@@ -121,7 +121,7 @@ class TestSt:
                     enable_intermediate_result=True,
                     enable_punctuation_prediction=True,
                     enable_inverse_text_normalization=True,
-                    ex={'max_sentence_silence': 6000, 'disfluency': True, 'enable_words': True}
+                    ex={'max_sentence_silence': 3000, 'disfluency': True, 'enable_words': True}
                 )
                 # _res = self.sr.ctrl(ex={'max_sentence_silence': 6000, 'disfluency': True,'enable_words': True })
                 self.logger.debug(f"[{self.__id}]ASR session started. {count}")

+ 3 - 0
src/core/voip/bot.py

@@ -99,6 +99,9 @@ class MyAudioMediaPort(pj.AudioMediaPort):
                     # print("测试超长", user_asr_text)
                 elif asr_text:
                     self.user_asr_texts.append(asr_text)
+                    user_asr_text = self.user_asr_texts[0] if len(self.user_asr_texts) == 1 else '###'.join(self.user_asr_texts)
+                    self.user_asr_texts.clear()
+                    self.call.chat(user_asr_text)
                 if time_difference > int(self.call.wait_time):
                     self.call.reset_wait_time()
             else: