mirror of
https://github.com/open-webui/open-webui.git
synced 2026-10-28 06:22:33 +00:00
fix: model import silently skips a model whose ID is already taken (#32866)
Importing a model JSON on the Workspace Models page as a regular user skipped any model whose ID already belonged to another user's model they cannot edit, or to a model from one of the instance's connections such as OpenAI or Ollama. There was no message, so the model just never showed up. The import now stops at that model with the error "Uh-oh! This model id is already registered. Please choose another model id string."; the models before it in the file are imported and the ones after it are not. Admins, and users who can edit the existing model, are unaffected and still overwrite it.
This commit is contained in:
parent
e745465758
commit
cb7d7e851d
1 changed files with 6 additions and 10 deletions
|
|
@ -580,12 +580,10 @@ async def import_models(
|
|||
and existing_model.user_id != user.id
|
||||
and model_id not in writable_model_ids
|
||||
):
|
||||
log.warning(
|
||||
'import_models: user %s skipped model %s (no write access)',
|
||||
user.id,
|
||||
model_id,
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_401_UNAUTHORIZED,
|
||||
detail=ERROR_MESSAGES.MODEL_ID_TAKEN,
|
||||
)
|
||||
continue
|
||||
|
||||
if (
|
||||
user.role != 'admin'
|
||||
|
|
@ -648,12 +646,10 @@ async def import_models(
|
|||
base_model_ids.add(base_model_id.split(':', 1)[0])
|
||||
|
||||
if model_id in base_model_ids:
|
||||
log.warning(
|
||||
'import_models: user %s skipped model %s (id belongs to a base model)',
|
||||
user.id,
|
||||
model_id,
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_401_UNAUTHORIZED,
|
||||
detail=ERROR_MESSAGES.MODEL_ID_TAKEN,
|
||||
)
|
||||
continue
|
||||
|
||||
new_model.access_grants = await filter_allowed_access_grants(
|
||||
await Config.get('user.permissions'),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue