From c745e29bfb9c9b83ac3a94f22f406abcaa2b4b1f Mon Sep 17 00:00:00 2001 From: CaptainB Date: Tue, 10 Dec 2024 18:45:42 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=A4=84=E7=90=86=E5=9B=9E=E5=A4=8D?= =?UTF-8?q?=E4=B8=AD=E7=9A=84html=E6=A0=87=E7=AD=BE=E5=92=8C=E5=86=85?= =?UTF-8?q?=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (cherry picked from commit 06a5f6a0de5f41d4f879e5b50588769d5121a27e) --- .../component/operation-button/ChatOperationButton.vue | 6 +++--- .../component/operation-button/LogOperationButton.vue | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) 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 8407daec4..c9ec63656 100644 --- a/ui/src/components/ai-chat/component/operation-button/ChatOperationButton.vue +++ b/ui/src/components/ai-chat/component/operation-button/ChatOperationButton.vue @@ -156,7 +156,7 @@ function removeFormRander(text: string) { return text .replace('你好,请先填写下面表单内容:', '') .replace('请先填写以下表单并点击提交按钮', '') - .replace(/<[^>]+>.*?<\/[^>]+>/gs, '') + .replace(/[\s\S]*?<\/form_rander>/g, '') .replace('填写后请点击【提交】按钮进行提交。', '') .trim() } @@ -165,10 +165,10 @@ const playAnswerText = (text: string) => { if (!text) { text = '抱歉,没有查找到相关内容,请重新描述您的问题或提供更多信息。' } - // text 处理成纯文本 - text = markdownToPlainText(text) // 移除表单渲染器 text = removeFormRander(text) + // text 处理成纯文本 + text = markdownToPlainText(text) // console.log(text) audioPlayerStatus.value = true if (props.tts_type === 'BROWSER') { 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 1f2d9dd90..5fe74b9f5 100644 --- a/ui/src/components/ai-chat/component/operation-button/LogOperationButton.vue +++ b/ui/src/components/ai-chat/component/operation-button/LogOperationButton.vue @@ -135,7 +135,7 @@ function removeFormRander(text: string) { return text .replace('你好,请先填写下面表单内容:', '') .replace('请先填写以下表单并点击提交按钮', '') - .replace(/<[^>]+>.*?<\/[^>]+>/gs, '') + .replace(/[\s\S]*?<\/form_rander>/g, '') .replace('填写后请点击【提交】按钮进行提交。', '') .trim() } @@ -145,11 +145,11 @@ const playAnswerText = (text: string) => { if (!text) { text = '抱歉,没有查找到相关内容,请重新描述您的问题或提供更多信息。' } - // text 处理成纯文本 - text = markdownToPlainText(text) // 移除表单渲染器 text = removeFormRander(text) - console.log(text) + // text 处理成纯文本 + text = markdownToPlainText(text) + // console.log(text) audioPlayerStatus.value = true if (props.tts_type === 'BROWSER') { if (text !== utterance.value?.text) {