Text Join
Text Join merges eight strings cleanly
- text
- parts_json
- part_count
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 surviveddrop_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.
Inputs (13)
| Name | Type | Default | Description |
|---|---|---|---|
| text_a | STRING | — | |
| separator | COMBO | New line | 5 options: New line, Blank line, Space, Comma, Custom |
| custom_separator | STRING | | | Used only when separator is Custom. |
| trim_parts | BOOLEAN | true | — |
| drop_empty | BOOLEAN | true | — |
| deduplicate | BOOLEAN | false | — |
| text_bopt | STRING | — | |
| text_copt | STRING | — | |
| text_dopt | STRING | — | |
| text_eopt | STRING | — | |
| text_fopt | STRING | — | |
| text_gopt | STRING | — | |
| text_hopt | STRING | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| text | STRING | — |
| parts_json | STRING | — |
| part_count | INT | — |