Nodes/ComfyUI-ZhiHui/🎲 智绘_随机提示词组合
ComfyUI Node

🎲 智绘_随机提示词组合

Roll a structured prompt from ten ingredient lists

By zhuyungen·Created 8 months ago·Updated 4 months ago· 0
🎲 智绘_随机提示词组合
    • 📝 提示词
    • 🔢 字数
    ◄🧰 字符串预处理不改变►
    ◄🔢 提取行数1►
    ◄🎲 随机种子0►
    ◄📝 提示词行1►
    ◄📝 提示词行2►
    ◄📝 提示词行3►
    ◄📝 提示词行4►
    ◄📝 提示词行5►
    ◄📝 提示词行6►
    ◄📝 提示词行7►
    ◄📝 提示词行8►
    ◄📝 提示词行9►
    ◄📝 提示词行10►

    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.

    Category智绘灵箱

    Inputs (13)

    NameTypeDefaultDescription
    🧰 字符串预处理COMBO不改变12 options: 不改变, 取数字, 取字母, 转大写, 转小写, 取中文, +6
    🔢 提取行数INT11–9999—
    🎲 随机种子INT00–2147483647—
    📝 提示词行1optSTRING—
    📝 提示词行2optSTRING—
    📝 提示词行3optSTRING—
    📝 提示词行4optSTRING—
    📝 提示词行5optSTRING—
    📝 提示词行6optSTRING—
    📝 提示词行7optSTRING—
    📝 提示词行8optSTRING—
    📝 提示词行9optSTRING—
    📝 提示词行10optSTRING—

    Outputs (2)

    NameTypeDescription
    📝 提示词STRING—
    🔢 字数INT—