From 565b61d1c20dfc030559ce3bc64a18a738e4881d Mon Sep 17 00:00:00 2001 From: Will Miao Date: Wed, 28 Jan 2026 11:39:05 +0800 Subject: [PATCH] feat: add Text node with autocomplete support Introduce a new TextLM node to the Lora Manager extension, providing a simple text input with autocomplete functionality for tags and styles. The node is integrated into the module's import system and node class mappings, enabling users to utilize autocomplete features for efficient prompt creation. --- __init__.py | 3 ++ py/nodes/text.py | 32 ++++++++++++++++++++++ py/nodes/wanvideo_lora_select_from_text.py | 8 ------ 3 files changed, 35 insertions(+), 8 deletions(-) create mode 100644 py/nodes/text.py diff --git a/__init__.py b/__init__.py index 9d2fe9a3..98034007 100644 --- a/__init__.py +++ b/__init__.py @@ -3,6 +3,7 @@ try: # pragma: no cover - import fallback for pytest collection from .py.nodes.lora_loader import LoraLoaderLM, LoraTextLoaderLM from .py.nodes.trigger_word_toggle import TriggerWordToggleLM from .py.nodes.prompt import PromptLM + from .py.nodes.text import TextLM from .py.nodes.lora_stacker import LoraStackerLM from .py.nodes.save_image import SaveImageLM from .py.nodes.debug_metadata import DebugMetadataLM @@ -24,6 +25,7 @@ except ( sys.path.append(str(package_root)) PromptLM = importlib.import_module("py.nodes.prompt").PromptLM + TextLM = importlib.import_module("py.nodes.text").TextLM LoraManager = importlib.import_module("py.lora_manager").LoraManager LoraLoaderLM = importlib.import_module( "py.nodes.lora_loader" @@ -54,6 +56,7 @@ except ( NODE_CLASS_MAPPINGS = { PromptLM.NAME: PromptLM, + TextLM.NAME: TextLM, LoraLoaderLM.NAME: LoraLoaderLM, LoraTextLoaderLM.NAME: LoraTextLoaderLM, TriggerWordToggleLM.NAME: TriggerWordToggleLM, diff --git a/py/nodes/text.py b/py/nodes/text.py new file mode 100644 index 00000000..8e3dcd60 --- /dev/null +++ b/py/nodes/text.py @@ -0,0 +1,32 @@ +class TextLM: + """A simple text node with autocomplete support.""" + + NAME = "Text (LoraManager)" + CATEGORY = "Lora Manager/utils" + DESCRIPTION = ( + "A simple text input node with autocomplete support for tags and styles." + ) + + @classmethod + def INPUT_TYPES(cls): + return { + "required": { + "text": ( + "AUTOCOMPLETE_TEXT_PROMPT", + { + "placeholder": "Enter text... /char, /artist for quick tag search", + "tooltip": "The text output.", + }, + ), + }, + } + + RETURN_TYPES = ("STRING",) + RETURN_NAMES = ("STRING",) + OUTPUT_TOOLTIPS = ( + "The text output.", + ) + FUNCTION = "process" + + def process(self, text: str): + return (text,) \ No newline at end of file diff --git a/py/nodes/wanvideo_lora_select_from_text.py b/py/nodes/wanvideo_lora_select_from_text.py index 1fe0f29b..71b9b794 100644 --- a/py/nodes/wanvideo_lora_select_from_text.py +++ b/py/nodes/wanvideo_lora_select_from_text.py @@ -115,11 +115,3 @@ class WanVideoLoraTextSelectLM: active_loras_text = " ".join(formatted_loras) return (loras_list, trigger_words_text, active_loras_text) - -NODE_CLASS_MAPPINGS = { - "WanVideoLoraTextSelectLM": WanVideoLoraTextSelectLM -} - -NODE_DISPLAY_NAME_MAPPINGS = { - "WanVideoLoraTextSelectLM": "WanVideo Lora Select From Text (LoraManager)" -}