Files
2024-07-04 11:34:32 +08:00

1.4 KiB

Documentation

JWString节点用于将字符串列表转换为基于给定模板的格式化字符串。它允许动态地操作和格式化字符串,从而能够从单独的字符串列表创建结构化的文本输出。这个节点在需要灵活处理文本数据并生成特定格式输出的场景中特别有用。

Input types

Required

  • text
    • 这是JWString节点的主要输入,代表需要处理的字符串或字符串列表。它是节点操作的核心数据,直接影响输出结果的内容和结构。
    • Comfy dtype: STRING
    • Python dtype: unknown

Output types

  • string
    • 输出的string参数是JWString节点处理后的结果。它是根据输入的字符串和指定的模板格式化后生成的新字符串。这个输出可以直接用于后续的文本处理或展示。
    • Comfy dtype: STRING
    • Python dtype: str

Usage tips

  • Infra type: CPU
  • Common nodes: unknown

Source code

        @register_node(identifier, display_name)
        class _:
            CATEGORY = category
            INPUT_TYPES = lambda: {"required": required_inputs}
            RETURN_TYPES = tuple(return_types)
            OUTPUT_NODE = output_node
            FUNCTION = "execute"

            def execute(self, *args, **kwargs):
                return func(*args, **kwargs)