Nodes/SDXL Auto Prompter/APNext Flexible String Merger
ComfyUI Node

APNext Flexible String Merger

Glue up to four prompt strings into one

By dagthomas·Created 3 years ago·Updated 16 days ago· 285
APNext Flexible String Merger
    • STRING
    string1
    string2
    string3
    string4

    Not every useful node is exciting. This one is plumbing: it takes up to four strings and merges them into one. That's the whole node. But once you start actually using dagthomas's builder family - the Cinematic node feeding one string, the Character node another, a local-file pull for a third - you need something to staple those outputs together into a single prompt, and this is it. It's the connective tissue that turns a scatter of prompt-generating nodes into one clean line into your CLIP Text Encode.

    If you've ever wired three prompt sources and then wondered how to combine them without a mess of intermediate nodes, this is the answer. Boring, essential, and you'll drop it into workflows without thinking once you've got the habit.

    How it works

    Pure Python string concatenation - no model, no API key. It joins string1 with any of the optional string2, string3, string4 you connect, and returns the combined STRING. Only string1 is required, so it's happy taking anywhere from one to four inputs; empty slots are simply skipped. Wire the outputs of your builder nodes, a CustomPromptLoader, a FileReaderNode, or plain text primitives into the slots and take the merged result out the other side.

    The inputs and outputs that matter

    • string1 (required) - the first piece; usually your base prompt or the first builder's output.
    • string2, string3, string4 (optional) - additional pieces to fold in, in order.

    The single output is STRING - everything joined - into a CLIP Text Encode or another string node.

    How to install it

    ComfyUI Manager: search comfyui_dagthomas, install, restart. Manual:

    cd ComfyUI/custom_nodes && git clone https://github.com/dagthomas/comfyui_dagthomas
    cd comfyui_dagthomas && pip install -r requirements.txt
    

    then restart. The requirements.txt installs the full pack stack (openai, anthropic, google-generativeai, transformers, decord, scipy) for the LLM and video nodes the same repo carries. This merger needs none of it; decord is the common build failure, and the utility nodes load regardless.

    Where people get burned

    • Separators and spacing. How the pieces get joined matters for prompt readability - if two fragments end up mashed together without a comma or space between them, the encoder sees one weird token instead of two clean concepts. Make sure your upstream strings carry their own trailing comma/space, or you'll get subtle prompt-parsing weirdness.
    • Order is meaning. On CLIP models, earlier keywords get more attention, and on LLM-encoded models word order binds attributes. So the order you plug the strings in (string1 first) actually changes the image. Put the concepts that matter most in string1.
    • It's just concatenation. It won't dedupe, reconcile contradictions, or clean up your prompt. If two inputs disagree ("photorealistic" and "oil painting"), merging them just hands the conflict to the model. Fix that upstream.
    • Empty inputs are fine. Leaving string2string4 unconnected is expected; the node just uses what it's given.
    Categorycomfyui_dagthomas

    Inputs (4)

    NameTypeDefaultDescription
    string1STRING
    string2optSTRING
    string3optSTRING
    string4optSTRING

    Outputs (1)

    NameTypeDescription
    STRINGSTRING