mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-17 14:55:23 +00:00
fix: tools update
This commit is contained in:
parent
489ef9b731
commit
87f656b029
1 changed files with 5 additions and 3 deletions
|
|
@ -188,10 +188,12 @@ class ToolsTable:
|
||||||
def update_tool_by_id(self, id: str, updated: dict) -> Optional[ToolModel]:
|
def update_tool_by_id(self, id: str, updated: dict) -> Optional[ToolModel]:
|
||||||
try:
|
try:
|
||||||
with get_db() as db:
|
with get_db() as db:
|
||||||
tool = db.get(Tool, id)
|
db.query(Tool).filter_by(id=id).update(
|
||||||
tool.update(**updated)
|
{**updated, "updated_at": int(time.time())}
|
||||||
tool.updated_at = int(time.time())
|
)
|
||||||
db.commit()
|
db.commit()
|
||||||
|
|
||||||
|
tool = db.query(Tool).get(id)
|
||||||
db.refresh(tool)
|
db.refresh(tool)
|
||||||
return ToolModel.model_validate(tool)
|
return ToolModel.model_validate(tool)
|
||||||
except:
|
except:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue