From 486261b9fcb83b19459e44279c0dcd7829ff72aa Mon Sep 17 00:00:00 2001 From: CaptainB Date: Tue, 10 Dec 2024 18:30:48 +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 2178a81c654a9a7f3a95a157f308cb473d0e28e1) --- .../component/operation-button/ChatOperationButton.vue | 5 +++-- .../component/operation-button/LogOperationButton.vue | 5 +++-- 2 files changed, 6 insertions(+), 4 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 831d36454..8407daec4 100644 --- a/ui/src/components/ai-chat/component/operation-button/ChatOperationButton.vue +++ b/ui/src/components/ai-chat/component/operation-button/ChatOperationButton.vue @@ -155,8 +155,8 @@ function markdownToPlainText(md: string) { function removeFormRander(text: string) { return text .replace('你好,请先填写下面表单内容:', '') - .replace(/[\s\S]*?<\/formrander>/, '') - .replace(/[\s\S]*?<\/form_rander>/, '') + .replace('请先填写以下表单并点击提交按钮', '') + .replace(/<[^>]+>.*?<\/[^>]+>/gs, '') .replace('填写后请点击【提交】按钮进行提交。', '') .trim() } @@ -169,6 +169,7 @@ const playAnswerText = (text: string) => { text = markdownToPlainText(text) // 移除表单渲染器 text = removeFormRander(text) + // console.log(text) audioPlayerStatus.value = true if (props.tts_type === 'BROWSER') { if (text !== utterance.value?.text) { 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 a1c6cc40d..1f2d9dd90 100644 --- a/ui/src/components/ai-chat/component/operation-button/LogOperationButton.vue +++ b/ui/src/components/ai-chat/component/operation-button/LogOperationButton.vue @@ -134,8 +134,8 @@ function markdownToPlainText(md: string) { function removeFormRander(text: string) { return text .replace('你好,请先填写下面表单内容:', '') - .replace(/[\s\S]*?<\/formrander>/, '') - .replace(/[\s\S]*?<\/form_rander>/, '') + .replace('请先填写以下表单并点击提交按钮', '') + .replace(/<[^>]+>.*?<\/[^>]+>/gs, '') .replace('填写后请点击【提交】按钮进行提交。', '') .trim() } @@ -149,6 +149,7 @@ const playAnswerText = (text: string) => { text = markdownToPlainText(text) // 移除表单渲染器 text = removeFormRander(text) + console.log(text) audioPlayerStatus.value = true if (props.tts_type === 'BROWSER') { if (text !== utterance.value?.text) {