ComfyUI Node

Tag Selector

A lookup table that turns one word into a full tag set

By isekai-sh·Created 9 months ago·Updated 8 months ago· 3
Tag Selector
    • selected_tags
    trigger_word
    presets[Superman] movie, superhero, dc, comic, blue, red [Batman] dark, knight, gotham, rich, black [Wonder Woman] amazon, warrior, princess, tiara
    default_value

    IsekaiTagSelector is a tiny dictionary in node form: you hand it a trigger word and it looks it up in a preset table you define, returning the matching tag string. It's the "character name → full tag set" pattern made explicit - type superman, get movie, superhero, dc, comic, blue, red - and it's a neat way to keep your prompts consistent without pasting the same ten tags everywhere. The pack ships it preloaded with a Superman/Batman/Wonder Woman example, which is a charmingly literal take on the node's name.

    How it works. The presets field is a multiline table in a TOML/INI-ish format:

    [Superman]
    movie, superhero, dc, comic, blue, red
    
    [Batman]
    dark, knight, gotham, rich, black
    

    Each [Section] is a trigger key, and the line under it is the tag set it returns. Matching is case-insensitive and whitespace-tolerant, so superman, Superman, and SUPERMAN all hit the same entry. It also accepts a legacy Key: tags colon format if your presets don't use sections - the node auto-detects which format you're using. If the trigger isn't found, it returns default_value (empty by default) instead of erroring.

    Inputs that matter. Three:

    • trigger_word - required, and marked forceInput, meaning it can be wired from another node (like a Round Robin picker or Random Line From File) rather than typed. That wiring is where this node gets interesting: batch through a list of character names and each gets its correct tag set automatically.
    • presets - required, the table itself. This is the config; most of your effort lives here.
    • default_value - optional, what you get when the trigger doesn't match. Set it to something safe like (no tags) instead of leaving it empty, so a miss is visible in your prompt rather than silent.

    Output is selected_tags (STRING) - wire it into a text concat node in front of your CLIP text encode. The intended composition: static base prompt + Tag Selector output. It's essentially the "dictionary lookup" sibling of the wildcard systems the KB's prompt-engineering doc covers, but file-free and case-insensitive, which makes it very stable for a fixed character set.

    Install. Standard pack install: ComfyUI Manager → search "isekai" → install → restart. Or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/isekai-sh/isekai-comfy-node
    cd isekai-comfy-node
    pip install -r requirements.txt
    

    Restart; it's under Isekai → Dataset. No models, no deps beyond what ComfyUI already has.

    Common issues. The format errors are the main trip-up: if your section headers are malformed (missing brackets, extra spaces before the [), the node can't detect section format and silently falls back to colon parsing, which turns your whole presets block into one giant no-match. Keep the format clean: [Key] at column zero, tags on the next line. Duplicate trigger keys - later sections overwrite earlier ones, so the last definition wins. And a missing trigger returns default_value, which defaults to empty - an empty string spliced into a prompt is invisible, so set a visible default_value and you'll catch misspellings in your trigger wiring instantly. It's a small, barely-known pack, so the usual caveat applies: your testing is the documentation beyond the README.

    CategoryIsekai/Dataset

    Inputs (3)

    NameTypeDefaultDescription
    trigger_wordSTRING
    presetsSTRING[Superman] movie, superhero, dc, comic, blue, red [Batman] dark, knight, gotham, rich, black [Wonder Woman] amazon, warrior, princess, tiara
    default_valueoptSTRING

    Outputs (1)

    NameTypeDescription
    selected_tagsSTRING