fix: 处理回复中的html标签和内容

(cherry picked from commit 2178a81c65)
This commit is contained in:
CaptainB 2024-12-10 18:30:48 +08:00 committed by shaohuzhang1
parent 8568511b21
commit 486261b9fc
2 changed files with 6 additions and 4 deletions

View File

@ -155,8 +155,8 @@ function markdownToPlainText(md: string) {
function removeFormRander(text: string) {
return text
.replace('你好,请先填写下面表单内容:', '')
.replace(/<formrander>[\s\S]*?<\/formrander>/, '')
.replace(/<form_rander>[\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) {

View File

@ -134,8 +134,8 @@ function markdownToPlainText(md: string) {
function removeFormRander(text: string) {
return text
.replace('你好,请先填写下面表单内容:', '')
.replace(/<formrander>[\s\S]*?<\/formrander>/, '')
.replace(/<form_rander>[\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) {