π Text Input Switch (2 way)
An A/B switch for your prompts, with no bypassing required
- STRING
The classic ComfyUI way to test two prompts is to build two prompt-encode branches and manually bypass one, then the other. It works, and it's also fiddly and easy to forget. π Text Input Switch (2 way) is the cleaner version: two text inputs, one integer dial, one output. Flip the dial from 1 to 2 and the node passes whichever text you selected, no bypassing, no re-wiring. For A/B prompt testing it's exactly the right shape.
How it works
The required input is an INT widget clamped to 1 or 2. The optional text1 and text2 inputs are multiline strings, and they're marked as force-input, meaning ComfyUI encourages you to wire them from other nodes rather than typing inline. On execution, input <= 1 passes text1 through; anything else passes text2. That's the entire mechanism - no memory, no fancy routing, just a selector.
The output is a single STRING, ready to feed a CLIP Text Encode. The switch value can be a plain widget you click between runs, or - the more interesting pattern - you can drive it from elsewhere in the graph: wire an integer from an expression node, a step counter, or even a random source, and the switch becomes a programmatic chooser.
Inputs and outputs
- input -
INT, default1, min 1, max 2. The selector. - text1 / text2 -
STRING, optional. The candidates. - Output:
STRING- whichever text was selected.
Where it fits
The two-prompt A/B test is the obvious use: positive prompt for one look, positive prompt for another, flip the dial, compare on a locked seed. It also composes naturally with the pack's other text nodes - a π Text box feeding each slot, or an π Integer driving the switch from a batch counter so a loop rotates between the two prompts automatically.
Install
Part of hay86/ComfyUI_AceNodes:
cd ComfyUI/custom_nodes
git clone https://github.com/hay86/ComfyUI_AceNodes
cd ComfyUI_AceNodes
pip install -r requirements.txt
Restart ComfyUI and find π
Text Input Switch (2 way) under Ace Nodes. Manager users search ComfyUI_AceNodes.
Gotchas
The selector is an integer, not a boolean - a 0 wired in gets treated as "select text1," and there's no visual label telling you which is live beyond the number. And because text1/text2 are optional with empty-string defaults, an unwired slot silently outputs an empty string instead of erroring, which is easy to mistake for a broken prompt. Also, the pack's usual install weight applies: the full requirements.txt (rembg, transformers, boto3β¦) installs even if this is the only node you use. Two slots not enough? The pack also ships the 8-way version of the same idea.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| input | INT | 11β2 | β |
| text1opt | STRING | β | |
| text2opt | STRING | β |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | β |