diff --git a/handler.py b/handler.py index d7d2034..23b1c10 100644 --- a/handler.py +++ b/handler.py @@ -116,11 +116,16 @@ def convert_frontend_to_api(frontend_workflow: dict) -> dict: nodes = frontend_workflow.get("nodes", []) links = frontend_workflow.get("links", []) + # Build set of active (non-bypassed) node IDs + active_nodes = {str(node["id"]) for node in nodes if node.get("mode") != 4} + # Build link lookup: link_id -> (source_node_id, source_slot) + # Only include links from active nodes link_map = {} for link in links: link_id, src_node, src_slot, dst_node, dst_slot, link_type = link[:6] - link_map[link_id] = (str(src_node), src_slot) + if str(src_node) in active_nodes: + link_map[link_id] = (str(src_node), src_slot) # Widget mappings for each node type: list of input names in order WIDGET_MAPPINGS = { @@ -165,6 +170,10 @@ def convert_frontend_to_api(frontend_workflow: dict) -> dict: } for node in nodes: + # Skip bypassed/muted nodes (mode 4) + if node.get("mode") == 4: + continue + node_id = str(node["id"]) class_type = node.get("type", "")