Nodes/ComfyUI-Ichis-Pack/ICHIS Text Selector
ComfyUI Node

ICHIS Text Selector

A wildcard picker for people who never installed the wildcard pack

By ichabodcole·Created about a year ago·Updated 11 months ago· 2
ICHIS Text Selector
    • selected_text
    • index_used
    text
    modenormal
    index1
    seed0
    filter_indices
    reset_stepfalse

    The {brown|blonde|black} bracket trick is fine for one or two alternatives, but the moment you want to cycle a dozen outfits across a batch, you want something that actually picks a segment for you. That's this node: write a list of prompt variants, tell it how to pick, and it hands back one string to feed into your CLIP Text Encode. It's a wildcard picker that doesn't require the whole dynamic-prompt extension ecosystem.

    How it works

    You format your text as blocks, each starting with a line that begins with @:

    @1 A portrait of a woman, red dress, studio lighting, 35mm
    @2 A portrait of a woman, blue suit, golden hour, 85mm
    @3 A portrait of a woman, leather jacket, neon alley, 24mm
    

    Every line starting with @ begins a new segment, so the node turns that into three options. Then mode decides which you get:

    • normal - use the index input directly.
    • step - cycle through the segments one per queue, wrapping at the end. This is the mode for batching: queue ten runs and you roll through your ten variants in order.
    • random - seeded random pick, so seed makes a set of runs reproducible.

    The output is selected_text (the block with the @ marker stripped) plus index_used so you can log which variant won.

    The filter input

    filter_indices lets you shrink the pool without editing the text. The format, straight from the code: +[1,3-5] means only these indices, -[2,4-6] means everything except these, and ranges like 3-5 are expanded to 3,4,5.

    Here's a genuine gotcha: the README's example claims a bare 1,3-6,8 excludes those indices. The shipped code does the opposite - no prefix means inclusion. If you type a bare list, you're saying "only pick from these." Use the explicit - prefix to exclude. The README is stale; the code wins.

    The inputs you'll actually set

    • text - your @-marked blocks.
    • mode - normal / step / random.
    • index, seed, filter_indices, reset_step - everything else is optional. reset_step zeroes the step counter, which is handy when you want a batch to start from variant 1 again.

    Two behaviors worth knowing. Step and random modes force a re-run on every queue (their IS_CHANGED returns a fresh value), so they won't be skipped by caching; normal mode only re-executes when something changes. And if you're in normal mode with a filter_indices list that excludes your index, the node snaps to the nearest allowed index instead of erroring.

    Installing it

    This node lives in the Ichis pack, so you get all of it at once:

    cd ComfyUI/custom_nodes
    git clone https://github.com/ichabodcole/ComfyUI-Ichis-Pack
    

    Restart ComfyUI, or just search for ComfyUI-Ichis-Pack in ComfyUI Manager. No models, no extra Python deps beyond torch - it's a plain text utility.

    Where it fits

    Wire selected_text into a CLIP Text Encode (positive prompt) and set step mode, and you've built the character-reference-library trick from the prompt-engineering playbooks: same seed, same checkpoint, different outfit per run. It also pairs well with ICHIS Extract Tags - select a segment, then strip it down to just the details you want.

    CategoryICHIS

    Inputs (6)

    NameTypeDefaultDescription
    textSTRING
    modeCOMBOnormal3 options: normal, step, random
    indexoptINT11–1000
    seedoptINT00–18446744073709550000
    filter_indicesoptSTRING
    reset_stepoptBOOLEANfalse

    Outputs (2)

    NameTypeDescription
    selected_textSTRING
    index_usedINT