Nodes/ComfyUI-NS-Util/Simple LLM: Merge Text
ComfyUI Node

Simple LLM: Merge Text

Stitch up to four strings with a separator you actually control

By NakamuraShippo·Created about a year ago·Updated 4 months ago· 5
Simple LLM: Merge Text
    • STRING
    text1
    separator
    text2
    text3
    text4

    String assembly is the plumbing of every LLM workflow: you've got a base prompt here, some context there, a rule or two from a widget - and you need them joined into one block before the model ever sees them. Simple LLM: Merge Text is this pack's answer: up to four text inputs, one separator, one combined string out. It's the node you reach for instead of hand-building prompt concatenation.

    It's part of the SimpleLLM family in ComfyUI-NS-Util (NakamuraShippo's utility pack; the LLM corner is still flagged as in-testing in the README). There are fancier prompt-assembly nodes in the wild, but this one is deliberately plain, and plain is often what you want. The detail that makes it good: empty inputs are skipped, so a blank optional slot doesn't leave a stray blank line or dangling separator in your prompt.

    How it works

    It takes text1 plus up to three optional texts, drops any that are empty, and joins the survivors with whatever separator you set. The default separator is a newline, which reads correctly for LLM prompts - each block on its own line. The join is literal and dumb in the best way: set the separator to ", " and you get a CSV-ish list; set it to "\n\n" and you get paragraph spacing.

    The inputs that matter

    • text1 - required, multiline. Your base string.
    • separator - the glue. Default \n. This is the knob worth playing with; it changes the whole shape of the output.
    • text2, text3, text4 - optional, multiline, empty by default. Leave them empty to skip them entirely - no blank lines, no doubled separators.

    Output: a single STRING - the joined text. Feed it into Simple LLM Run: Prompt as your prompt, or into Chain of Thought's problem slot, or anywhere else a string is expected.

    Installing the pack

    # ComfyUI Manager → Install via Git URL:
    https://github.com/NakamuraShippo/ComfyUI-NS-Util
    
    # or:
    cd ComfyUI/custom_nodes
    git clone https://github.com/NakamuraShippo/ComfyUI-NS-Util
    pip install pyyaml watchdog
    

    Restart ComfyUI. No models, no network, no heavy deps - pure text processing.

    Common issues

    The separator is the source of most confusion. Because the default is a literal newline, users who want commas set the field to ", " and are surprised the output isn't comma-separated - check what's actually in the separator box. And if merged output looks glued together with no spaces, that's a separator problem, not a bug. One more: only up to four inputs - for more, chain two Merge Text nodes together. It's new-and-being-tested like the rest of the LLM family, but as string nodes go, it's about as safe as they come.

    CategoryNS/LLM/Text

    Inputs (5)

    NameTypeDefaultDescription
    text1STRING
    separatorSTRING
    text2optSTRING
    text3optSTRING
    text4optSTRING

    Outputs (1)

    NameTypeDescription
    STRINGSTRING