From: TimekeeperPL <1624952103@qq.com> Date: Wed, 27 May 2026 07:38:11 +0000 (+0800) Subject: 修复两次VAD提示音的BUG,修复未close直接断联websocket问题,修复长对话模式 短按按键重新录音 TTS仍播报的问题,修复单对话模式 长按按键 无法打断TT... X-Git-Url: http://git.snicker.com.cn/?a=commitdiff_plain;h=b02f22fe444c954634a514a4cc3dfba3479ce2f9;p=mirrors%2FASR1603_G5.git 修复两次VAD提示音的BUG,修复未close直接断联websocket问题,修复长对话模式 短按按键重新录音 TTS仍播报的问题,修复单对话模式 长按按键 无法打断TTS播报并重新录音的问题(补) --- diff --git a/2.sdk/project/7PIN_1_5/sdk/services/microPython/ports/quectel/core/vc_session_io.py b/2.sdk/project/7PIN_1_5/sdk/services/microPython/ports/quectel/core/vc_session_io.py index 12737c1f..0ad78cbb 100644 --- a/2.sdk/project/7PIN_1_5/sdk/services/microPython/ports/quectel/core/vc_session_io.py +++ b/2.sdk/project/7PIN_1_5/sdk/services/microPython/ports/quectel/core/vc_session_io.py @@ -1056,6 +1056,21 @@ class VCSessionIoMixin: self._ptt_await_server = 0 except Exception: pass + # 单对话:松手后首轮 tts.started 须起播(勿沿用录音期的 drop 标志) + try: + if ( + self._vc_is_ptt_mode() + and getattr(self, "VC_record_state_flag", 0) == 0 + and not ( + hasattr(self, "_ptt_in_interrupt_wait") + and self._ptt_in_interrupt_wait() + ) + ): + self._drop_tts_audio = 0 + self.is_ruppt_tts = 0 + self._ptt_interrupt_active = 0 + except Exception: + pass self._server_vad_silence = 1 self._turn_has_tts_started = 1 try: diff --git a/2.sdk/project/7PIN_1_5/sdk/services/microPython/ports/quectel/core/vc_session_media.py b/2.sdk/project/7PIN_1_5/sdk/services/microPython/ports/quectel/core/vc_session_media.py index 98f6430e..dd6988e9 100644 --- a/2.sdk/project/7PIN_1_5/sdk/services/microPython/ports/quectel/core/vc_session_media.py +++ b/2.sdk/project/7PIN_1_5/sdk/services/microPython/ports/quectel/core/vc_session_media.py @@ -1218,6 +1218,16 @@ class VCSessionMediaMixin: if getattr(self, "VC_mode", -1) == 1: self._ptt_led_lock_listening = 0 self._ptt_interrupt_active = 0 + # 松手等 LLM/TTS:须允许本轮下行播放(打断/canceled 残留 drop 勿带入) + if not ptt_silent: + self._drop_tts_audio = 0 + self.is_ruppt_tts = 0 + if getattr(self, "_intr", None) is not None: + try: + self._intr.drop_tts = 0 + self._intr.ruppt_tts = 0 + except Exception: + pass if ptt_silent: # ptt_begin 清理残留录音:用户仍按住,勿进思考态/勿清长按 self._ptt_await_server = 0 @@ -1607,8 +1617,9 @@ class VCSessionMediaMixin: "已切换到单对话模式" if int(getattr(self, "VC_mode", 0)) == 1 else "已切换到长对话模式" ) - if ms_hint: - self.AI_TTS_str = ms_hint + saved_tts = ms_hint or "" + if saved_tts: + self.AI_TTS_str = saved_tts if is_close_VC != None: self.Close_flag = is_close_VC try: @@ -1629,7 +1640,7 @@ class VCSessionMediaMixin: "find_device", "asr_empty_hint", ) # 单对话 notify:设计稿仅 ASR complete 后亮思考灯;提示音/模式切换保持 idle - if is_close_VC or ptt_mode or notify_kind: + if is_close_VC or notify_kind: prefer_off = 1 if (ptt_mode or k in ("prompt", "boot_prompt")) else 0 self._vc_publish_led( "idle", "play_tts_cb/notify", prefer_off=prefer_off) @@ -1640,14 +1651,28 @@ class VCSessionMediaMixin: self.AI_ASR_send_buf_len = 0 self._uplink_request_stop("play_tts_cb") self.Close_reconnect() + # Close() 会清空 AI_TTS_str;须在重连后恢复,否则 started 无 OP_SYNTHESIS(PTT_HINT 无声) try: - if k in ("mode_switch_long", "mode_switch_ptt") and ms_hint: - self.AI_TTS_str = ms_hint - self._pending_tts_kind = k - self._last_tts_kind = k + if saved_tts: + self.AI_TTS_str = saved_tts + if k: + self._pending_tts_kind = k + self._last_tts_kind = k except Exception: pass self.AI_VC_start() + try: + if ( + saved_tts + and getattr(self, "_vc_session_started", 0) == 1 + and getattr(self, "_tts_pending", 0) == 0 + ): + EventMesh.publish( + "publish_AI_btnInfo", + {"func": self.AI_client_VC_synthesis}, + ) + except Exception: + pass # EventMesh.publish("publish_AI_btnInfo",{"func":self.VC_Speech_End}) # EventMesh.publish("publish_AI_btnInfo",{"func":self.websocket_deconnect_VC})