Nodes/comfyui-wwdm-aicd/Text Multi Concat
ComfyUI Node

Text Multi Concat

Zip two lists into pairs, or build a full prompt matrix

By wwsmiao·Created 4 months ago·Updated 4 months ago· 0
Text Multi Concat
    • result
    list_a
    list_b
    separator
    modeconcat

    TextConcat stitches two strings together. TextMultiConcat is the grown-up version that works on whole lists, and its cross mode is where it gets genuinely fun: it builds the cartesian product of two lists, which is exactly the prompt matrix trick. Give it ["red", "blue"] and ["dress", "shoes"] and out comes ["red dress", "red shoes", "blue dress", "blue shoes"].

    The inputs are list_a (required, a list), list_b (optional, a list), separator (default empty), and mode. Three modes, three different jobs. concat just appends list_b onto list_a - simple merging. zip pairs them positionally: A[0] + separator + B[0], then A[1] + B[1], and so on, padding the shorter list with empty strings so nothing drops. That's the one you want for turning parallel lists into key-value pairs - ["name", "age"] and ["张三", "25"] with separator ": " becomes ["name: 张三", "age: 25"], which is the README's own example and the natural feeder for JsonBuilder. cross is the cartesian product, and it's the one with real power: two lists of prompt fragments explode into every combination, which is how you sweep a small prompt space in one run.

    The output is always a list. Both list_a and list_b expect list sockets - feed them TextSplit, TxtReg, or TextRandom output, not bare strings. One quirk: in cross mode, if list_b is empty the node just returns list_a unchanged, which is a reasonable degenerate case but means "empty list" silently behaves like "no second list" rather than "empty result."

    Mechanically it's plain Python list building with separator inserted between the joined parts - no regex, no state, no surprises. The separator defaults to empty, so remember to set it if you want spaces or punctuation between fragments; that's the detail people miss and then wonder why "reddress" came out.

    Install, standard for the pack:

    cd ComfyUI/custom_nodes
    git clone https://github.com/wwsmiao/comfyui-wwdm-aicd.git
    

    Restart ComfyUI, find it under wwdm-aicd. No dependencies beyond stdlib; no requirements.txt in the repo despite what the README's install block says. README and source comments are in Chinese; widget labels are English.

    Where it shines: zip for pairing extracted data before JsonBuilder, and cross for prompt variant sweeps - combine with TextRandom for the selection half and you've got a poor man's wildcard system that's fully deterministic when you seed the randomness upstream. It's one of the pack's more interesting nodes, and it costs you nothing to have around.

    Categorywwdm-aicd

    Inputs (4)

    NameTypeDefaultDescription
    list_aSTRING
    list_boptSTRING
    separatoroptSTRING
    modeoptCOMBOconcat3 options: concat, zip, cross

    Outputs (1)

    NameTypeDescription
    resultSTRING