fix: improve text handling and playback conditions in ChatOperationButton

--bug=1058408 --user=刘瑞斌 【应用管理】移动端自动播放没有声音,浏览器可正常播放 https://www.tapd.cn/62980211/s/1729308
This commit is contained in:
CaptainB 2025-07-11 17:16:04 +08:00
parent b89ee3d174
commit 6369b4fb45

View File

@ -293,7 +293,7 @@ class AudioManage {
const newTextList = textList.slice(this.textList.length)
//
if (newTextList.length <= 0) {
return
return 0
}
newTextList.forEach((text, index) => {
this.textList.push(text)
@ -429,7 +429,10 @@ class AudioManage {
}
if (text) {
const textList = this.getTextList(text, is_end ? true : false)
this.appendTextList(textList)
if (this.appendTextList(textList) !== 0) {
//
return
}
}
//
if (this.statusList.some((item) => [AudioStatus.PLAY_INT].includes(item))) {
@ -472,7 +475,7 @@ class AudioManage {
setTimeout(() => {
speechSynthesis.speak(audioElement)
this.statusList[index] = AudioStatus.PLAY_INT
}, 100)
}, 500)
}
}
}
@ -533,7 +536,7 @@ onMounted(() => {
const record_id = data.record_id
bus.emit('play:pause', record_id)
if (props.data.record_id == record_id) {
if (props.tts && props.tts_autoplay) {
if (props.tts && props.tts_autoplay && data.is_end) {
if (audioManage.value) {
audioManage.value.play(props.data.answer_text, data.is_end)
}