mirror of
https://github.com/open-webui/open-webui.git
synced 2026-10-07 02:58:21 +00:00
fix: apply the custom model fallback to chats sent from the web UI (#31353)
With ENABLE_CUSTOM_MODEL_FALLBACK on, a workspace model whose base model is gone should be answered by the first default model. That worked for plain API calls, but every chat sent from the web UI failed with "Model not found" for users and "Model '' was not found" for admins, and no model was called. Web UI chats carry a chat id and a socket session, so the request is split into one task per selected model. Each task was rebuilt with the originally requested model id, which dropped the fallback chosen earlier in the handler. The task for the requested model now keeps the fallback model when one was chosen. The chat still records the workspace model the user picked. Tested end to end against a mock upstream, as user and admin, in new and existing chats: before, every web UI send with such a model errored; after, the default model answers. Healthy models, workspace models with a valid base and multi-model sends behave as before, and with the fallback disabled the chat still fails with "Model not found". Fixes #31345
This commit is contained in:
parent
5e1f4d8c33
commit
5b0a889a74
1 changed files with 3 additions and 0 deletions
|
|
@ -1822,6 +1822,9 @@ async def chat_completion(
|
|||
if not assistant_message_id:
|
||||
continue
|
||||
|
||||
if fallback_model is not None and target_model_id == model_id:
|
||||
target_model_id = fallback_model['id']
|
||||
|
||||
# Per-model metadata: own message_id + model
|
||||
per_model_metadata = {
|
||||
**metadata,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue