From 8c5e5c4277c6e33f2d9b4be4038435871101d7f9 Mon Sep 17 00:00:00 2001 From: bennykok Date: Sat, 21 Sep 2024 10:39:34 -0700 Subject: [PATCH] feat: add ComfyUIDeployExternalTextAny --- comfy-nodes/external_text_any.py | 46 ++++++++++++++++++++++++++++++++ custom_routes.py | 2 +- 2 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 comfy-nodes/external_text_any.py diff --git a/comfy-nodes/external_text_any.py b/comfy-nodes/external_text_any.py new file mode 100644 index 0000000..e84be41 --- /dev/null +++ b/comfy-nodes/external_text_any.py @@ -0,0 +1,46 @@ +class AnyType(str): + def __ne__(self, __value: object) -> bool: + return False + + +WILDCARD = AnyType("*") + +class ComfyUIDeployExternalTextAny: + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "input_id": ( + "STRING", + {"multiline": False, "default": "input_text"}, + ), + }, + "optional": { + "default_value": ( + "STRING", + {"multiline": True, "default": ""}, + ), + "display_name": ( + "STRING", + {"multiline": False, "default": ""}, + ), + "description": ( + "STRING", + {"multiline": True, "default": ""}, + ), + } + } + + RETURN_TYPES = (WILDCARD,) + RETURN_NAMES = ("text",) + + FUNCTION = "run" + + CATEGORY = "text" + + def run(self, input_id, default_value=None, display_name=None, description=None): + return [default_value] + + +NODE_CLASS_MAPPINGS = {"ComfyUIDeployExternalTextAny": ComfyUIDeployExternalTextAny} +NODE_DISPLAY_NAME_MAPPINGS = {"ComfyUIDeployExternalTextAny": "External Text Any (ComfyUI Deploy)"} \ No newline at end of file diff --git a/custom_routes.py b/custom_routes.py index 3794cf1..68cbe7e 100644 --- a/custom_routes.py +++ b/custom_routes.py @@ -309,7 +309,7 @@ def apply_inputs_to_workflow(workflow_api: Any, inputs: Any, sid: str = None): value['inputs']["input_id"] = new_value # Fix for external text default value - if (value["class_type"] == "ComfyUIDeployExternalText"): + if (value["class_type"] == "ComfyUIDeployExternalText" or value["class_type"] == "ComfyUIDeployExternalTextAny"): value['inputs']["default_value"] = new_value if (value["class_type"] == "ComfyUIDeployExternalCheckpoint"):