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:
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
"已切换到单对话模式" 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:
"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)
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})