From d90501a71ca47bb41f221eda34439c0bd114f813 Mon Sep 17 00:00:00 2001 From: JohnWL <34081873+John-WL@users.noreply.github.com> Date: Sat, 18 Nov 2023 22:50:29 -0500 Subject: [PATCH] only check for unmuted nodes when validating --- lib_comfyui/comfyui/iframe_requests.py | 4 +++- lib_comfyui/default_workflow_types.py | 2 ++ lib_comfyui/webui/callbacks.py | 1 - scripts/comfyui.py | 1 - 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib_comfyui/comfyui/iframe_requests.py b/lib_comfyui/comfyui/iframe_requests.py index 1a13315..fecfed3 100644 --- a/lib_comfyui/comfyui/iframe_requests.py +++ b/lib_comfyui/comfyui/iframe_requests.py @@ -78,7 +78,9 @@ def validate_amount_of_nodes_or_throw( raise RuntimeError(f'Expected a sequence of length 2 for argument "max_amount_of_nodes", got {len(max_amount_of_nodes)} instead') workflow_graph = get_workflow_graph(workflow_type_id) - node_types = [node['type'] for node in workflow_graph['nodes']] + all_nodes = workflow_graph['nodes'] + enabled_nodes = [node for node in all_nodes if node['mode'] != 2] + node_types = [node['type'] for node in enabled_nodes] amount_of_from_webui_nodes = len([t for t in node_types if t == 'FromWebui']) amount_of_to_webui_nodes = len([t for t in node_types if t == 'ToWebui']) max_from_webui_nodes = max_amount_of_io_nodes[0] if max_amount_of_io_nodes[0] is not None else amount_of_from_webui_nodes diff --git a/lib_comfyui/default_workflow_types.py b/lib_comfyui/default_workflow_types.py index 55586a9..e27990b 100644 --- a/lib_comfyui/default_workflow_types.py +++ b/lib_comfyui/default_workflow_types.py @@ -37,12 +37,14 @@ display_name='Postprocess image', default_workflow=external_code.AUTO_WORKFLOW, types='IMAGE', + max_amount_of_io_nodes=[None, 1], ) before_save_image_workflow_type = external_code.WorkflowType( base_id='before_save_image', display_name='Before save image', default_workflow=external_code.AUTO_WORKFLOW, types='IMAGE', + max_amount_of_io_nodes=[None, 1], ) diff --git a/lib_comfyui/webui/callbacks.py b/lib_comfyui/webui/callbacks.py index c6221da..39623cd 100644 --- a/lib_comfyui/webui/callbacks.py +++ b/lib_comfyui/webui/callbacks.py @@ -60,7 +60,6 @@ def on_before_image_saved(params): tab=tab, batch_input=type_conversion.webui_image_to_comfyui([params.image]), identity_on_error=True, - max_amount_of_io_nodes=[None, 1] ) params.image = type_conversion.comfyui_image_to_webui(results[0], return_tensors=False)[0] diff --git a/scripts/comfyui.py b/scripts/comfyui.py index 54a7730..88bd633 100644 --- a/scripts/comfyui.py +++ b/scripts/comfyui.py @@ -92,7 +92,6 @@ def postprocess_image(self, p, pp, *args): tab=self.get_tab(), batch_input=type_conversion.webui_image_to_comfyui([pp.image]), identity_on_error=True, - max_amount_of_io_nodes=[None, 1] ) pp.image = type_conversion.comfyui_image_to_webui(results[0], return_tensors=False)[0]