fix: 修复返回为空的文本不能播放默认提示的问题

--bug=1047018 --user=刘瑞斌 【应用】应用对话没有输出内容时,点击播放按钮console有报错 https://www.tapd.cn/57709429/s/1584399
This commit is contained in:
CaptainB 2024-09-24 10:16:27 +08:00 committed by 刘瑞斌
parent 59dc727319
commit acc43df3a3
2 changed files with 6 additions and 1 deletions

View File

@ -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)

View File

@ -160,6 +160,9 @@ function markdownToPlainText(md: string) {
}
const playAnswerText = (text: string) => {
if (!text) {
text = '抱歉,没有查找到相关内容,请重新描述您的问题或提供更多信息。'
}
// text
text = markdownToPlainText(text)
if (props.tts_type === 'BROWSER') {