diff --git a/backend/workflow_executor.py b/backend/workflow_executor.py index dbc398b..ad25033 100644 --- a/backend/workflow_executor.py +++ b/backend/workflow_executor.py @@ -816,17 +816,31 @@ def _get_edges_by_label(node_id: str, label: str, graph: WorkflowGraph) -> List[ """ Findet alle ausgehenden Edges mit bestimmtem Label. + Unterstützt beide Formate: + - Legacy: e.label == label (z.B. "then", "else") + - UI: e.source_handle == label (z.B. "true", "false") + Args: node_id: Node-ID - label: Edge-Label (z.B. "then", "else", "uncertainty") + label: Edge-Label oder sourceHandle (z.B. "then"/"true", "else"/"false") graph: WorkflowGraph Returns: Liste von Edge-IDs """ + # Map label to sourceHandle equivalents + label_to_handle = { + "then": "true", + "else": "false" + } + handle_equivalent = label_to_handle.get(label, label) + matching_edges = [ e.id for e in graph.edges - if e.from_node == node_id and e.label == label + if e.from_node == node_id and ( + e.label == label or # Legacy format + (hasattr(e, 'source_handle') and e.source_handle == handle_equivalent) # UI format + ) ] return matching_edges diff --git a/backend/workflow_models.py b/backend/workflow_models.py index 0b98ef2..0467285 100644 --- a/backend/workflow_models.py +++ b/backend/workflow_models.py @@ -230,6 +230,10 @@ class WorkflowEdge(BaseModel): to_node: str = Field(..., alias="to", description="Ziel-Knoten-ID") label: Optional[str] = Field(None, description="Label für visuelle Darstellung (z.B. 'then', 'else')") + # UI-Format fields (React Flow) + source_handle: Optional[str] = Field(None, alias="sourceHandle", description="Source handle ID (UI format: 'true', 'false', 'out')") + target_handle: Optional[str] = Field(None, alias="targetHandle", description="Target handle ID (UI format: 'in', 'path_1', etc.)") + class WorkflowGraph(BaseModel): """