diff --git a/js/button/dependencies.js b/js/button/dependencies.js index e6831ca..dd39629 100644 --- a/js/button/dependencies.js +++ b/js/button/dependencies.js @@ -121,21 +121,23 @@ export const resolveDependencies = async (diff) => { export const pollSyncDependencies = async (taskId) => { let status = ''; + let statusMessage = ''; while (status !== 'Task completed' && status !== 'Task failed') { await new Promise(resolve => setTimeout(resolve, 1000)); // Wait for 1 second before the next poll try { const statusData = await local.pollUploadStatus(taskId) //await fetch(`/comfy-cloud/upload-status/${taskId}`); status = statusData.status; + statusMessage = statusData.message; } catch(e) { + statusMessage = e?.message; console.error("Poll dependencies error:", e) } - } if (status == "Task failed") { - throw new Error("Failed to upload") + throw new Error(statusMessage || "Failed to upload") } } diff --git a/python/custom_routes.py b/python/custom_routes.py index 739543d..ac36f69 100644 --- a/python/custom_routes.py +++ b/python/custom_routes.py @@ -249,9 +249,9 @@ async def upload_task_execution(task_id, json_response, workflow_id, models_dep, } ) # cleanup temp - task_status[task_id] = {"status": "Task completed", "result": ""} + task_status[task_id] = {"status": "Task completed", "message": "Upload successful"} except Exception as e: - task_status[task_id] = {"status": f"Task failed: {str(e)}", "error": str(e)} + task_status[task_id] = {"status": f"Task failed", "message": str(e)} loop = asyncio.get_event_loop() with concurrent.futures.ThreadPoolExecutor() as executor: @@ -292,7 +292,7 @@ async def upload_dependencies(request): # Parse the JSON content json_response = response.json() task_id = str(uuid.uuid4()) - task_status[task_id] = {"status": "Task started", "result": None} + task_status[task_id] = {"status": "Task started", "message": None} # Process custom nodes update_dependencies() @@ -339,7 +339,7 @@ async def upload_dependencies(request): @server.PromptServer.instance.routes.get("/comfy-cloud/upload-status/{task_id}") async def get_task_status(request): task_id = request.match_info['task_id'] - status = task_status.get(task_id, {"status": "Task not found"}) + status = {"status": "Task failed", "message": str("asd")} #task_status.get(task_id, {"status": "Task failed", "message": "Task not found"}) return web.json_response(status)