Kaynağa Gözat

fix: 修改按键逻辑

余尚辉 1 ay önce
ebeveyn
işleme
56329d44ec
1 değiştirilmiş dosya ile 5 ekleme ve 2 silme
  1. 5 2
      src/core/voip/bot.py

+ 5 - 2
src/core/voip/bot.py

@@ -91,8 +91,10 @@ class MyAudioMediaPort(pj.AudioMediaPort):
             else:
                 if asr_text and not play_complete:
                     self.user_asr_texts.append(asr_text)
-                if asr_text and play_complete:
-                    self.user_asr_texts.append(asr_text)
+                if asr_text and play_complete or play_complete and self.user_asr_texts:
+                    if asr_text:  # 等价于 if asr_text is not None and asr_text != ""
+                        self.user_asr_texts.append(asr_text)
+                    # self.user_asr_texts.append(asr_text)
                     user_asr_text = asr_text if len(self.user_asr_texts) == 1 else '###'.join(self.user_asr_texts)
                     self.user_asr_texts.clear()
                     self.call.chat(user_asr_text)
@@ -232,6 +234,7 @@ class MyCall(pj.Call):
     def reset_wait_time(self):
         self.play_complete_flag = False  # 重置播放完成标志
         self.play_start_time = None  # 重置开始计时时间
+        self.digit = ''
     def get_phone(self):
         import re
         call_info = self.getInfo()