fix: 处理回复中的html标签和内容
Some checks are pending
sync2gitee / repo-sync (push) Waiting to run

(cherry picked from commit 06a5f6a0de)
This commit is contained in:
CaptainB 2024-12-10 18:45:42 +08:00 committed by shaohuzhang1
parent 486261b9fc
commit c745e29bfb
2 changed files with 7 additions and 7 deletions

View File

@ -156,7 +156,7 @@ function removeFormRander(text: string) {
return text
.replace('你好,请先填写下面表单内容:', '')
.replace('请先填写以下表单并点击提交按钮', '')
.replace(/<[^>]+>.*?<\/[^>]+>/gs, '')
.replace(/<form_rander>[\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') {

View File

@ -135,7 +135,7 @@ function removeFormRander(text: string) {
return text
.replace('你好,请先填写下面表单内容:', '')
.replace('请先填写以下表单并点击提交按钮', '')
.replace(/<[^>]+>.*?<\/[^>]+>/gs, '')
.replace(/<form_rander>[\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) {