mirror of
https://github.com/open-webui/open-webui.git
synced 2026-10-02 02:12:25 +00:00
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.
This commit is contained in:
parent
5399e3977d
commit
f16e9eabe3
1 changed files with 7 additions and 0 deletions
|
|
@ -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]] : [''];
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue