mirror of
https://github.com/open-webui/open-webui.git
synced 2026-09-15 23:32:40 +00:00
refac
This commit is contained in:
parent
f5fcf4c89f
commit
e1bfefdf9f
1 changed files with 14 additions and 2 deletions
|
|
@ -499,7 +499,7 @@ function findOutputItemIndex(output: OutputItem[], item: OutputItem): number {
|
|||
return output.findIndex(
|
||||
(existing) =>
|
||||
(!!item.id && existing?.id === item.id) ||
|
||||
(!!item.call_id && existing?.call_id === item.call_id)
|
||||
(!!item.call_id && existing?.type === item.type && existing?.call_id === item.call_id)
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -522,7 +522,19 @@ export function applyResponseStreamEvent(
|
|||
}
|
||||
|
||||
if (eventType === 'response.completed') {
|
||||
return event.response?.output ? [...event.response.output] : output;
|
||||
if (!event.response?.output?.length) return output;
|
||||
|
||||
// Completion covers one provider response, not the earlier tool-call rounds.
|
||||
const nextOutput = [...output];
|
||||
for (const item of event.response.output) {
|
||||
const index = findOutputItemIndex(nextOutput, item);
|
||||
if (index >= 0) {
|
||||
nextOutput[index] = item;
|
||||
} else {
|
||||
nextOutput.push(item);
|
||||
}
|
||||
}
|
||||
return nextOutput;
|
||||
}
|
||||
|
||||
const nextOutput = [...output];
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue