Timothy Jaeryang Baek 5 днів тому
батько
коміт
c0d3e70296
1 змінених файлів з 4 додано та 1 видалено
  1. 4 1
      backend/open_webui/tasks.py

+ 4 - 1
backend/open_webui/tasks.py

@@ -164,7 +164,10 @@ async def stop_task(redis, task_id: str):
         # Task successfully canceled
         return {"status": True, "message": f"Task {task_id} successfully stopped."}
 
-    return {"status": False, "message": f"Failed to stop task {task_id}."}
+    if task.cancelled() or task.done():
+        return {"status": True, "message": f"Task {task_id} successfully cancelled."}
+
+    return {"status": True, "message": f"Cancellation requested for {task_id}."}
 
 
 async def stop_item_tasks(redis: Redis, item_id: str):