mirror of
https://github.com/open-webui/open-webui.git
synced 2026-09-07 08:27:05 +00:00
perf: add fast-path comparison in MultiResponseMessages (#22100)
Same optimization as ResponseMessage: add O(1) fast-path check on content and done fields before falling back to full JSON.stringify comparison. Avoids expensive serialization when only content changes during streaming.
This commit is contained in:
parent
c436e0366c
commit
1b89bee098
1 changed files with 7 additions and 2 deletions
|
|
@ -62,8 +62,13 @@
|
|||
|
||||
let message = structuredClone(history.messages[messageId]);
|
||||
$: if (history.messages) {
|
||||
if (JSON.stringify(message) !== JSON.stringify(history.messages[messageId])) {
|
||||
message = structuredClone(history.messages[messageId]);
|
||||
const source = history.messages[messageId];
|
||||
if (source) {
|
||||
if (message.content !== source.content || message.done !== source.done) {
|
||||
message = structuredClone(source);
|
||||
} else if (JSON.stringify(message) !== JSON.stringify(source)) {
|
||||
message = structuredClone(source);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue