From 86df8bf27e1b84abbe2eeedcc8650df59c7d23d6 Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Tue, 5 May 2026 02:41:22 +0900 Subject: [PATCH] refac --- src/lib/components/chat/Chat.svelte | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/lib/components/chat/Chat.svelte b/src/lib/components/chat/Chat.svelte index 03af994a68..1468d6b349 100644 --- a/src/lib/components/chat/Chat.svelte +++ b/src/lib/components/chat/Chat.svelte @@ -2416,6 +2416,22 @@ window.history.replaceState(history.state, '', `/c/${res.chat_id}`); currentChatPage.set(1); await chats.set(await getChatList(localStorage.token, $currentChatPage)); + + // Persist chat-level params (system prompt, advanced + // params) and files that the backend doesn't have when + // it creates the chat shell. Without this, reloading + // loses them. Only patch these fields — avoid writing + // history/messages which the backend is updating + // concurrently via streaming. + if ( + Object.keys(params).length > 0 || + chatFiles.length > 0 + ) { + await updateChatById(localStorage.token, res.chat_id, { + params: params, + files: chatFiles + }); + } } } }