ComfyUI Node

Prompt Switch

Your prompt as a clickable checklist (with a dice roll on the side)

By Boba-svg·Created 11 months ago·Updated 9 months ago· 6
Prompt Switch
    • STRING
    text
    prefix

    The name lies a little. PromptSwitch doesn't switch models or LoRAs or anything else with a dropdown - it switches prompt lines on and off. It's a fork of kambara's ComfyUI-PromptPalette that renders the text inside its own widget as a clickable checklist, then layers on the part that actually makes it worth installing: a random pickup that can reroll every time you hit Generate. One STRING in, one STRING out, wired into CLIP Text Encode exactly like a plain prompt node. The "switch" is you, checking and unchecking lines.

    You reach for it when you iterate on prompt variants a lot. Same scene, five facial expressions, three poses, a couple of style candidates - normally that's edit-the-text or stack a handful of bypassed CLIP encodes. This gives you checkboxes and a keyboard. It solves the same itch people solve with rgthree's fast group bypass or a wildcard pack, but it's entirely contained in one node and it's built around clicking, not rewiring.

    How it works

    There are two halves, and they're wildly different in size. The Python node (nodes.py) is roughly forty lines of boring text cleanup: drop blank lines, drop lines starting with //, strip inline // comments, make sure every line ends in a comma, collapse double newlines, and optionally prepend the prefix input on its own line. That's it.

    All the actual magic lives in web/index.js, a frontend extension. In normal mode it redraws the widget as a checklist - click a line to toggle it, +/- buttons on the right to bump its weight in 0.10 steps. And it installs a whole keyboard layer: E/F2 toggles edit mode, A toggles all lines, V compacts, W resets weights, R picks lines at random, C tags the node for auto-random.

    The unusual part: the advanced behavior is driven by tags in the node's title, not the text. /R1-3 means "select 1 to 3 lines at random" (negative counts add miss slots, so /R-8-2 makes a pick genuinely rare), /C means "reroll automatically every time I generate," /CMn-k holds a pick for n generations before rerolling, and /T cycles lines in order. /C works because the extension monkeypatches app.queuePrompt and rewrites the text widget right before the job queues - so the reroll happens client-side, no API, no Python.

    The inputs that matter

    • text - multiline string, required, and the only thing you'll normally touch. One prompt element per line.
    • prefix - optional string that gets prepended on its own line; it's forceInput, so it wires in from another node rather than typed.

    The single output is a STRING. That's your assembled prompt, so it goes into a CLIP Text Encode (positive or negative - a negative-prompt variant is a perfectly good use). Since the node only emits text, you can drop in as many instances as you want and concatenate them.

    Install

    ComfyUI Manager → "Install Custom Nodes" → search PromptSwitch → install → restart. Or the manual route:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Boba-svg/ComfyUI-PromptSwitch.git
    

    Then restart ComfyUI. There's no requirements.txt, no models to download, no Python dependencies - it's a UI node, so the only thing you need afterward is the browser tab reloaded. The README is Japanese-first; the English version is fine, but the shortcut table is where the good detail lives.

    Where people get burned

    • Keys only fire when a PromptSwitch node has focus. If R or C suddenly does nothing, look at which node is selected.
    • The Run-button batch count does not reroll per image. Standard batch gives you 32 identical images from one prompt; the README is explicit about this. For variety per image you either press Generate repeatedly or pair it with the author's AutoBatchRunner.
    • The +/- weight buttons write (word:1.3) CLIP attention syntax. That's correct for SD1.5/SDXL-lineage encoders, but on LLM-encoded models (Flux 2 Klein, Z-Image, Anima) attention weights are silently discarded - so there the buttons stop meaning anything. Line on/off still works, which is the 90% use case anyway.
    • The author lists two known bugs: a node that gets stuck in edit mode on large workflows (hard-refresh the tab), and fetch errors after very long generations when AutoBatchRunner is involved.
    Categoryutils

    Inputs (2)

    NameTypeDefaultDescription
    textSTRING
    prefixoptSTRING

    Outputs (1)

    NameTypeDescription
    STRINGSTRING