diff --git a/src/views/Speaking.vue b/src/views/Speaking.vue index 5f28ce6..2016758 100644 --- a/src/views/Speaking.vue +++ b/src/views/Speaking.vue @@ -340,10 +340,14 @@ const sendMessage = async () => { isSending.value = true; // 插入用户消息 - const userMsg = { id: ++msgIdCounter, role: "user", content: text, audioUrl: null, isPlaying: false, isLoading: false }; + const userMsgId = ++msgIdCounter; + const userMsg = { id: userMsgId, role: "user", content: text, audioUrl: null, isPlaying: false, isLoading: false }; messages.value.push(userMsg); await scrollToBottom(); + // 用户消息 TTS(不阻塞主流程) + synthesizeAndPlay(text, userMsgId).catch((e) => console.error("User TTS error:", e)); + // 插入 AI loading 占位 const aiMsgId = ++msgIdCounter; const aiMsg = { id: aiMsgId, role: "assistant", content: "", audioUrl: null, isPlaying: false, isLoading: true }; @@ -701,9 +705,10 @@ onUnmounted(() => { {{ msg.content }} - -