Nodes/VLM_nodes/Text Join
ComfyUI Node Runs on cloud

Text Join

Text Join merges eight strings cleanly

By gokayfem·Created 3 years ago·Updated 9 days ago· 583
Text Join
    • text
    • parts_json
    • part_count
    text_a
    separatorNew line
    custom_separator |
    trim_partstrue
    drop_emptytrue
    deduplicatefalse
    text_b
    text_c
    text_d
    text_e
    text_f
    text_g
    text_h

    Every serious ComfyUI workflow eventually grows a tower of concatenation nodes: three text sources, a separator, two more, and before you know it there are six nodes doing what should be one operation. VLMTextJoin is the one operation. It merges up to eight text values into a single string, with controls for separators, trimming, dropping empties, and deduplication - and it does it in a single node with a stable output.

    You reach for it whenever a prompt needs assembling from multiple sources: a system instruction, a detection report, an image caption, a question, context from another branch. Instead of chaining Text nodes and concat primitives, plug all your sources into the lettered inputs and read one clean string out.

    How it works

    text_a is required; text_b through text_h are optional and simply skip themselves if left empty (once you also turn on drop_empty, which is on by default). Every part gets trimmed by default (trim_parts), empty parts are dropped (drop_empty), and optionally duplicates removed (deduplicate).

    The separator is a dropdown - New line, Blank line, Space, Comma, or Custom - and only in Custom mode does the custom_separator field (default " | ") come into play. That dropdown is the ergonomic win: you're picking "join these with newlines," not typing \n and hoping the widget doesn't mangle it.

    Outputs:

    • text - the joined string, ready for a model, template, or file path.
    • parts_json - the individual trimmed/kept parts as JSON, handy for debugging which parts survived drop_empty.
    • part_count - how many parts actually made it into the join. Wire this into a condition or just glance at it when a prompt comes out shorter than expected.

    A note on dedup

    deduplicate is off by default, and that's the right default. It removes consecutive-and-nonconsecutive exact duplicates via stable first-seen ordering, which is great for "the caption and the instruction said the same thing" and wrong for "I joined two paragraphs that legitimately share a sentence." Leave it off unless you specifically want it.

    Install

    Part of ComfyUI VLM Nodes (gokayfem/ComfyUI_VLM_nodes). ComfyUI Manager → search "VLM Nodes", or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/gokayfem/ComfyUI_VLM_nodes
    python -m pip install -r ComfyUI/custom_nodes/ComfyUI_VLM_nodes/requirements.txt
    

    Run pip with ComfyUI's Python; the repo won't install its own torch. Pure string work - no models, no downloads, CPU-friendly.

    Gotchas

    Two small things. First: drop_empty drops parts after trimming, so a string of only spaces won't survive - usually what you want, occasionally surprising. Second: if you're joining text that will be split again downstream (say, batched per-line), pick New line as the separator and keep deduplicate off, or you'll silently lose legitimately repeated content.

    CategoryVLM Nodes/Text/Create

    Inputs (13)

    NameTypeDefaultDescription
    text_aSTRING
    separatorCOMBONew line5 options: New line, Blank line, Space, Comma, Custom
    custom_separatorSTRING | Used only when separator is Custom.
    trim_partsBOOLEANtrue
    drop_emptyBOOLEANtrue
    deduplicateBOOLEANfalse
    text_boptSTRING
    text_coptSTRING
    text_doptSTRING
    text_eoptSTRING
    text_foptSTRING
    text_goptSTRING
    text_hoptSTRING

    Outputs (3)

    NameTypeDescription
    textSTRING
    parts_jsonSTRING
    part_countINT