From f16e9eabe3f723e6a383d866c6ddfced80cf3f8f Mon Sep 17 00:00:00 2001 From: Classic298 <27028174+Classic298@users.noreply.github.com> Date: Mon, 21 Sep 2026 14:08:27 +0200 Subject: [PATCH] feat: fall back to an available model when a chat's models are gone (#29757) Retiring a model leaves every chat that used it stuck. The chat still stores the old model id, so it loads with nothing usable selected and refuses to send until the user picks a replacement by hand, in every old conversation. There is no admin-side way to move those chats across. Loading a chat now drops model ids that no longer exist, and an empty selection falls into the fallback this function already applies to new chats: the user's default model, then the admin-configured default, then the first available model. A chat that still has one live model keeps it. The filter runs before the single-model permission clamp so a restricted user keeps a live model the chat already has instead of losing it to the clamp. The model list cannot distinguish a retired model from one whose connection is momentarily unreachable, so during such an outage a chat pinned to that connection will open on the fallback model and record it when saved. Models defined in the workspace are unaffected, since they stay in the list while their connection is down. --- src/lib/components/chat/Chat.svelte | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/lib/components/chat/Chat.svelte b/src/lib/components/chat/Chat.svelte index 0e03b75324..8c95b6d2d8 100644 --- a/src/lib/components/chat/Chat.svelte +++ b/src/lib/components/chat/Chat.svelte @@ -2313,6 +2313,13 @@ ? chatContent.models : [chatContent.models ?? '']; + // An empty model list is not evidence that the chat's models are gone. + if ($models.length > 0) { + selectedModels = selectedModels.filter((modelId) => + $models.map((m) => m.id).includes(modelId) + ); + } + if (!($user?.role === 'admin' || ($user?.permissions?.chat?.multiple_models ?? true))) { selectedModels = selectedModels.length > 0 ? [selectedModels[0]] : ['']; }