代码拉取完成,页面将自动刷新
_CATEGORY = "Zuellni/Text"
_MAPPING = "ZuellniText"
class Previewer:
@classmethod
def INPUT_TYPES(cls):
return {"required": {"text": ("STRING", {"forceInput": True})}}
CATEGORY = _CATEGORY
FUNCTION = "preview"
OUTPUT_NODE = True
RETURN_TYPES = ()
def preview(self, text):
return {"ui": {"text": [text]}}
class Replacer:
@classmethod
def INPUT_TYPES(cls):
return {
"required": {"text": ("STRING", {"multiline": True})},
"optional": {
"a": ("STRING", {"forceInput": True, "multiline": True}),
"b": ("STRING", {"forceInput": True, "multiline": True}),
"c": ("STRING", {"forceInput": True, "multiline": True}),
"d": ("STRING", {"forceInput": True, "multiline": True}),
},
}
CATEGORY = _CATEGORY
FUNCTION = "replace"
RETURN_NAMES = ("TEXT",)
RETURN_TYPES = ("STRING",)
def replace(self, text, **inputs):
for key, value in inputs.items():
if value:
text = text.replace(f"[{key}]", value)
return (text,)
NODE_CLASS_MAPPINGS = {
f"{_MAPPING}Previewer": Previewer,
f"{_MAPPING}Replacer": Replacer,
}
NODE_DISPLAY_NAME_MAPPINGS = {
f"{_MAPPING}Previewer": "Preview",
f"{_MAPPING}Replacer": "Replace",
}
WEB_DIRECTORY = "."
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。