From acc43df3a3768bcd4ed4ed1b6ea01115b4cf46d1 Mon Sep 17 00:00:00 2001 From: CaptainB Date: Tue, 24 Sep 2024 10:16:27 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E4=B8=BA=E7=A9=BA=E7=9A=84=E6=96=87=E6=9C=AC=E4=B8=8D=E8=83=BD?= =?UTF-8?q?=E6=92=AD=E6=94=BE=E9=BB=98=E8=AE=A4=E6=8F=90=E7=A4=BA=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1047018 --user=刘瑞斌 【应用】应用对话没有输出内容时,点击播放按钮console有报错 https://www.tapd.cn/57709429/s/1584399 --- ui/src/components/ai-chat/LogOperationButton.vue | 4 +++- ui/src/components/ai-chat/OperationButton.vue | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ui/src/components/ai-chat/LogOperationButton.vue b/ui/src/components/ai-chat/LogOperationButton.vue index 4925c255c..493daf62c 100644 --- a/ui/src/components/ai-chat/LogOperationButton.vue +++ b/ui/src/components/ai-chat/LogOperationButton.vue @@ -102,7 +102,9 @@ function editMark(data: any) { const audioPlayerStatus = ref(false) const playAnswerText = (text: string) => { - console.log(props.data) + if (!text) { + text = '抱歉,没有查找到相关内容,请重新描述您的问题或提供更多信息。' + } if (props.tts_type === 'BROWSER') { // 创建一个新的 SpeechSynthesisUtterance 实例 const utterance = new SpeechSynthesisUtterance(text) diff --git a/ui/src/components/ai-chat/OperationButton.vue b/ui/src/components/ai-chat/OperationButton.vue index 651b69414..874570ef3 100644 --- a/ui/src/components/ai-chat/OperationButton.vue +++ b/ui/src/components/ai-chat/OperationButton.vue @@ -160,6 +160,9 @@ function markdownToPlainText(md: string) { } const playAnswerText = (text: string) => { + if (!text) { + text = '抱歉,没有查找到相关内容,请重新描述您的问题或提供更多信息。' + } // text 处理成纯文本 text = markdownToPlainText(text) if (props.tts_type === 'BROWSER') {