فهرست منبع

fix: tools update

Timothy J. Baek 10 ماه پیش
والد
کامیت
87f656b029
1فایلهای تغییر یافته به همراه5 افزوده شده و 3 حذف شده
  1. 5 3
      backend/apps/webui/models/tools.py

+ 5 - 3
backend/apps/webui/models/tools.py

@@ -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)
-                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()
                 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: