Async Workflow #82

Merged
Lars merged 14 commits from develop into main 2026-04-13 11:58:01 +02:00
2 changed files with 20 additions and 2 deletions
Showing only changes of commit 057df0afc8 - Show all commits

View File

@ -816,17 +816,31 @@ def _get_edges_by_label(node_id: str, label: str, graph: WorkflowGraph) -> List[
""" """
Findet alle ausgehenden Edges mit bestimmtem Label. 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: Args:
node_id: Node-ID 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 graph: WorkflowGraph
Returns: Returns:
Liste von Edge-IDs 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 = [ matching_edges = [
e.id for e in graph.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 return matching_edges

View File

@ -230,6 +230,10 @@ class WorkflowEdge(BaseModel):
to_node: str = Field(..., alias="to", description="Ziel-Knoten-ID") 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')") 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): class WorkflowGraph(BaseModel):
""" """