fix: Include node_states in SSE execution_complete and execution_failed events
- Serialize NodeExecutionState models to dict for JSON transmission - Add node_states to execution_complete event for debug panel - Add node_states to execution_failed event for partial progress visibility - Enables WorkflowDebugPanel to display per-node debug information Fixes: WorkflowDebugPanel not appearing due to missing node_states in SSE stream
This commit is contained in:
parent
0a27533262
commit
d3c28a6ee9
|
|
@ -216,6 +216,7 @@ async def execute_workflow(
|
||||||
"execution_id": execution_id,
|
"execution_id": execution_id,
|
||||||
"status": "completed",
|
"status": "completed",
|
||||||
"aggregated_result": aggregated,
|
"aggregated_result": aggregated,
|
||||||
|
"node_states": [ns.model_dump() for ns in node_states], # Serialize Pydantic models
|
||||||
"total_nodes": len(node_states),
|
"total_nodes": len(node_states),
|
||||||
"completed_nodes": len([ns for ns in node_states if ns.status == NodeStatus.EXECUTED]),
|
"completed_nodes": len([ns for ns in node_states if ns.status == NodeStatus.EXECUTED]),
|
||||||
"skipped_nodes": len([ns for ns in node_states if ns.status == NodeStatus.SKIPPED]),
|
"skipped_nodes": len([ns for ns in node_states if ns.status == NodeStatus.SKIPPED]),
|
||||||
|
|
@ -238,12 +239,16 @@ async def execute_workflow(
|
||||||
|
|
||||||
# NEW: Progress-Callback für Fehler
|
# NEW: Progress-Callback für Fehler
|
||||||
if progress_callback:
|
if progress_callback:
|
||||||
await progress_callback("execution_failed", {
|
error_data = {
|
||||||
"execution_id": execution_id,
|
"execution_id": execution_id,
|
||||||
"status": "failed",
|
"status": "failed",
|
||||||
"error": str(e),
|
"error": str(e),
|
||||||
"completed_at": datetime.utcnow().isoformat()
|
"completed_at": datetime.utcnow().isoformat()
|
||||||
})
|
}
|
||||||
|
# Include node_states if available (to show partial progress)
|
||||||
|
if 'node_states' in locals() and node_states:
|
||||||
|
error_data["node_states"] = [ns.model_dump() for ns in node_states]
|
||||||
|
await progress_callback("execution_failed", error_data)
|
||||||
|
|
||||||
# Speichere Failed State
|
# Speichere Failed State
|
||||||
completed_at = datetime.utcnow().isoformat()
|
completed_at = datetime.utcnow().isoformat()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user