Nodes/comfyui-adaptiveprompts/🥣 Prompt Mixer 🥣
ComfyUI Node

🥣 Prompt Mixer 🥣

Blend a second prompt into your base without just concatenating

By Alectriciti·Created 12 months ago·Updated 23 days ago· 87
🥣 Prompt Mixer 🥣
    • STRING
    prompt_base
    prompt_mix
    keep_first0
    shuffle_mix_infalse
    modeSPRINKLE
    seed0
    delimiter,

    You've got a solid base prompt and a second one you want to work into it - extra style tags, a LoRA's trigger words, seasonal flavoring - but just appending it to the end makes it read as an afterthought. On CLIP-token models, position genuinely matters: earlier tags in a prompt receive stronger attention, so tacking your mix-in onto the tail end can bury it under everything that came before. PromptMixer interleaves the second prompt's tokens through the base at chosen positions instead of always dumping them at the end.

    How it works

    Both prompt_base and prompt_mix get split into tokens on delimiter (comma by default). prompt_mix supports dynamic prompt syntax per the README, so it can itself contain __wildcards__ or {brackets} that get resolved fresh before mixing happens - meaning seed here controls both the mix-in content's own randomization and where it gets inserted, worth remembering if you want one to vary independently of the other.

    mode picks the insertion pattern: SPRINKLE spreads mix tokens evenly across the base while trying to avoid placing two of them adjacent to each other, RANDOM picks insertion slots uniformly (which can cluster tokens together by chance), and RANDOM_EXPONENTIAL / RANDOM_SQRT / RANDOM_MIDDLE bias where in the base string the insertions land - the same distribution family PromptSplitter uses for removal, just applied to insertion instead. keep_first protects a number of leading base sections from ever having a mix token inserted before them, so your subject and quality tags at the front stay untouched. shuffle_mix_in randomizes which mix-in token lands in which chosen slot, rather than inserting them in their original left-to-right order.

    The inputs and outputs that matter

    • prompt_base, prompt_mix - both multiline; prompt_mix can contain dynamic prompt syntax.
    • keep_first - leading base sections protected from mixing.
    • shuffle_mix_in - randomize mix-token order at insertion.
    • mode - SPRINKLE, RANDOM, RANDOM_EXPONENTIAL, RANDOM_SQRT, or RANDOM_MIDDLE.
    • seed, delimiter.
    • Output: a single STRING.

    How to install it

    Bundled with the rest of the pack. Search comfyui-adaptiveprompts in ComfyUI Manager, or clone directly:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Alectriciti/comfyui-adaptiveprompts
    

    Restart ComfyUI. No models, no extra dependencies.

    Common issues & troubleshooting

    The mix-in content changes when you only wanted the positions to change (or vice versa). Since prompt_mix resolves its own dynamic syntax using the same seed, both the content and the insertion pattern move together by default. If you need one fixed while the other varies, pre-resolve prompt_mix through a separate Prompt Generator first and feed PromptMixer the already-resolved plain text - that decouples the two.

    keep_first doesn't seem to protect enough of the base. It counts sections split by delimiter, the same convention PromptSplitter uses - count commas (or whatever your delimiter is), not words or characters, when setting this.

    Mix tokens keep clustering together despite using SPRINKLE. SPRINKLE tries to avoid adjacency where possible but isn't a hard guarantee, especially with a short base prompt and a long mix-in - there just aren't enough valid non-adjacent slots to spread everything into. Shorten the mix-in or lengthen the base if even spacing matters a lot for your use case.

    Categoryprompt

    Inputs (7)

    NameTypeDefaultDescription
    prompt_baseSTRINGOriginal prompt (comma separated by default).
    prompt_mixSTRINGPrompt to mix into the base.
    keep_firstINT0Number of first base sections to protect from mixing.
    shuffle_mix_inBOOLEANfalseIf true, randomize *which* mix tokens fill the chosen positions.
    modeCOMBOSPRINKLEInsertion distribution mode: - SPRINKLE: spread mix tokens evenly, avoiding adjacency where possible. - RANDOM: choose insertion slots uniformly at random (with replacement). - RANDOM_EXPONENTIAL: probability increases toward the end (exponential). - RANDOM_SQRT: probability grows like sqrt toward the end. - RANDOM_MIDDLE: probability peaks near the middle of the prompt.
    seedINT00–18446744073709550000Deterministic seed (0 allowed).
    delimiterSTRING,Delimiter used to split/join tokens (default ',').

    Outputs (1)

    NameTypeDescription
    STRINGSTRING