This commit is contained in:
Timothy Jaeryang Baek
2026-06-29 13:03:14 -05:00
parent 7ea7680f56
commit 517cd8d102
45 changed files with 1293 additions and 969 deletions
+4 -2
View File
@@ -512,7 +512,7 @@
}
};
const showMessage = async (message, scroll = true) => {
const showMessage = async (message, scroll = true, save = true) => {
const _chatId = JSON.parse(JSON.stringify($chatId));
let _messageId = JSON.parse(JSON.stringify(message.id));
@@ -545,7 +545,9 @@
await tick();
await tick();
saveChatHandler(_chatId, history);
if (save) {
saveChatHandler(_chatId, history);
}
};
const updateLastReadAt = (id) => {
+14 -5
View File
@@ -35,6 +35,7 @@
export let atSelectedModel;
let messages = [];
let deletedMessageIds = new Set<string>();
export let setInputText: Function = () => {};
@@ -168,10 +169,16 @@
if (!$temporaryChatEnabled) {
history = history;
await tick();
const res = await updateChatById(localStorage.token, chatId, {
history: history,
messages: messages
});
const res = await updateChatById(
localStorage.token,
chatId,
{
history: history,
messages: messages
},
Array.from(deletedMessageIds)
);
deletedMessageIds.clear();
// Refresh local message content from backend (e.g. re-derived via serialize_output)
if (res?.chat?.history?.messages) {
@@ -461,9 +468,11 @@
// Delete the message and its children
[messageId, ...childMessageIds].forEach((id) => {
delete history.messages[id];
deletedMessageIds.add(id);
});
showMessage({ id: parentMessageId }, false);
showMessage({ id: parentMessageId }, false, false);
await updateChat();
};
const triggerScroll = () => {