ComfyUI Node

Prompt Switch (5)

The small prompt router that ends duplicate workflows

By itom0717·Created 6 months ago·Updated 6 months ago· 0
Prompt Switch (5)
    • selected_text
    id1
    text_01
    text_02
    text_03
    text_04
    text_05

    The one I'd actually reach for. Prompt Switch (5) is the same string router as its (10) and (20) siblings from itom0717's Prompt String Selector pack, but with a five-input ceiling - and five inputs is honest for most real workflows. Two or three variants is normal; a five-way switch covers you with room to spare and half the wire clutter.

    What it does

    You give it an id (INT, 1–5) and it passes through exactly one of the five text_01text_05 inputs, out as selected_text. Change the number, get a different prompt. It's a static router - pick one connected string and output it - not the A1111-style [Dog|Cat] step-alternation "prompt switch" you might have seen in SD-land. That's prompt scheduling, which this node deliberately is not.

    Why five is the sweet spot: it's the size that keeps the node compact on the canvas, and for the most common use - A-versus-B character or style swaps - you'll use two pins and have three spare. The pack's own sample workflow ships this variant, not the big ones: an ID Select feeds id, and the switch's selected_text drops into the pack's Aggregator next to Character and Art Style selectors. Character A or character B becomes one integer.

    How it works

    From the source, the mechanism is three lines of real logic:

    • id required, default 1, min 1, max 5.
    • Inputs are text_01 through text_05 (two-digit labels - text_02, not text_2), all optional STRINGs with forceInput.
    • The chosen string is stripped, gets a ,\n appended if it doesn't already end in a comma, and passes out - the comma is there so it chains cleanly into an aggregator or a CLIP text encode.

    The failure mode is the one to remember: an unconnected or empty pin returns an empty string, not an error. It never crashes, so "my prompt just disappeared" usually means "I switched to an id whose pin is empty." With a range of only five, you'll do that exactly once before it clicks.

    Install

    Same as the whole pack - no requirements, no model downloads, MIT:

    cd ComfyUI/custom_nodes
    git clone https://github.com/itom0717/ComfyUI-Prompt-String-Selector
    

    Restart ComfyUI (and refresh the browser so the nodes register). ComfyUI Manager → Install via Git URL also works.

    Verdict

    If you want to stop duplicating workflows for every prompt variant, this is the node to start with. The (10) buys you headroom if you genuinely juggle more than five variants, and the (20) is for people running a real library - but for the classic "same graph, different character" problem, five is plenty and small enough to leave on the canvas without a second thought.

    CategoryPrompt String Selector

    Inputs (6)

    NameTypeDefaultDescription
    idINT11–5
    text_01optSTRING
    text_02optSTRING
    text_03optSTRING
    text_04optSTRING
    text_05optSTRING

    Outputs (1)

    NameTypeDescription
    selected_textSTRING