Rename nodes, add string node and concat.

This commit is contained in:
Ivor Wanders
2024-06-22 17:00:29 -04:00
parent e594c3ec0c
commit 801bcb288c
7 changed files with 76 additions and 17 deletions
+22 -12
View File
@@ -1,23 +1,33 @@
from .nodes.save_string import SaveString
from .nodes.print_string import PrintString
from .nodes.replace_string import ReplaceString
from .nodes.string_save import StringSave
from .nodes.string_print import StringPrint
from .nodes.string_replace import StringReplace
from .nodes.string_node import StringNode
from .nodes.string_concat import StringConcat
from .nodes.tokenizer_vocab import TokenizerVocab
from .nodes.pick_item_json import PickItemJson
from .nodes.json_pick_item import JsonPickItem
NODE_CLASS_MAPPINGS = {
"IW_SaveString": SaveString,
"IW_PrintString": PrintString,
"IW_ReplaceString": ReplaceString,
"IW_StringSave": StringSave,
"IW_StringPrint": StringPrint,
"IW_StringReplace": StringReplace,
"IW_StringNode": StringNode,
"IW_StringConcat": StringConcat,
"IW_TokenizerVocab": TokenizerVocab,
"IW_PickItemJson": PickItemJson,
"IW_JsonPickItem": JsonPickItem,
}
# A dictionary that contains the friendly/humanly readable titles for the nodes
NODE_DISPLAY_NAME_MAPPINGS = {
"IW_SaveString": "IW SaveString",
"IW_StringSave": "IW SaveString",
"IW_StringPrint": "IW PrintString",
"IW_StringReplace": "IW ReplaceString",
"IW_StringNode": "IW StringNode",
"IW_StringConcat": "IW StringConcat",
"IW_TokenizerVocab": "IW TokenizerVocab",
"IW_PickItemJson": "IW PickItemJson",
"IW_PrintString": "IW PrintString",
"IW_ReplaceString": "IW ReplaceString",
"IW_JsonPickItem": "IW JsonPickItem",
}
@@ -1,7 +1,7 @@
import os
import json
class PickItemJson:
class JsonPickItem:
def __init__(self):
pass
@@ -10,7 +10,7 @@ class PickItemJson:
return {
"required": {
"pick_value": ("INT",{"defaultInput": True, "default": 0}),
"input": ("STRING",{"defaultInput": True, "default": "", "dynamicPrompts": False, "multiline": True}),
"input": ("STRING",{"defaultInput": False, "default": "", "dynamicPrompts": False, "multiline": True}),
},
"optional": {
},
+25
View File
@@ -0,0 +1,25 @@
import os
import json
class StringConcat:
def __init__(self):
pass
@classmethod
def INPUT_TYPES(s):
return {
"required": {
"prefix": ("STRING",{"defaultInput": True, "default": "", "multiline": True, "dynamicPrompts": False}),
"suffix": ("STRING",{"defaultInput": True, "default": "", "multiline": True, "dynamicPrompts": False, "hidden": True}),
},
"optional": {
},
}
RETURN_TYPES = ("STRING", )
FUNCTION = "execute"
CATEGORY = "iw"
def execute(self, prefix, suffix):
return (prefix + suffix,)
+24
View File
@@ -0,0 +1,24 @@
import os
import json
class StringNode:
def __init__(self):
pass
@classmethod
def INPUT_TYPES(s):
return {
"required": {
"input": ("STRING",{"defaultInput": False, "default": "", "multiline": True, "dynamicPrompts": False}),
},
"optional": {
},
}
RETURN_TYPES = ("STRING", )
FUNCTION = "execute"
CATEGORY = "iw"
def execute(self, input):
return (input,)
@@ -1,5 +1,5 @@
class PrintString:
class StringPrint:
def __init__(self):
pass
@@ -1,7 +1,7 @@
import os
import json
class ReplaceString:
class StringReplace:
def __init__(self):
pass
@@ -2,7 +2,7 @@ import folder_paths
import os
import json
class SaveString:
class StringSave:
def __init__(self):
self.output_dir = folder_paths.get_output_directory()
pass