From fb2e0803c000fd657dee5c6606356af6f8928adc Mon Sep 17 00:00:00 2001 From: Lars Date: Mon, 13 Apr 2026 11:47:31 +0200 Subject: [PATCH] fix: SSE streaming - WorkflowNode label attribute and ai_insights column name - workflow_executor.py: Generate node_label from prompt_slug or node.type (WorkflowNode has no label attribute) - prompts.py: Fix INSERT statement - use 'created' column instead of 'created_at' SSE endpoint now works correctly for workflow execution streaming. --- backend/routers/prompts.py | 4 ++-- backend/workflow_executor.py | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/backend/routers/prompts.py b/backend/routers/prompts.py index fcd524d..9c8b09c 100644 --- a/backend/routers/prompts.py +++ b/backend/routers/prompts.py @@ -1555,8 +1555,8 @@ async def execute_unified_prompt_stream( with get_db() as conn: cur = get_cursor(conn) cur.execute( - """INSERT INTO ai_insights (profile_id, scope, content, metadata, created_at) - VALUES (%s, %s, %s, %s, NOW())""", + """INSERT INTO ai_insights (profile_id, scope, content, metadata, created) + VALUES (%s, %s, %s, %s, CURRENT_TIMESTAMP)""", (profile_id, prompt_slug, content, json.dumps({"prompt_type": result['type']})) ) conn.commit() diff --git a/backend/workflow_executor.py b/backend/workflow_executor.py index 3bb6f67..c27bf59 100644 --- a/backend/workflow_executor.py +++ b/backend/workflow_executor.py @@ -171,10 +171,12 @@ async def execute_workflow( # NEW: Progress-Callback aufrufen (für SSE Streaming) if progress_callback: + # Create a meaningful label for the node + node_label = node.prompt_slug if hasattr(node, 'prompt_slug') and node.prompt_slug else f"{node.type.value}-{node_id[:8]}" await progress_callback("node_complete", { "node_id": node_id, "node_type": node.type, - "node_label": node.label, + "node_label": node_label, "status": node_state.status.value, "total_nodes": len(graph.nodes), "completed_nodes": len([ns for ns in node_states if ns.status in [NodeStatus.COMPLETED, NodeStatus.SKIPPED]]),