From 15f350b4175f45243c79a9e010f3280cf3671b0f Mon Sep 17 00:00:00 2001 From: Classic298 <27028174+Classic298@users.noreply.github.com> Date: Tue, 22 Sep 2026 22:47:09 +0200 Subject: [PATCH] fix: keep an open chat's tools when clicking a folder name (#30376) Clicking a folder name in the sidebar while a chat was open switched that chat to the folder's default model for a moment before the page changed. That reset its tools and skills to the folder model's set and saved them as the chat's draft, so on returning to the chat the folder model's tools were shown and sent with the next message. The same happened to a chat just started from the home page. The folder's default model is now only applied while the chat has no messages yet, the same rule new chats already follow when a folder page opens. Folder pages, new chats in a folder and editing a folder's default model behave as before. Verified in a browser against a mock upstream: on dev the next request after the folder click carried the folder model's tool_ids and skill_ids; with the fix it carries the chat's own model's set, for both an existing chat and one started from the home page. Fixes #30226 --- src/lib/components/chat/Chat.svelte | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/lib/components/chat/Chat.svelte b/src/lib/components/chat/Chat.svelte index 95e4e95a49..5141fed098 100644 --- a/src/lib/components/chat/Chat.svelte +++ b/src/lib/components/chat/Chat.svelte @@ -1593,7 +1593,12 @@ const selectedFolderSubscribe = selectedFolder.subscribe(async (folder) => { await tick(); - if (folder?.data?.model_ids && !equal(selectedModels, folder.data.model_ids)) { + // Folder default models apply to new chats only. + if ( + !history.currentId && + folder?.data?.model_ids && + !equal(selectedModels, folder.data.model_ids) + ) { selectedModels = folder.data.model_ids; console.log('Set selectedModels from folder data:', selectedModels);