🎲 智绘_随机提示词组合
Roll a structured prompt from ten ingredient lists
- 📝 提示词
- 🔢 字数
Random prompt nodes are a dime a dozen, and most of them are just "pick a line, feed the CLIP encoder." ZH_RandomPromptCombine ("🎲 智绘_随机提示词组合") is the structured version: you give it up to ten separate prompt boxes, each holding a category of options - subjects in one, lighting in another, styles in a third - and it rolls one line from each and joins them into a coherent prompt. Same idea as the classic "random prompt from a menu" trick, but with grammar instead of a flat list.
It comes from ComfyUI-ZhiHui, which imported it from Dapao-Toolbox. It's niche and Chinese-labeled, but the mechanism is easy to follow in the source.
How it works
Feed each 📝 提示词行1 … 提示词行10 box with several candidate lines (one per line). With multiple boxes connected, each output prompt draws one random line from each box and joins them with ", " - so you get [subject], [lighting], [style] with the structure preserved. With a single box, it instead samples 🔢 提取行数 random lines from that one list.
The 🎲 随机种子 widget controls repeatability in the way you'd hope: 0 means "actually random" (it seeds from OS entropy), any nonzero value makes the same combination reproducible run-to-run. And it declares IS_CHANGED returning NaN, so it re-rolls every run instead of getting stuck on a cached result.
There's also a 12-option 🧰 字符串预处理 dropdown - uppercase, lowercase, strip punctuation, keep only digits/letters/CJK, remove blank lines, and so on. Most of it you'll never touch; the one genuinely weird option is 统计字数, which replaces the prompt output with a character count string. That's for measuring, not generating - easy to hit by accident and confusing when you do.
The inputs and outputs that matter
- 📝 提示词行1 … 10 - the ingredient boxes (all optional, multiline).
- 🔢 提取行数 - how many combined prompts to produce.
- 🎲 随机种子 - 0 for random, fixed for repeatable.
The 📝 提示词 output is a list of strings (OUTPUT_IS_LIST), which means ComfyUI fans it out: every string in the list triggers a separate pass through the downstream graph. That's the feature hiding inside this node - set 提取行数 to 4 and one run becomes four generations, each with a different roll. The 🔢 字数 output gives the character count.
Install
cd ComfyUI/custom_nodes
git clone https://github.com/zhuyungen/ComfyUI-ZhiHui.git
Restart ComfyUI. No models, base deps only. ComfyUI Manager search "ComfyUI-ZhiHui" also works.
Where people get burned
The list output surprises people: if your downstream is a plain text encode expecting one string, a multi-item list will make it run N times whether you planned it or not - keep 提取行数 at 1 until you want the batch behavior. And remember this rolls lines independently per box, so it can pair a subject with a contradictory style from a different box; you're responsible for keeping the categories coherent. Prompt-builder caveat applies here too: this produces SDXL-style tag prompts, which are inert or counterproductive on LLM-encoded 2026 checkpoints - check what your encoder wants before building a fancy menu for it.
Inputs (13)
| Name | Type | Default | Description |
|---|---|---|---|
| 🧰 字符串预处理 | COMBO | 不改变 | 12 options: 不改变, 取数字, 取字母, 转大写, 转小写, 取中文, +6 |
| 🔢 提取行数 | INT | 11–9999 | — |
| 🎲 随机种子 | INT | 00–2147483647 | — |
| 📝 提示词行1opt | STRING | — | |
| 📝 提示词行2opt | STRING | — | |
| 📝 提示词行3opt | STRING | — | |
| 📝 提示词行4opt | STRING | — | |
| 📝 提示词行5opt | STRING | — | |
| 📝 提示词行6opt | STRING | — | |
| 📝 提示词行7opt | STRING | — | |
| 📝 提示词行8opt | STRING | — | |
| 📝 提示词行9opt | STRING | — | |
| 📝 提示词行10opt | STRING | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| 📝 提示词 | STRING | — |
| 🔢 字数 | INT | — |