Refactoring
This commit is contained in:
+4
-1
@@ -1,4 +1,7 @@
|
||||
from .py.node import *
|
||||
from .py.node.const import *
|
||||
from .py.node.format import *
|
||||
from .py.node.preset import *
|
||||
|
||||
|
||||
NODE_CLASS_MAPPINGS = {
|
||||
"PromptUtilitiesFormatString": PromptUtilitiesFormatString,
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
class BaseNode:
|
||||
CATEGORY = "PromptUtilities"
|
||||
@@ -0,0 +1,28 @@
|
||||
from .base import BaseNode
|
||||
|
||||
class PromptUtilitiesConstStringBase(BaseNode):
|
||||
RETURN_TYPES = ("STRING",)
|
||||
FUNCTION = "get_string"
|
||||
|
||||
def get_string(self, string):
|
||||
return (string,)
|
||||
|
||||
|
||||
class PromptUtilitiesConstString(PromptUtilitiesConstStringBase):
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
"string": ("STRING", {"default": "", "multiline": False})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class PromptUtilitiesConstStringMultiLine(PromptUtilitiesConstStringBase):
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
"string": ("STRING", {"default": "", "multiline": True})
|
||||
}
|
||||
}
|
||||
@@ -1,37 +1,4 @@
|
||||
import folder_paths
|
||||
|
||||
from .preset import PresetManager
|
||||
|
||||
class BaseNode:
|
||||
CATEGORY = "PromptUtilities"
|
||||
|
||||
|
||||
class PromptUtilitiesConstStringBase(BaseNode):
|
||||
RETURN_TYPES = ("STRING",)
|
||||
FUNCTION = "get_string"
|
||||
|
||||
def get_string(self, string):
|
||||
return (string,)
|
||||
|
||||
|
||||
class PromptUtilitiesConstString(PromptUtilitiesConstStringBase):
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
"string": ("STRING", {"default": "", "multiline": False})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class PromptUtilitiesConstStringMultiLine(PromptUtilitiesConstStringBase):
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
"string": ("STRING", {"default": "", "multiline": True})
|
||||
}
|
||||
}
|
||||
from .base import BaseNode
|
||||
|
||||
|
||||
class PromptUtilitiesFormatString(BaseNode):
|
||||
@@ -81,21 +48,4 @@ class PromptUtilitiesJoinStringList(BaseNode):
|
||||
print(kwargs)
|
||||
print(kwargs.values())
|
||||
result = separator.join(kwargs.values())
|
||||
return (result,)
|
||||
|
||||
|
||||
class PromptUtilitiesLoadPreset(BaseNode):
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {
|
||||
"required": {
|
||||
"preset": (list(PresetManager.get_presets().keys()), ),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("STRING",)
|
||||
FUNCTION = "load_preset"
|
||||
|
||||
def load_preset(self, preset):
|
||||
prompt = PresetManager.get_prompt(preset)
|
||||
return (prompt,)
|
||||
return (result,)
|
||||
@@ -0,0 +1,19 @@
|
||||
from .base import BaseNode
|
||||
from ..preset import PresetManager
|
||||
|
||||
|
||||
class PromptUtilitiesLoadPreset(BaseNode):
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {
|
||||
"required": {
|
||||
"preset": (list(PresetManager.get_presets().keys()), ),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("STRING",)
|
||||
FUNCTION = "load_preset"
|
||||
|
||||
def load_preset(self, preset):
|
||||
prompt = PresetManager.get_prompt(preset)
|
||||
return (prompt,)
|
||||
Reference in New Issue
Block a user