mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-12 12:25:20 +00:00
refac
This commit is contained in:
parent
41701697ec
commit
27b8775032
2 changed files with 4 additions and 6 deletions
|
|
@ -244,11 +244,9 @@ class ModelsTable:
|
||||||
try:
|
try:
|
||||||
with get_db() as db:
|
with get_db() as db:
|
||||||
# update only the fields that are present in the model
|
# update only the fields that are present in the model
|
||||||
result = (
|
data = model.model_dump(exclude={"id"})
|
||||||
db.query(Model)
|
result = db.query(Model).filter_by(id=id).update(data)
|
||||||
.filter_by(id=id)
|
|
||||||
.update(model.model_dump(exclude={"id"}))
|
|
||||||
)
|
|
||||||
db.commit()
|
db.commit()
|
||||||
|
|
||||||
model = db.get(Model, id)
|
model = db.get(Model, id)
|
||||||
|
|
|
||||||
|
|
@ -321,7 +321,7 @@ async def update_model_by_id(
|
||||||
detail=ERROR_MESSAGES.ACCESS_PROHIBITED,
|
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
|
return model
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue