Nodes/ComfyUI FRED Nodes v2/πŸ‘‘ FRED Wildcard Concat (Dynamic)
ComfyUI Node

πŸ‘‘ FRED Wildcard Concat (Dynamic)

FRED's dynamic wildcard concat, block by block

By PoukpalaovaΒ·Created about a year agoΒ·Updated 7 months agoΒ· 3
πŸ‘‘ FRED Wildcard Concat (Dynamic)
    • result
    • help
    β—„wildcards_dir/tmp/ComfyUI/custom_nodes/ComfyUI-FRED-Nodes_v2/wildcardsβ–Ί
    β—„string_delimiter β–Ί
    β—„prefixβ–Ί
    β—„rows_json[]β–Ί

    If you've ever wanted to batch 30 images of "the same person, different hair, different outfit, different setting" without hand-writing 30 prompts, this is the node. The πŸ‘‘ FRED Wildcard Concat (Dynamic) builds a prompt by snapping together blocks of text picked from plain .txt files - and any block set to random gets re-rolled on every generation. It's the old A1111 wildcard idea ("one random thing from a list, each run") that most people arriving after 2024 never learned, minus the cryptic __wildcard__ syntax, plus a UI that finally makes it approachable.

    Think of it as the prompt-building cousin of the rgthree Power Lora Loader: same "stack a list of things, toggle them on and off, tweak the weight of each" energy, except the things are text fragments instead of LoRAs. You wire the resulting string into your positive prompt (or negative, if you want to randomize what to avoid), and every queue gets a fresh combination.

    How it works

    You get a node with a real UI: a βž• Add Wildcard button stacks rows, each row has an on/off toggle, a file picker (populated from your wildcards folder via a tiny API the pack registers), a line mode, a weight, and a suffix. The UI serializes everything into a rows_json string the backend reads on each execution - you never hand-edit that; it says "managed by UI" for a reason.

    For each active row the node reads the chosen .txt file, skips blank lines and lines starting with #, and picks a line. Mode random grabs a random non-empty line; pick a specific line and it's fixed. Weight isn't just decoration - a weight other than 1.0 wraps the chosen text in (word:1.25) emphasis syntax, so the model actually hears the emphasis, not just the text. A per-row suffix gets appended with your delimiter, and the blocks join together with whatever string_delimiter you set. Type \n if you want newlines between blocks - the node decodes escape sequences for you.

    The inputs that matter

    • wildcards_dir - where the .txt files live. It defaults to the pack's own wildcards folder (which ships with a starter set of themed lists), and you can point it anywhere. Files are one-entry-per-line; drop in your own and they show up in the file dropdown.
    • string_delimiter - the glue between blocks (default is a space; , for booru-style tag lists).
    • prefix - static text placed before the first block.
    • rows_json - ignore it. That's the UI's clipboard.

    Outputs are result (the final string, ready for your prompt) and help (a walkthrough the author ships in the node).

    Installing it

    Same pack as the other FRED nodes: ComfyUI Manager β†’ search "ComfyUI FRED Nodes v2", or

    cd ComfyUI/custom_nodes
    git clone https://github.com/Poukpalaova/ComfyUI-FRED-Nodes_v2.git
    

    then restart. No model downloads, no weights - the heavy pip deps in the repo (opencv, facexlib, piq, and friends) belong to the image-processing nodes in the pack, not this one. It needs the pack's web/ assets for the buttons to render, which ComfyUI mounts automatically.

    Where people get burned

    The big one: random blocks force re-execution. The node's cache logic adds a fresh nonce whenever any row is random, so ComfyUI re-runs it every queue - which is precisely what you want for variety, but it means a workflow containing a random wildcard never fully caches. That's a known wildcard-node footgun in ComfyUI generally (changing the prompt every run breaks prompt caching and, on tight-VRAM setups, can tip you back into low-VRAM mode), so budget for it.

    Two quieter traps: a block silently vanishes if its file is empty or the path is wrong (no error, just a shorter prompt - check the file dropdown actually lists your file), and a malformed rows_json degrades to an empty string rather than complaining. If you get an empty result and no obvious cause, clear the rows and re-add them from the buttons.

    CategoryπŸ‘‘FRED/text

    Inputs (4)

    NameTypeDefaultDescription
    wildcards_dirSTRING/tmp/ComfyUI/custom_nodes/ComfyUI-FRED-Nodes_v2/wildcardsFolder with .txt files (defaults to this node's ./wildcards).
    string_delimiterSTRING String placed between blocks and between text and suffix (e.g. space, comma+space, newline).
    prefixSTRINGPlaced before the first block using the same delimiter.
    rows_jsonSTRING[]Managed by UI. JSON array of rows.

    Outputs (2)

    NameTypeDescription
    resultSTRINGβ€”
    helpSTRINGβ€”