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 <noreply@anthropic.com>
This commit is contained in:
@@ -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}"
|
||||
|
||||
Reference in New Issue
Block a user