Responsive Gui - partially Workflow #61

Merged
Lars merged 47 commits from develop into main 2026-04-05 11:27:44 +02:00
2 changed files with 20 additions and 4 deletions
Showing only changes of commit c95b4e185d - Show all commits

View File

@ -354,6 +354,9 @@ def parse_workflow_graph(graph_jsonb: Dict) -> WorkflowGraph:
Args: Args:
graph_jsonb: JSONB dict aus workflow_definitions.graph graph_jsonb: JSONB dict aus workflow_definitions.graph
Unterstützt beide Edge-Formate:
- Backend: {"from": "...", "to": "..."}
- Frontend: {"source": "...", "target": "..."}
Returns: Returns:
Validiertes WorkflowGraph-Objekt Validiertes WorkflowGraph-Objekt
@ -361,6 +364,19 @@ def parse_workflow_graph(graph_jsonb: Dict) -> WorkflowGraph:
Raises: Raises:
ValidationError: Bei ungültigem Graph-Format ValidationError: Bei ungültigem Graph-Format
""" """
# Normalize edges: convert React Flow format (source/target) to backend format (from/to)
if "edges" in graph_jsonb:
normalized_edges = []
for edge in graph_jsonb["edges"]:
normalized_edge = edge.copy()
# Convert source → from, target → to (if present)
if "source" in normalized_edge and "from" not in normalized_edge:
normalized_edge["from"] = normalized_edge.pop("source")
if "target" in normalized_edge and "to" not in normalized_edge:
normalized_edge["to"] = normalized_edge.pop("target")
normalized_edges.append(normalized_edge)
graph_jsonb = {**graph_jsonb, "edges": normalized_edges}
return WorkflowGraph(**graph_jsonb) return WorkflowGraph(**graph_jsonb)

View File

@ -201,7 +201,7 @@ async def execute_workflow(
completed_at = datetime.utcnow().isoformat() completed_at = datetime.utcnow().isoformat()
save_execution_state( save_execution_state(
execution_id=execution_id, execution_id=execution_id,
workflow_id=workflow_id or "", # Empty string if None (when graph_data is used) workflow_id=workflow_id, # Can be None when graph_data is used
profile_id=profile_id, profile_id=profile_id,
node_states=node_states if 'node_states' in locals() else [], node_states=node_states if 'node_states' in locals() else [],
status="failed", status="failed",
@ -212,7 +212,7 @@ async def execute_workflow(
return ExecutionResult( return ExecutionResult(
execution_id=execution_id, execution_id=execution_id,
workflow_id=workflow_id or "", # Empty string if None (when graph_data is used) workflow_id=workflow_id or "N/A", # ExecutionResult requires string, use placeholder
status="failed", status="failed",
node_states=node_states if 'node_states' in locals() else [], node_states=node_states if 'node_states' in locals() else [],
aggregated_result={}, aggregated_result={},
@ -840,7 +840,7 @@ def aggregate_results(node_states: List[NodeExecutionState]) -> Dict[str, Any]:
def save_execution_state( def save_execution_state(
execution_id: str, execution_id: str,
workflow_id: str, workflow_id: Optional[str], # None when using graph_data directly (Phase 5)
profile_id: str, profile_id: str,
node_states: List[NodeExecutionState], node_states: List[NodeExecutionState],
status: str, status: str,
@ -853,7 +853,7 @@ def save_execution_state(
Args: Args:
execution_id: UUID der Execution execution_id: UUID der Execution
workflow_id: UUID des Workflows workflow_id: UUID des Workflows (None wenn graph_data direkt verwendet wird)
profile_id: UUID des Profils profile_id: UUID des Profils
node_states: Liste aller NodeExecutionState node_states: Liste aller NodeExecutionState
status: 'completed' | 'failed' | 'partial' status: 'completed' | 'failed' | 'partial'