From 326072b820dbe0edc7b85a88ab0faa716487a94c Mon Sep 17 00:00:00 2001 From: curious-george-is-available Date: Mon, 1 Jun 2026 13:35:49 +0530 Subject: [PATCH] feat: Add ApiTextOutputNode custom node for API executions --- __init__.py | 7 +++++-- api_text_node.py | 28 ++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 api_text_node.py diff --git a/__init__.py b/__init__.py index be5a6e9..56dd1d5 100644 --- a/__init__.py +++ b/__init__.py @@ -1,13 +1,16 @@ from .fast_preview import FastPreviewImage +from .api_text_node import ApiTextOutputNode WEB_DIRECTORY = "./web" NODE_CLASS_MAPPINGS = { - "FastPreviewImage": FastPreviewImage + "FastPreviewImage": FastPreviewImage, + "ApiTextOutputNode": ApiTextOutputNode } NODE_DISPLAY_NAME_MAPPINGS = { - "FastPreviewImage": "Fast Preview & Optimize" + "FastPreviewImage": "Fast Preview & Optimize", + "ApiTextOutputNode": "➡️ API Text Output" } __all__ = ['NODE_CLASS_MAPPINGS', 'NODE_DISPLAY_NAME_MAPPINGS', 'WEB_DIRECTORY'] diff --git a/api_text_node.py b/api_text_node.py new file mode 100644 index 0000000..c4bf73b --- /dev/null +++ b/api_text_node.py @@ -0,0 +1,28 @@ +class ApiTextOutputNode: + def __init__(self): + pass + + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "text": ("STRING", {"forceInput": True}), + } + } + + # Tells ComfyUI's API wrapper that this node yields valid execution data + OUTPUT_NODE = True + + RETURN_TYPES = () + FUNCTION = "send_text_to_api" + CATEGORY = "Fast Preview" + + def send_text_to_api(self, text): + print(f"[Fast Preview] Sending text string to API payload: {text}") + + # Returns empty tuple for standard routing, passes text to the UI/API layers + return { + "ui": { + "text": [text] + } + }