diff --git a/sundynix-desktop/frontend/src/lib/voice.ts b/sundynix-desktop/frontend/src/lib/voice.ts index 5e19a37..a2f23b9 100644 --- a/sundynix-desktop/frontend/src/lib/voice.ts +++ b/sundynix-desktop/frontend/src/lib/voice.ts @@ -147,7 +147,7 @@ export class VoiceClient { if (m.final) { this.clearIdleTimer(); this.setState("thinking"); - if (this.conversation) this.armThinkTimer(); // 看门狗:任务失败/无 TTS 也能回到聆听 + this.armThinkTimer(); // 看门狗:后端不回/任务失败/无 TTS 时别永远卡在"思考中" } else if (this.conversation && this.state === "listening") { this.armIdleTimer(); // 有声音活动 → 空转计时重来 } @@ -341,12 +341,17 @@ export class VoiceClient { this.clearThinkTimer(); this.thinkTimer = window.setTimeout(() => { this.thinkTimer = null; - if (this.conversation && this.state === "thinking") { + if (this.state !== "thinking") return; + if (this.conversation) { this.cb.onError?.("等回答超时,继续聆听"); this.send({ type: "start" }); this.cb.onTurnStart?.(); this.setState("listening"); this.armIdleTimer(); + } else { + // PTT:回待命并说清可能原因,别让用户对着"思考中"干等。 + this.cb.onError?.("等了很久没有回答——可能后端任务没跑起来(dispatcher/模型未就绪)。去运行页看看这条任务的状态。"); + this.setState("ready"); } }, THINK_WATCHDOG_MS); }