This commit is contained in:
Timothy Jaeryang Baek committed 2026-05-09 08:28:29 +09:00
1 parent 04bd0425ea
commit 3fcad2f627
4 files changed
+473 -38

No files matched your search

+17 -3
View File
@@ -159,11 +159,21 @@
if (!$temporaryChatEnabled) {
history = history;
await tick();
await updateChatById(localStorage.token, chatId, {
const res = await updateChatById(localStorage.token, chatId, {
history: history,
messages: messages
});
// Refresh local message content from backend (e.g. re-derived via serialize_output)
if (res?.chat?.history?.messages) {
for (const [id, msg] of Object.entries(res.chat.history.messages)) {
if (history.messages[id] && (msg as any).content) {
history.messages[id].content = (msg as any).content;
}
}
history = history;
}
currentChatPage.set(1);
await chats.set(await getChatList(localStorage.token, $currentChatPage));
}
@@ -317,7 +327,7 @@
await updateChat();
};
const editMessage = async (messageId, { content, files }, submit = true) => {
const editMessage = async (messageId, { content, files, output = undefined }, submit = true) => {
if ((selectedModels ?? []).filter((id) => id).length === 0) {
toast.error($i18n.t('Model not selected'));
return;
@@ -361,7 +371,7 @@
}
} else {
if (submit) {
// New response message
// New response message (Save As Copy)
const responseMessageId = uuidv4();
const message = history.messages[messageId];
const parentId = message.parentId;
@@ -373,6 +383,7 @@
childrenIds: [],
files: undefined,
content: content,
output: output ?? undefined,
timestamp: Math.floor(Date.now() / 1000) // Unix epoch
};
@@ -392,6 +403,9 @@
// Edit response message
history.messages[messageId].originalContent = history.messages[messageId].content;
history.messages[messageId].content = content;
if (output !== undefined) {
history.messages[messageId].output = output;
}
await updateChat();
}
}