ComfyUI Node

TagFlag

A manual switchboard for which tag sets make it through

By sugarkwork·Created 2 years ago·Updated 6 months ago· 89
TagFlag
    • output_tags1
    • output_tags2
    • output_tags3
    • output_tags4
    • all_tags
    output_tags1
    output_flag1true
    output_tags2
    output_flag2true
    output_tags3
    output_flag3true
    output_tags4
    output_flag4true

    TagFlag is a four-channel switchboard for tag strings. It takes up to four (tag string, flag) pairs, and each flag decides whether its tag string makes it out. Flip a flag off and that channel goes silent - no rewiring, no node bypassing, just a boolean. The outputs are the four channel strings plus an all_tags port that merges whichever channels are currently enabled into one comma-separated string.

    Think of it as the manual version of the pack's automatic filters. TagFilter decides what passes by category; TagFlag decides what passes by your hand - or by whatever boolean you feed into the flag inputs. Since the flags are regular BOOLEAN inputs, they don't have to be typed toggles. You can drive them from a condition node, a randomizer, or a saved workflow parameter, which turns TagFlag into a genuinely dynamic mixer: four tag groups, each individually switchable at runtime.

    The inputs and outputs that matter

    • output_tags1 through output_tags4 - the tag strings. The first pair is required; channels 2–4 are optional.
    • output_flag1 through output_flag4 - the on/off switches. Default all true. A false flag zeroes that channel.
    • Outputs output_tags1..4 - each enabled channel's string, passthrough. Disabled channels emit an empty string.
    • Output all_tags - the union of all enabled channels, deduplicated and re-emitted through the pack's tag parser, so emphasis weights survive.

    The pattern to use this for: keep four distinct tag groups (character, outfit, expression, scene) wired into TagFlag, and let a UI toggle or a conditional decide which combinations are live. all_tags is what you'd feed the text encoder; the per-channel outputs exist for when you need to know which branch won.

    The gotchas

    Disabled channels don't return None - they return an empty string. If you concatenate output_tags2 blindly downstream, you'll get an empty chunk, not an error. That's fine for TagFlag's own all_tags merge (it skips empties), but if you branch off a channel, guard for the empty case.

    Also, all four flags default to true, so out of the box this node is a pass-through mixer that merges everything. The filtering only starts when you flip something off - which trips up people who expected it to default to "nothing enabled." It's a "include" switchboard, not an "exclude" one.

    Install

    Same pack, same steps: ComfyUI Manager search "comfyui_tag_filter", or

    cd ComfyUI/custom_nodes
    git clone https://github.com/sugarkwork/comfyui_tag_fillter
    

    Restart. No dependencies, no model downloads. If you want the image-flavored version of the same idea - flags that pick between images instead of tag strings - that's TagFlagImage, one node over in the same pack.

    Categorytext

    Inputs (8)

    NameTypeDefaultDescription
    output_tags1STRING
    output_flag1BOOLEANtrue
    output_tags2optSTRING
    output_flag2optBOOLEANtrue
    output_tags3optSTRING
    output_flag3optBOOLEANtrue
    output_tags4optSTRING
    output_flag4optBOOLEANtrue

    Outputs (5)

    NameTypeDescription
    output_tags1STRING
    output_tags2STRING
    output_tags3STRING
    output_tags4STRING
    all_tagsSTRING