Nodes/ComfyUI Simply Nodes/Text Flow Controller
ComfyUI Node

Text Flow Controller

Combine four prompt chunks into one — or keep them apart

By Wicloz·Created 2 years ago·Updated 11 months ago· 1
Text Flow Controller
    • STRING
    • STRING
    • STRING
    • STRING
    delimiter,
    collapse_whitespacetrue
    concatenatefalse
    text_a
    text_b
    text_c
    text_d

    Text Flow Controller takes up to four text inputs and either passes each through untouched, or fuses them all into one string joined by a delimiter you choose. There's a third trick in there too: an option to collapse runs of whitespace down to single spaces. If you've ever pasted a prompt from somewhere else and gotten newlines and double-spaces where they don't belong, that last feature alone is worth the install.

    The build-your-prompt-from-parts pattern is why this exists. Instead of one giant text field, you keep the pieces separate - a subject chunk, a style block, quality tags, a camera note - each fed by its own node, and let Text Flow assemble them. On the SDXL-lineage models most people still run, that block-structured prompting style is practically the house style, and this node makes it mechanical rather than a copy-paste ritual.

    How it works

    It's a plain string operation. With concatenate off, the node is a four-lane normalizer: each output echoes its matching input (after optional whitespace collapsing). With concatenate on, it joins all four inputs with the delimiter and puts the same joined string on every output. The whitespace collapse uses a regex that turns any run of whitespace - newlines, tabs, multiple spaces - into a single space, which is what turns a messy pasted prompt into one clean line.

    Inputs and outputs

    • delimiter (default ", ") - the separator used when concatenating.
    • collapse_whitespace (default true) - normalizes whitespace on all inputs before anything else happens.
    • concatenate (default false) - off = four passthroughs; on = one joined string on all four outputs.
    • text_a through text_d - the optional inputs, all forced to be wired (you can't type directly into them; they're meant to be fed from other nodes).

    Four STRING outputs. With concatenate off, output A mirrors text_a, and so on. With it on, all four outputs carry the identical joined string - wire any one of them.

    Two honest quirks

    The concatenate mode does a naive join, which means empty inputs leave stray delimiters behind: "a, , c" if text_b was empty. Keep the optional inputs fed, or accept the artifacts and trim with a regex node. And because the text fields are forceInput, this node isn't a place to hand-type text - it's a plumbing node, not a writer.

    Installing it

    ComfyUI Manager → search "ComfyUI Simply Nodes" → install → restart, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Wicloz/ComfyUI-Simply-Nodes
    

    No requirements.txt, no models, nothing to download. It only needs Python's re module.

    Common issues

    • All four outputs look identical: that's concatenate on, working as designed. Wire one output, not all four.
    • Stray commas in the prompt: an empty input plus concatenate on. Feed the input or accept the artifact.
    • Newlines still in the output: collapse_whitespace collapsed them - if it's off, that's why. This node only normalizes when the flag is on.

    If your workflow is a pile of separate text nodes feeding one encoder, Text Flow is the tidy way to merge them. And if you've ever fought a multi-line prompt that the encoder treated weirdly, the whitespace collapse is the hidden win here.

    Categoryprompt

    Inputs (7)

    NameTypeDefaultDescription
    delimiterSTRING,
    collapse_whitespaceBOOLEANtrue
    concatenateBOOLEANfalse
    text_aoptSTRING
    text_boptSTRING
    text_coptSTRING
    text_doptSTRING

    Outputs (4)

    NameTypeDescription
    STRINGSTRING
    STRINGSTRING
    STRINGSTRING
    STRINGSTRING