Nodes/ComfyUI-Prompt-Gallery/🎨 从分类读取Prompt
ComfyUI Node

🎨 从分类读取Prompt

Every prompt in a category, joined into one string

By Lotus0614·Created 5 months ago·Updated 7 days ago· 28
🎨 从分类读取Prompt
    • text
    category全部
    search
    propertyvalue
    mode选取所有
    count10
    offset0
    separator,

    The boring one in the pack, and genuinely useful for that reason. PromptsSelector is the interactive picker you poke with a mouse; this node is the "grab everything from a category and hand it to me as one string" worker. You point it at a category, it walks that category and all its subcategories, pulls the matching prompts, and joins them into a single text output. Feed that into a CLIP Text Encode and you've got an auto-assembled prompt that stays in sync with your library - add a prompt to the category, and the next run picks it up with zero edits to the graph.

    Where this shines is the systematic end of prompting: a "styles" or "camera" category that you batch into every workflow, or a "characters" category that a whole set of workflows shares. It turns prompt curation into data - maintain the library, not the graph.

    How it works

    Read-only, stateless, deterministic given your library. Internally it resolves the chosen category to its ID, collects all descendant category IDs, filters stored prompts to those, applies your search filter, selects a slice per your mode, formats each record, and joins with your separator. Like PromptsSelector, it forces a rerun every execution (that's the IS_CHANGEDNaN trick), which is what lets library edits show up without a cache bust.

    The inputs that matter

    • category - the enum dropdown, default 全部 (all). Lists every category you've created, and includes subcategories automatically.
    • property - what each entry emits: value (the prompt text), name (the display name), or name:value for both, Name: value style. You'll almost always want value.
    • separator - what goes between entries. Default ", ", which is right for most SDXL-lineage tag prompting.
    • search - case-insensitive substring filter against value, name and alias. a|b matches either, a&b matches all - but you can't mix the two symbols in one query.
    • mode - 选取所有 (all), latest N, oldest N, or random N. count sets N, and offset skips that many in non-random modes (random ignores it).

    The single output is text, a plain STRING. Wire it straight into your positive conditioning.

    Install

    Standard pack install - ComfyUI Manager → search "Prompt Gallery", or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Lotus0614/ComfyUI-Prompt-Gallery
    cd ComfyUI-Prompt-Gallery
    pip install -r requirements.txt
    

    Windows portable: ..\..\python_embeded\python.exe -m pip install -r requirements.txt. Light dependencies (Pillow, optional pyahocorasick), no models to fetch. Restart ComfyUI and hard-refresh the browser afterwards.

    Common issues

    • New categories won't appear in the dropdown - the category list is built when ComfyUI loads its node definitions, so create categories, then reload the page (or restart) before they show up here.
    • Prompt content changes not reflected - the node always reruns, so a workflow refresh should pick up library edits; if it doesn't, it's the browser cache again. Hard refresh.
    • Output looks like soup - the node joins everything literally. If you've set property to name:value or picked a weird separator, that's exactly what you asked for. Check search isn't matching more than you meant - remember a|b and a&b don't mix.

    One honest caveat: this node assembles, it doesn't weigh or randomize - that's PromptsSelector's job. For a fixed, curated batch of prompts per category, this is the leaner tool and it does it in one wire.

    Category🎨 Prompt Gallery

    Inputs (7)

    NameTypeDefaultDescription
    categoryCOMBO全部2 options: 全部, 全部
    searchSTRING
    propertyCOMBOvalue3 options: value, name, name:value
    modeCOMBO选取所有4 options: 选取所有, 取最新N个, 随机取N个, 取最旧N个
    countINT101–9999
    offsetINT00–9999
    separatorSTRING,

    Outputs (1)

    NameTypeDescription
    textSTRING