Nodes/ComfyUI-TagLibrary/🏷 标签库 Tag Library
ComfyUI Node

🏷 标签库 Tag Library

Stop typing prompts, start rolling them

By WSYXIUBA·Created 2 days ago·Updated about 11 hours ago· 0
🏷 标签库 Tag Library
    • positive
    • tags_preview
    selection_state{}
    mode
    seed0
    prefix
    suffix

    If you run Illustrious, NoobAI, Pony, or any other Danbooru-trained model, you know the drill: hand-typing 1girl, long hair, red dress, standing, masterpiece, best quality into a CLIPTextEncode box, over and over. Tag Library is a full tag library manager that lives inside your graph and outputs plain STRING - click tags, roll combos, and the node hands you a finished prompt ready to feed the encoder. It's bilingual (English + 中文), ships from a Chinese author, and has zero pip dependencies. At 1–4ms per run it's effectively free.

    Don't confuse it with a plain randomizer like Dynamic Prompts. The tag library is the point: it ships with a curated, folder-structured library of Danbooru-style tags you can grow, and the randomness is layered on top of it.

    How it works

    The node has two modes, and they're the whole personality of it:

    • manual - you click tag chips on the panel, drag to reorder, and the 🎲 button fills per-subcategory counts for you.
    • auto - every Queue rolls a fresh combination from the library by your rules, then echoes the result back into the panel so you can see (and tweak) what it picked.

    Behind the scenes there's a proper random engine. Pinned 📌 tags are always included. The anti-conflict system - rules defined as mutual exclusion between tags, subcategories, or categories - means when a roll picks "nude", the "clothes" side steps aside automatically. There's an NSFW tier toggle that gates explicit tags out of the output entirely, a gender filter, order-preserving dedupe, and seed determinism: same seed, same string, every time.

    The storage is the sleeper feature. The library isn't a blob of JSON - data/taglib/ is a real folder tree where each top-level category is a folder and each subcategory is a .md file. Edit a file in an editor, save it, refresh the manager page and it's live; rearrange things in the UI and folders rewrite themselves. The standalone manager page (http://127.0.0.1:8188/taglib) does full CRUD with right-click rename, reorder, and batch paste import.

    The inputs that matter

    • mode - manual or auto. This is the one you actually think about.
    • seed - deterministic; the 🎲 ROLL button on the panel swaps it.
    • selection_state - auto-maintained JSON that stores your panel state. Treat it as read-only; it's how your tag picks survive a reload.
    • prefix / suffix (optional inputs) - wire upstream text in. Perfect for parking quality words (score_9, score_8_up) or LoRA trigger phrases in front without touching the tag list.

    Outputs: positive goes to your CLIPTextEncode's text (right-click text → Convert to Input, then connect), and tags_preview feeds a Preview Text node so you can see the actual assembled string before you burn a generation.

    Installing it

    ComfyUI Manager → Custom Nodes Manager → search "Tag Library" (or taglibrary) → Install. If it doesn't appear, refresh Manager's node database cache first. Or the direct route:

    cd ComfyUI/custom_nodes
    git clone https://github.com/WSYXIUBA/ComfyUI-TagLibrary
    

    Then restart ComfyUI. No pip packages, no model downloads, nothing else to fetch.

    Where people get burned

    • Auto mode plus a fixed seed means nothing re-rolls. The node has no IS_CHANGED override, so if seed, mode, and state are all unchanged, ComfyUI's cache happily reuses the last output. In auto mode, set the seed's control_after_generate to randomize - otherwise you'll queue five times and get the same five tags.
    • (tag:1.2) weight syntax is CLIP-only. It's a nice optional toggle, but on Flux or LLM-encoded models those parentheses pass through as literal text and the encoder reads them as punctuation. Fine on Illustrious/SDXL lineage; noise elsewhere.
    • The NSFW toggle gates output, not just display. If your explicit tags silently vanish from the string, that switch is off.
    • The library resets to factory defaults if you clear it. By design - but export a full template first if you've spent a week building your library.

    It's niche, new, and hasn't got much community chatter yet, but for anime/SDXL prompters who want a bilingual, folder-synced tag library with a sane random engine, this is a genuinely nice one to reach for.

    Category纸心/prompt

    Inputs (5)

    NameTypeDefaultDescription
    selection_stateSTRING{}节点面板状态 (自动维护, 勿手改)
    modeCOMBOmanual=手动选签+填充 / auto=自动按排除类目随机组合
    seedINT00–18446744073709550000随机种子, 同 seed 同结果; 面板 🎲ROLL 换随机数
    prefixoptSTRING⬅️ 可选: 上游文本会拼在标签前面 (如质量词/LoRA触发词)
    suffixoptSTRING⬅️ 可选: 上游文本拼在标签后面

    Outputs (2)

    NameTypeDescription
    positiveSTRING
    tags_previewSTRING