From c346418d68fb48a807271a5853a57e1a56dd43be Mon Sep 17 00:00:00 2001 From: hubian <908234780@qq.com> Date: Tue, 28 Apr 2026 17:51:47 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20TTS=E6=B5=81=E5=BC=8F=E6=92=AD=E6=94=BE?= =?UTF-8?q?+=E6=96=B0=E5=AF=B9=E8=AF=9D=E9=BB=98=E8=AE=A4=E5=85=B3?= =?UTF-8?q?=E9=97=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- www/app.js | 181 ++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 131 insertions(+), 50 deletions(-) diff --git a/www/app.js b/www/app.js index a3959a5..c304c7f 100644 --- a/www/app.js +++ b/www/app.js @@ -53,9 +53,11 @@ let backendConfig = null; // 从API获取的配置 let currentUser = null; // 当前登录用户 { username, password, registeredAt } // TTS 语音播放状态 -let enableTTS = false; // 是否启用语音播放 +let enableTTS = false; // 是否启用语音播放(默认关闭) let currentPlayingAudio = null; // 当前播放的音频对象 let ttsVoice = 'zh-CN-XiaoxiaoNeural'; // TTS 语音 +let ttsQueue = []; // TTS 待播放队列 +let isTTSPlaying = false; // 是否正在播放队列 // 每日使用统计(未登录用户) let dailyUsage = { @@ -3137,6 +3139,10 @@ async function openAgent(agentId) { } } + // 重置 TTS 状态(新对话默认关闭) + enableTTS = false; + stopTTSQueue(); + // 创建新对话并设置智能体 const newConv = { id: backendId || Date.now().toString(), @@ -3159,6 +3165,9 @@ async function openAgent(agentId) { function showAgentChatPage() { if (!currentAgent || !currentConversation) return; + // 停止之前的 TTS 播放 + stopTTSQueue(); + const chatHtml = `