diff --git a/__init__.py b/__init__.py index 02d0e28..df4d2f4 100644 --- a/__init__.py +++ b/__init__.py @@ -3,7 +3,8 @@ from .split_string import SplitStringNode from .lora_selector import LoraSelectorNode from .lora_tester_xl import LoraTestXLNode from .lora_tester import LoraTestNode -from.character_select import CharacterSelectNode +from .character_select import CharacterSelectNode +from .prompt_combine import CombineStringNode NODE_CLASS_MAPPINGS = { "Find SDXL Resolution": FindResolutionNode, @@ -11,7 +12,8 @@ NODE_CLASS_MAPPINGS = { "Lora Selector": LoraSelectorNode, "Lora Tester XL": LoraTestXLNode, "Lora Tester": LoraTestNode, - "Character Selector": CharacterSelectNode + "Character Selector": CharacterSelectNode, + "Prompt Combine": CombineStringNode } NODE_DISPLAY_NAME_MAPPINGS = { @@ -21,4 +23,5 @@ NODE_DISPLAY_NAME_MAPPINGS = { "Lora Tester XL": "Lora Tester XL", "Lora Tester": "Lora Tester", "Character Selector": "Character Selector", + "Prompt Combine": "Prompt Combine", } diff --git a/__pycache__/__init__.cpython-311.pyc b/__pycache__/__init__.cpython-311.pyc index 41a9a52..11cff4e 100644 Binary files a/__pycache__/__init__.cpython-311.pyc and b/__pycache__/__init__.cpython-311.pyc differ diff --git a/__pycache__/character_select.cpython-311.pyc b/__pycache__/character_select.cpython-311.pyc index ad467dd..4475628 100644 Binary files a/__pycache__/character_select.cpython-311.pyc and b/__pycache__/character_select.cpython-311.pyc differ diff --git a/__pycache__/prompt_combine.cpython-311.pyc b/__pycache__/prompt_combine.cpython-311.pyc new file mode 100644 index 0000000..05a946c Binary files /dev/null and b/__pycache__/prompt_combine.cpython-311.pyc differ diff --git a/character_select.py b/character_select.py index 505b9f0..63f7382 100644 --- a/character_select.py +++ b/character_select.py @@ -40,13 +40,13 @@ class CharacterSelectNode: if char_item['name'] == character: if character_strength == 1: if(character_pronpt): - return (char_item['associated_string'], char_item['prompt'], ) + return (f"{char_item['associated_string']}, ", char_item['prompt'], ) else: - return (char_item['associated_string'], ) + return (f"{char_item['associated_string']}, ", "", ) else: if(character_pronpt): - return (f"({char_item['associated_string']}:{character_strength})", char_item['prompt'], ) + return (f"({char_item['associated_string']}:{character_strength}), ", char_item['prompt'], ) else: - return (f"({char_item['associated_string']}:{character_strength})", ) + return (f"({char_item['associated_string']}:{character_strength}), ", "", ) return (None,) # Return a tuple if character not found diff --git a/prompt_combine.py b/prompt_combine.py new file mode 100644 index 0000000..7a5af68 --- /dev/null +++ b/prompt_combine.py @@ -0,0 +1,31 @@ +class CombineStringNode: + @classmethod + def INPUT_TYPES(cls): + return { + "required": { + "string_a": ("STRING", {"default": ""}), + "string_b": ("STRING", {"default": ""}), + "string_c": ("STRING", {"default": ""}), + "string_d": ("STRING", {"default": ""}), + "separator": ("STRING", {"default": ", "}), + }, + } + + RETURN_TYPES = ("STRING",) + RETURN_NAMES = ("PROMPT",) + FUNCTION = "combine_string" + CATEGORY = "sn0w" + + def combine_string(self, string_a, string_b, string_c, string_d, separator): + strings = [string_a, string_b, string_c, string_d] + combined = [] + + for string in strings: + if string: # Skip empty strings + # Add the string to the combined list, appending separator if needed + if not string.endswith(separator): + string += separator + combined.append(string) + + # Join all parts and return as a tuple + return (''.join(combined),)