From 81dc40534cf0e0b753feb5f1b647c42a118b25b0 Mon Sep 17 00:00:00 2001 From: giles Date: Wed, 4 Feb 2026 20:16:17 +0000 Subject: [PATCH] Add progress metadata to ipfs-stream endpoint Returns progress, frame, total_frames from Celery task state so clients can display rendering progress. Co-Authored-By: Claude Opus 4.5 --- app/routers/runs.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/app/routers/runs.py b/app/routers/runs.py index 865023f..3632c64 100644 --- a/app/routers/runs.py +++ b/app/routers/runs.py @@ -1351,11 +1351,26 @@ async def get_ipfs_stream_info(run_id: str, request: Request): # Task is still running - check database for live playlist updates ipfs_playlist_cid = pending.get("ipfs_playlist_cid") + # Get task state and progress metadata + task_state = result.state + task_info = result.info if isinstance(result.info, dict) else {} + response_data = { "run_id": run_id, - "status": pending.get("status", "pending"), + "status": task_state.lower() if task_state else pending.get("status", "pending"), } + # Add progress metadata if available + if task_info: + if "progress" in task_info: + response_data["progress"] = task_info["progress"] + if "frame" in task_info: + response_data["frame"] = task_info["frame"] + if "total_frames" in task_info: + response_data["total_frames"] = task_info["total_frames"] + if "percent" in task_info: + response_data["percent"] = task_info["percent"] + if ipfs_playlist_cid: response_data["ipfs_playlist_cid"] = ipfs_playlist_cid response_data["ipfs_playlist_url"] = f"{gateway}/{ipfs_playlist_cid}"