feat: Add comprehensive debug information for workflow nodes
Backend changes: - workflow_models.py: Add debug_prompt, debug_raw_response, debug_node_type, debug_prompt_slug, metadata fields to NodeExecutionState - workflow_executor.py: Capture and store debug info for analysis, logic, and join nodes when enable_debug=True - Analysis nodes: store full prompt + raw AI response - Logic nodes: store expression + evaluation result - Join nodes: store strategy + path statistics Frontend changes: - Analysis.jsx: Enable debug mode by default (debug=true) for all workflow executions This allows developers to see exactly what prompt was sent to the AI, what response was received, and how each node was processed - essential for debugging workflow issues.
This commit is contained in:
1 parent
3664f53c51
commit
12d4d7c63b
3 files changed
+40
-7
No files matched your search
@@ -314,11 +314,11 @@ async def execute_node(
|
||||
|
||||
# Logic Nodes (Phase 3)
|
||||
if node.type == "logic":
|
||||
return execute_logic_node(node, context, graph)
|
||||
return execute_logic_node(node, context, graph, enable_debug)
|
||||
|
||||
# Join Nodes (Phase 4)
|
||||
if node.type == "join":
|
||||
return execute_join_node(node, context, graph)
|
||||
return execute_join_node(node, context, graph, enable_debug)
|
||||
|
||||
# Analysis Nodes
|
||||
if node.type == "analysis":
|
||||
@@ -398,6 +398,11 @@ async def execute_node(
|
||||
decision_signals=parsed["decision_signals"],
|
||||
normalized_signals=normalized_signals,
|
||||
reasoning_anchors=parsed.get("reasoning_anchors"),
|
||||
# Debug information (nur wenn enable_debug=True)
|
||||
debug_prompt=augmented_prompt if enable_debug else None,
|
||||
debug_raw_response=llm_response if enable_debug else None,
|
||||
debug_node_type="analysis",
|
||||
debug_prompt_slug=node.prompt_slug if enable_debug else None,
|
||||
started_at=started_at,
|
||||
completed_at=datetime.utcnow().isoformat()
|
||||
)
|
||||
@@ -419,7 +424,8 @@ async def execute_node(
|
||||
def execute_logic_node(
|
||||
node,
|
||||
context: Dict[str, Any],
|
||||
graph: WorkflowGraph
|
||||
graph: WorkflowGraph,
|
||||
enable_debug: bool = False
|
||||
) -> NodeExecutionState:
|
||||
"""
|
||||
Führt Logic Node aus (Phase 3).
|
||||
@@ -519,7 +525,15 @@ def execute_logic_node(
|
||||
"evaluation_result": result if not error else None,
|
||||
"error": error,
|
||||
"activated_edges": activated_edges
|
||||
})
|
||||
}),
|
||||
# Debug information
|
||||
debug_prompt=json.dumps(expression.model_dump() if hasattr(expression, 'model_dump') else str(expression), ensure_ascii=False) if enable_debug and expression else None,
|
||||
debug_raw_response=json.dumps({
|
||||
"result": result,
|
||||
"error": error,
|
||||
"activated_edges": activated_edges
|
||||
}, ensure_ascii=False) if enable_debug else None,
|
||||
debug_node_type="logic"
|
||||
)
|
||||
|
||||
except Exception as e:
|
||||
@@ -536,7 +550,8 @@ def execute_logic_node(
|
||||
def execute_join_node(
|
||||
node,
|
||||
context: Dict[str, Any],
|
||||
graph: WorkflowGraph
|
||||
graph: WorkflowGraph,
|
||||
enable_debug: bool = False
|
||||
) -> NodeExecutionState:
|
||||
"""
|
||||
Führt Join Node aus (Phase 4).
|
||||
@@ -608,7 +623,16 @@ def execute_join_node(
|
||||
normalized_signals=consolidated_signals_list,
|
||||
metadata=join_result.metadata,
|
||||
started_at=started_at,
|
||||
completed_at=datetime.utcnow().isoformat()
|
||||
completed_at=datetime.utcnow().isoformat(),
|
||||
# Debug information
|
||||
debug_prompt=f"Join Strategy: {node.join_strategy.value if node.join_strategy else 'wait_all'}\nPaths: {total_count}\nMinimum Required: {node.min_paths if node.min_paths else 'all'}" if enable_debug else None,
|
||||
debug_raw_response=json.dumps({
|
||||
"executed_paths": executed_count,
|
||||
"total_paths": total_count,
|
||||
"strategy": node.join_strategy.value if node.join_strategy else 'wait_all',
|
||||
"consolidated_nodes": list(join_result.consolidated_analysis_core.keys())
|
||||
}, ensure_ascii=False) if enable_debug else None,
|
||||
debug_node_type="join"
|
||||
)
|
||||
|
||||
except Exception as e:
|
||||
|
||||
Reference in new issue
Block a user