1 Star 0 Fork 0

comfyui_custom_nodes/ComfyUI-ExLlama-Nodes

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
text.py 1.34 KB
一键复制 编辑 原始数据 按行查看 历史
_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 = "."
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/comfyui_custom_nodes/ComfyUI-ExLlama-Nodes.git
git@gitee.com:comfyui_custom_nodes/ComfyUI-ExLlama-Nodes.git
comfyui_custom_nodes
ComfyUI-ExLlama-Nodes
ComfyUI-ExLlama-Nodes
main

搜索帮助