同时播放聊条音频的问题修复
This commit is contained in:
@@ -794,29 +794,10 @@ function readMarkdown(value, index) {
|
||||
clearTimeout(ttsDebounceTimer);
|
||||
}
|
||||
|
||||
// 如果当前正在播放其他消息,先停止
|
||||
if (speechIndex.value !== index && speechIndex.value !== 0) {
|
||||
console.log('🛑 Stopping current speech and starting new one');
|
||||
speechIndex.value = index;
|
||||
speak(value);
|
||||
return;
|
||||
}
|
||||
|
||||
// 总是先停止当前播放,无论是不是同一消息
|
||||
console.log('🛑 Always stopping current speech before starting new one');
|
||||
speechIndex.value = index;
|
||||
|
||||
// 如果当前正在播放且暂停了,直接恢复
|
||||
if (isPaused.value && isSpeaking.value) {
|
||||
console.log('▶️ Resuming paused speech');
|
||||
resume();
|
||||
return;
|
||||
}
|
||||
|
||||
// 如果当前正在播放且没有暂停,不需要重新开始
|
||||
if (isSpeaking.value && !isPaused.value) {
|
||||
console.log('🔊 Already speaking, no need to restart');
|
||||
return;
|
||||
}
|
||||
|
||||
// 使用防抖,避免频繁调用TTS
|
||||
ttsDebounceTimer = setTimeout(() => {
|
||||
console.log('🎵 Starting new speech');
|
||||
|
||||
Reference in New Issue
Block a user