🎨 从分类读取Prompt
Every prompt in a category, joined into one string
- text
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_CHANGED → NaN 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), orname:valuefor both,Name: valuestyle. You'll almost always wantvalue.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|bmatches either,a&bmatches all - but you can't mix the two symbols in one query.mode-选取所有(all), latest N, oldest N, or random N.countsets N, andoffsetskips 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
propertytoname:valueor picked a weirdseparator, that's exactly what you asked for. Checksearchisn't matching more than you meant - remembera|banda&bdon'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.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| category | COMBO | 全部 | 2 options: 全部, 全部 |
| search | STRING | — | |
| property | COMBO | value | 3 options: value, name, name:value |
| mode | COMBO | 选取所有 | 4 options: 选取所有, 取最新N个, 随机取N个, 取最旧N个 |
| count | INT | 101–9999 | — |
| offset | INT | 00–9999 | — |
| separator | STRING | , | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| text | STRING | — |