diff --git a/src/lib/components/layout/Sidebar/ChatItem.svelte b/src/lib/components/layout/Sidebar/ChatItem.svelte index 29c483ec47..7900ca8067 100644 --- a/src/lib/components/layout/Sidebar/ChatItem.svelte +++ b/src/lib/components/layout/Sidebar/ChatItem.svelte @@ -340,9 +340,7 @@ const generateTitleHandler = async () => { generating = true; - if (!chat) { - chat = await getChatById(localStorage.token, id); - } + chat = await getChatById(localStorage.token, id); const chatContent = chat.chat; @@ -367,7 +365,13 @@ // active branch. This avoids using the stale top-level `models` // array which may reference a model from an older edit. let model = ''; - if (history?.messages && history?.currentId) { + + // For the active chat, prefer the live dropdown selection. + if (id === $chatId) { + try { model = JSON.parse(sessionStorage.selectedModels || '[]').find((m) => m) ?? ''; } catch {} + } + + if (!model && history?.messages && history?.currentId) { let currentId = history.currentId; while (currentId) { const msg = history.messages[currentId];