mirror of
https://github.com/open-webui/open-webui.git
synced 2026-08-28 05:27:35 +00:00
fix(call-overlay): dispatch all completed sentences in streamed chunks sequentially
This commit is contained in:
parent
01f4282f1f
commit
df9827fb10
1 changed files with 14 additions and 16 deletions
|
|
@ -1616,23 +1616,21 @@
|
|||
messageContentParts.pop();
|
||||
}
|
||||
|
||||
const nextContentPart = messageContentParts.at(-1) ?? '';
|
||||
if (!nextContentPart || (!final && nextContentPart === message.lastSentence)) {
|
||||
return;
|
||||
let n = message.ttsSent ?? 0;
|
||||
for (; n < messageContentParts.length; n++) {
|
||||
const part = messageContentParts[n];
|
||||
if (!part) continue;
|
||||
if (!final && (part.split(/\s+/).length < 4 || part.length < 50)) break;
|
||||
eventTarget.dispatchEvent(
|
||||
new CustomEvent('chat', {
|
||||
detail: {
|
||||
id: message.id,
|
||||
content: part
|
||||
}
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
if (!final) {
|
||||
message.lastSentence = nextContentPart;
|
||||
}
|
||||
|
||||
eventTarget.dispatchEvent(
|
||||
new CustomEvent('chat', {
|
||||
detail: {
|
||||
id: message.id,
|
||||
content: nextContentPart
|
||||
}
|
||||
})
|
||||
);
|
||||
message.ttsSent = n;
|
||||
};
|
||||
|
||||
const getContents = () => {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue