mirror of
https://github.com/open-webui/open-webui
synced 2025-05-23 14:24:22 +00:00
refac
This commit is contained in:
parent
7c81509804
commit
fe0cf9506c
@ -975,20 +975,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($chatId == _chatId) {
|
await saveChatHandler(_chatId);
|
||||||
if (!$temporaryChatEnabled) {
|
|
||||||
chat = await updateChatById(localStorage.token, _chatId, {
|
|
||||||
messages: messages,
|
|
||||||
history: history,
|
|
||||||
models: selectedModels,
|
|
||||||
params: params,
|
|
||||||
files: chatFiles
|
|
||||||
});
|
|
||||||
|
|
||||||
currentChatPage.set(1);
|
|
||||||
await chats.set(await getChatList(localStorage.token, $currentChatPage));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (res !== null) {
|
if (res !== null) {
|
||||||
const error = await res.json();
|
const error = await res.json();
|
||||||
@ -1518,7 +1505,23 @@
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const mergeResponses = async (messageId, responses) => {
|
const saveChatHandler = async (_chatId) => {
|
||||||
|
if ($chatId == _chatId) {
|
||||||
|
if (!$temporaryChatEnabled) {
|
||||||
|
chat = await updateChatById(localStorage.token, _chatId, {
|
||||||
|
messages: messages,
|
||||||
|
history: history,
|
||||||
|
models: selectedModels,
|
||||||
|
params: params,
|
||||||
|
files: chatFiles
|
||||||
|
});
|
||||||
|
|
||||||
|
currentChatPage.set(1);
|
||||||
|
await chats.set(await getChatList(localStorage.token, $currentChatPage));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const mergeResponses = async (messageId, responses, _chatId) => {
|
||||||
console.log('mergeResponses', messageId, responses);
|
console.log('mergeResponses', messageId, responses);
|
||||||
const message = history.messages[messageId];
|
const message = history.messages[messageId];
|
||||||
const mergedResponse = {
|
const mergedResponse = {
|
||||||
@ -1554,6 +1557,8 @@
|
|||||||
scrollToBottom();
|
scrollToBottom();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await saveChatHandler(_chatId);
|
||||||
} else {
|
} else {
|
||||||
console.error(res);
|
console.error(res);
|
||||||
}
|
}
|
||||||
|
@ -122,7 +122,7 @@
|
|||||||
const { messages } = groupedMessages[modelIdx];
|
const { messages } = groupedMessages[modelIdx];
|
||||||
return messages[groupedMessagesIdx[modelIdx]].content;
|
return messages[groupedMessagesIdx[modelIdx]].content;
|
||||||
});
|
});
|
||||||
mergeResponses(currentMessageId, responses);
|
mergeResponses(currentMessageId, responses, chatId);
|
||||||
};
|
};
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
|
Loading…
Reference in New Issue
Block a user