mirror of
https://github.com/open-webui/open-webui.git
synced 2026-10-18 04:43:55 +00:00
fix: read aloud no longer stops after the first sentence when speech is slow (#32484)
speak() synthesizes one sentence at a time and enqueues each clip as it arrives. When a clip finishes before the next one is ready, the audio queue reports 'empty-queue', and the onStopped handler set speaking to false. The loop only enqueues while speaking is true, so every later clip was synthesized and then dropped, and the speaker button went back to idle. Ignore 'empty-queue' while the synthesis loop is still running; playback resumes on the next enqueue, and the queue's 'empty-queue' after the last clip still ends playback as before.
This commit is contained in:
parent
ae6793dd4f
commit
7da8653e71
1 changed files with 5 additions and 0 deletions
|
|
@ -292,7 +292,10 @@
|
|||
} else {
|
||||
$audioQueue.setId(`${message.id}`);
|
||||
$audioQueue.setPlaybackRate($settings.audio?.tts?.playbackRate ?? 1);
|
||||
let synthesizing = true;
|
||||
$audioQueue.onStopped = ({ event }) => {
|
||||
if (event === 'empty-queue' && synthesizing) return;
|
||||
|
||||
speaking = false;
|
||||
speakingIdx = undefined;
|
||||
|
||||
|
|
@ -371,6 +374,8 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
synthesizing = false;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue