This commit is contained in:
Jehu
2024-01-25 23:28:16 -07:00
commit b2ff05e474
4 changed files with 43 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
__pycache__/
+5
View File
@@ -0,0 +1,5 @@
## ComfyUI Substring
Just a simple substring node that takes *text* and *length* as input, and outputs the first *length* characters.
To install, just git clone this repo in \ComfyUI\custom_nodes\
+3
View File
@@ -0,0 +1,3 @@
from .nodes import NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS
__all__ = ['NODE_CLASS_MAPPINGS', 'NODE_DISPLAY_NAME_MAPPINGS']
+34
View File
@@ -0,0 +1,34 @@
import os
class SubstringFunction:
def __init__(self):
pass
@classmethod
def INPUT_TYPES(cls):
return {
"required": {
"text": ('STRING', {"multiline": True}),
"length": ('INT', {"default": 75, "min": 0})
}
}
RETURN_TYPES = ('STRING',)
FUNCTION = "exec"
CATEGORY = "utils"
OUTPUT_NODE = True
def exec(self, text, length):
if text == "undefined":
text = ""
out = text[:length]
return {"ui": {"text": (out,)}, "result": (out,)}
NODE_CLASS_MAPPINGS = {
"SubstringTheory": SubstringFunction,
}
NODE_DISPLAY_NAME_MAPPINGS = {
"SubstringTheory": "Substring Node"
}