From c4ec7a2820cd3dd7297ac6d1a24d334f5bd9684e Mon Sep 17 00:00:00 2001 From: AhBumm Date: Tue, 5 Nov 2024 13:27:16 +0800 Subject: [PATCH] add a concat text build-in node --- __init__.py | 5 +++++ billbum_modified.py | 25 ++++++++++++++++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/__init__.py b/__init__.py index c9af19a..43c6aa8 100644 --- a/__init__.py +++ b/__init__.py @@ -13,6 +13,11 @@ NODE_CLASS_MAPPINGS = { "BillBum_Modified_Structured_LLM_Node(Imperfect)": BillBum_Modified_Structured_LLM_Node, "BillBum_Modified_Flux_API_Node": BillBum_Modified_Flux_API_Node, "BillBum_Modified_RegText_Node": BillBum_Modified_RegText_Node, + "BillBum_Modified_DropoutToken_Node": BillBum_Modified_DropoutToken_Node, + "BillBum_Modified_Image_API_Call_Node": BillBum_Modified_Image_API_Call_Node, + "BillBum_Modified_Recraft_API_Node": BillBum_Modified_Recraft_API_Node, + "Text_Concat": Text_Concat, + "Input_Text": Input_Text, } NODE_DISPLAY_NAME_MAPPINGS = { diff --git a/billbum_modified.py b/billbum_modified.py index 4df358f..f2125d6 100644 --- a/billbum_modified.py +++ b/billbum_modified.py @@ -76,6 +76,29 @@ def pil2tensor(images: Image.Image | list[Image.Image]) -> torch.Tensor: else: return torch.cat([single_pil2tensor(img) for img in images], dim=0) +class Text_Concat: + + def __init__(self): + pass + + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "text_1": ("STRING", {"defaultInput": True},), + "text_2": ("STRING", {"defaultInput": True},), + }, + } + + RETURN_TYPES = ("STRING",) + RETURN_NAMES = ("text",) + FUNCTION = "text_concat" + CATEGORY = "string processing" + + def text_concat(self, text_1, text_2): + text = [text_1, " ", text_2] + return (text,) + class Input_Text: def __init__(self): @@ -85,7 +108,7 @@ class Input_Text: def INPUT_TYPES(s): return { "required": { - "text": ("STRING",), + "text": ("STRING", {"multiline": True},), }, }