Nodes/ComfyUI-QING/文本拼接丨V1
ComfyUI Node

文本拼接丨V1

One template, five slots, and a debug report on what filled them

By sheengoa·Created about a year ago·Updated 19 days ago· 16
文本拼接丨V1
    • result_text
    • debug_info
    template
    text1
    text2
    text3
    text4
    text5

    Assembling a string out of parts is the most boring, most frequent job in prompt engineering. TextTemplateConcat is the QING pack's answer: a template with up to five slots, and - the part that makes it worth using - a debug output that tells you exactly which slots filled, which didn't, and which placeholders it didn't recognize.

    Display name: "文本拼接丨V1" ("text concat / V1"). The "V1" is honest packaging: this is the pack's first-generation take on template filling, sitting alongside the fancier QING_PromptTemplate for heavier prompting work.

    How it works

    You write a template (multiline) containing placeholders {text1} through {text5}, and provide up to five text values. On execution, every placeholder in the template gets replaced by its matching value. The mechanism is a straight text substitution - nothing fancier than find-and-replace.

    Where it earns its keep is the second output, debug_info. It's a compact report in the form:

    used=text1,text3; unused=text2,text4,text5; empty_inputs=text3; unknown_placeholders=subject
    
    • used - which slots actually appeared in your template.
    • unused - slots you provided values for but never referenced (a silent hint you wasted a slot).
    • empty_inputs - slots you left blank; those get replaced with an empty string.
    • unknown_placeholders - placeholders in the template that aren't text1..text5 at all. Those are left in the output untouched. A stray {subject} will show up verbatim in your final string, and this flag is the only way you'd know.

    Inputs and outputs

    • template (required) - the text with {text1}{text5} placeholders. Multiline, so you can build multi-line prompts or blocks.
    • text1text5 (required) - the slot values. These are single-line text boxes; if your value is long, build it upstream and wire it in.
    • Outputs: result_text (the assembled string) and debug_info (the fill report).

    What to use it for

    The obvious job is prompt assembly - "a photo of {text1}, {text2}, in the style of {text3}" - where the slots come from different parts of the graph and you want the pieces visible as separate wires. It's also fine for message templates and path templates. If all you're doing is gluing two strings with a separator, it's overkill; this node's value shows up when you have a reusable shape with several named holes.

    That said, for serious prompt work this is where the caveat lands: this node does literal substitution, with no awareness of the weight syntax, CLIP encoder, or base-model prompt style the text is headed for. The community's collected wisdom on what makes a good prompt - structure, weight syntax, model-specific grammar - lives in prompt-engineering.md, and none of it is handled here. This is a string tool, not a prompt optimizer.

    Installing it

    TextTemplateConcat ships in ComfyUI-QING:

    cd ComfyUI/custom_nodes
    git clone https://github.com/GAO-SHIQING/ComfyUI-QING
    cd ComfyUI-QING
    python install_dependencies.py
    

    Restart ComfyUI, or install "ComfyUI-QING" via ComfyUI Manager.

    Troubleshooting

    • {subject} appears literally in my output. It's not one of the five known placeholders, so it's not substituted. Check debug_info's unknown_placeholders - the template only understands {text1} through {text5}.
    • A slot came out empty. Look for it in empty_inputs - you left the value blank. Or it's in unused, meaning you filled it but never put the placeholder in the template.
    • Debug output looks like noise. It's designed to be read when something's wrong. When the template fills cleanly, glance at used once and move on.

    Five slots, one template, and a paper trail. It's the kind of node that's invisible when it works - and when it doesn't, at least it tells you why.

    CategoryQING/数据工具

    Inputs (6)

    NameTypeDefaultDescription
    templateSTRING模板文本(多行),支持占位符:{text1}~{text5}
    text1STRING文本1
    text2STRING文本2
    text3STRING文本3
    text4STRING文本4
    text5STRING文本5

    Outputs (2)

    NameTypeDescription
    result_textSTRING
    debug_infoSTRING