diff --git a/ui/src/components/ai-chat/component/operation-button/ChatOperationButton.vue b/ui/src/components/ai-chat/component/operation-button/ChatOperationButton.vue index fe2d91a4943..e633c850a53 100644 --- a/ui/src/components/ai-chat/component/operation-button/ChatOperationButton.vue +++ b/ui/src/components/ai-chat/component/operation-button/ChatOperationButton.vue @@ -200,7 +200,7 @@ const playAnswerTextPart = () => { if (audioList.value[currentAudioIndex.value] !== utterance.value?.text) { window.speechSynthesis.cancel() } - if (window.speechSynthesis.paused) { + if (window.speechSynthesis.paused && audioList.value[currentAudioIndex.value] === utterance.value?.text) { window.speechSynthesis.resume() return } diff --git a/ui/src/components/ai-chat/component/operation-button/LogOperationButton.vue b/ui/src/components/ai-chat/component/operation-button/LogOperationButton.vue index 03772952b2d..71120c97484 100644 --- a/ui/src/components/ai-chat/component/operation-button/LogOperationButton.vue +++ b/ui/src/components/ai-chat/component/operation-button/LogOperationButton.vue @@ -176,7 +176,7 @@ const playAnswerTextPart = () => { if (audioList.value[currentAudioIndex.value] !== utterance.value?.text) { window.speechSynthesis.cancel() } - if (window.speechSynthesis.paused) { + if (window.speechSynthesis.paused && audioList.value[currentAudioIndex.value] === utterance.value?.text) { window.speechSynthesis.resume() return } diff --git a/ui/src/views/chat/pc/index.vue b/ui/src/views/chat/pc/index.vue index ba4338ed1ef..e201a0fbcc4 100644 --- a/ui/src/views/chat/pc/index.vue +++ b/ui/src/views/chat/pc/index.vue @@ -321,6 +321,14 @@ const clickListHandle = (item: any) => { currentChatName.value = item.abstract if (currentChatId.value !== 'new') { getChatRecord() + + // 切换对话后,取消暂停的浏览器播放 + if (window.speechSynthesis.paused && window.speechSynthesis.speaking) { + window.speechSynthesis.resume() + nextTick(() => { + window.speechSynthesis.cancel() + }) + } } } if (common.isMobile()) {