mirror of
https://github.com/open-webui/open-webui
synced 2025-02-21 12:29:29 +00:00
refac
This commit is contained in:
parent
55f14e37ea
commit
a4a5614de5
@ -176,22 +176,22 @@
|
|||||||
}
|
}
|
||||||
} else if (type === 'citation') {
|
} else if (type === 'citation') {
|
||||||
if (data?.type === 'code_execution') {
|
if (data?.type === 'code_execution') {
|
||||||
// Code execution; update existing code execution by ID,
|
// Code execution; update existing code execution by ID, or add new one.
|
||||||
// otherwise append.
|
|
||||||
if (!message?.code_executions) {
|
if (!message?.code_executions) {
|
||||||
message.code_executions = [];
|
message.code_executions = [];
|
||||||
}
|
}
|
||||||
let is_update = false;
|
|
||||||
for (let i = 0; i < message.code_executions.length; i++) {
|
const existingCodeExecutionIndex = message.code_executions.findIndex(
|
||||||
if (message.code_executions[i].id === data.id) {
|
(execution) => execution.id === data.id
|
||||||
message.code_executions[i] = data;
|
);
|
||||||
is_update = true;
|
|
||||||
break;
|
if (existingCodeExecutionIndex !== -1) {
|
||||||
}
|
message.code_executions[existingCodeExecutionIndex] = data;
|
||||||
}
|
} else {
|
||||||
if (!is_update) {
|
|
||||||
message.code_executions.push(data);
|
message.code_executions.push(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
message.code_executions = message.code_executions;
|
||||||
} else {
|
} else {
|
||||||
// Regular citation.
|
// Regular citation.
|
||||||
if (message?.citations) {
|
if (message?.citations) {
|
||||||
|
Loading…
Reference in New Issue
Block a user