From bbeed0e276523cd0525f630f6ef01ca49e48fa50 Mon Sep 17 00:00:00 2001 From: CaptainB Date: Sat, 14 Sep 2024 14:24:23 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E6=92=AD=E6=94=BE=E8=AF=AD?= =?UTF-8?q?=E9=9F=B3=E5=A2=9E=E5=8A=A0tts=5Ftype=E5=8C=BA=E5=88=86?= =?UTF-8?q?=E4=B8=8D=E5=90=8C=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/src/components/ai-chat/OperationButton.vue | 9 +++++---- ui/src/components/ai-chat/index.vue | 1 + 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/ui/src/components/ai-chat/OperationButton.vue b/ui/src/components/ai-chat/OperationButton.vue index b7a0751a1..09f720704 100644 --- a/ui/src/components/ai-chat/OperationButton.vue +++ b/ui/src/components/ai-chat/OperationButton.vue @@ -93,7 +93,8 @@ const props = defineProps({ type: Boolean }, log: Boolean, - tts: Boolean + tts: Boolean, + tts_type: String }) const emit = defineEmits(['update:data', 'regeneration']) @@ -116,15 +117,15 @@ function voteHandle(val: string) { } const playAnswerText = (text: string) => { - if (props.data.tts_type === 'BROWSER') { + if (props.tts_type === 'BROWSER') { // 创建一个新的 SpeechSynthesisUtterance 实例 const utterance = new SpeechSynthesisUtterance(text) // 调用浏览器的朗读功能 window.speechSynthesis.speak(utterance) } - if (props.data.tts_type === 'TTS') { + if (props.tts_type === 'TTS') { applicationApi - .postTextToSpeech(props.data.id as string, { text: text }, loading) + .postTextToSpeech(props.applicationId as string, { text: text }, loading) .then((res: any) => { // 假设我们有一个 MP3 文件的字节数组 // 创建 Blob 对象 diff --git a/ui/src/components/ai-chat/index.vue b/ui/src/components/ai-chat/index.vue index 3784368d4..8edcebc69 100644 --- a/ui/src/components/ai-chat/index.vue +++ b/ui/src/components/ai-chat/index.vue @@ -150,6 +150,7 @@