diff --git a/backend/open_webui/models/models.py b/backend/open_webui/models/models.py index 93dafe0f05..f5964c0579 100755 --- a/backend/open_webui/models/models.py +++ b/backend/open_webui/models/models.py @@ -244,11 +244,9 @@ class ModelsTable: try: with get_db() as db: # update only the fields that are present in the model - result = ( - db.query(Model) - .filter_by(id=id) - .update(model.model_dump(exclude={"id"})) - ) + data = model.model_dump(exclude={"id"}) + result = db.query(Model).filter_by(id=id).update(data) + db.commit() model = db.get(Model, id) diff --git a/backend/open_webui/routers/models.py b/backend/open_webui/routers/models.py index dae3634ff8..a689d26e98 100644 --- a/backend/open_webui/routers/models.py +++ b/backend/open_webui/routers/models.py @@ -321,7 +321,7 @@ async def update_model_by_id( detail=ERROR_MESSAGES.ACCESS_PROHIBITED, ) - model = Models.update_model_by_id(id, form_data) + model = Models.update_model_by_id(form_data.id, ModelForm(**form_data.model_dump())) return model