From 87f656b02933a7269720646c507b9314c70dfc99 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Mon, 8 Jul 2024 11:46:37 -0700 Subject: [PATCH] fix: tools update --- backend/apps/webui/models/tools.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/backend/apps/webui/models/tools.py b/backend/apps/webui/models/tools.py index a6fbe120f..685ce6fcf 100644 --- a/backend/apps/webui/models/tools.py +++ b/backend/apps/webui/models/tools.py @@ -188,10 +188,12 @@ class ToolsTable: def update_tool_by_id(self, id: str, updated: dict) -> Optional[ToolModel]: try: with get_db() as db: - tool = db.get(Tool, id) - tool.update(**updated) - tool.updated_at = int(time.time()) + db.query(Tool).filter_by(id=id).update( + {**updated, "updated_at": int(time.time())} + ) db.commit() + + tool = db.query(Tool).get(id) db.refresh(tool) return ToolModel.model_validate(tool) except: