Added prompt_combine
This commit is contained in:
+5
-2
@@ -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",
|
||||
}
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
+4
-4
@@ -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
|
||||
|
||||
@@ -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),)
|
||||
Reference in New Issue
Block a user