ComfyUI Node

Random Prompt Cyan

Wildcards that re-roll a new prompt on every single run

By CyanAutumn·Created 2 years ago·Updated 12 months ago· 4
Random Prompt Cyan
    • STRING
    input_prompt_1
    input_prompt_2
    folder_pathWildcard按文件抽取路径
    file_pathWildcard按行抽取路径

    If you've ever sat there hand-editing a prompt, hitting Queue, and crossing your fingers that the composition comes out different this time - this node is for you. Random Prompt Cyan is a wildcard node from the small, Chinese-language pack ComfyUi Random Manage Cyan, built around the author's nai3 (NovelAI) auto-run habit: batch a hundred images, let each run draw a random prompt from a pile of text files, and curate what survives. It's niche, it's rough around the edges, and it does exactly one thing well: turn <>-style wildcard tags into fresh random text every single run.

    The name and the metadata undersell it. Despite being categorized under "conditioning" with a description that claims it encodes a prompt with a CLIP model, this node does no encoding at all. It's a pure string transformer. It takes your prompt, substitutes wildcards, and hands you back a STRING - you still need a CLIP Text Encode node downstream to actually turn it into conditioning. The tooltip boilerplate is copy-pasted from a text encoder, so trust the code, not the label.

    How it works

    You get two prompt boxes, input_prompt_1 and input_prompt_2, which get merged with a comma between them (the second is skipped if empty). Into that text you drop wildcard tags, and there are two flavors:

    • <随机提示词> - "random prompt" in Chinese. The node picks a random .txt file from whatever folder you put in folder_path and uses that file's entire contents as the replacement. Use this for full multi-tag prompt blocks you want to swap in wholesale.
    • <文件名> - a tag like <动作> ("action") reads 动作.txt from the folder in file_path and swaps in a random single line. One line per wildcard option, and you can chain as many tags as you like.

    The mechanism is dead simple: the prompt is split on commas, each tag is matched against a regex for <...>, and whichever wildcard class matches does a random.choice. The detail that matters for batch work is IS_CHANGED returning True - that's the node telling ComfyUI to re-execute unconditionally, so every queue run re-rolls the picks. No stale cached output, no "why did it repeat three times". If you're batching for variety, that's the whole point.

    The inputs that matter

    • input_prompt_1 / input_prompt_2 - your base prompt plus the randomized part, both multiline. The dynamicPrompts flag is set on them too, so {a|b|c} bracket syntax works inside if your setup supports it.
    • folder_path - the 按文件抽取 (by-file) folder for <随机提示词> tags. Default value is the Chinese label "Wildcard按文件抽取路径" - you must point it at a real directory.
    • file_path - the 按行抽取 (by-line) folder for <文件名> tags.

    The single output, STRING, wires straight into a CLIP Text Encode positive input (or any string consumer). The pack ships no wildcard text files - the wildcard/ folder contains only code - so you create your own .txt files and drop them in.

    Installing it

    cd ComfyUI/custom_nodes
    git clone https://github.com/CyanAutumn/ComfyUi_Random_Manage_Cyan
    

    then restart ComfyUI. Or just search "ComfyUi Random Manage Cyan" in ComfyUI Manager. There is no requirements.txt, no models to download, no heavy dependencies - it's pure Python stdlib (re, os, random), which is refreshing. The catch is the flip side of being a fresh pack: it imports the newer comfy.comfy_types API, so the README warns that older ComfyUI builds won't find the node. If it doesn't appear after restart, update ComfyUI first.

    Where people get burned

    • The by-line (<文件名>) feature is Windows-only in practice. wildcard_file.py builds its path with a literal backslash separator (f"{path}\{name}.txt"). On Linux or macOS that's a filename that doesn't exist, and you'll get a FileNotFoundError on any run that draws that tag. The by-folder <随机提示词> feature uses os.path.join, so it's cross-platform - use that on non-Windows, or hand-edit the path join.
    • Output is STRING, not CONDITIONING. Forget the category and the tooltip; if you plug this directly into a sampler you'll get a type error.
    • It splits on commas. A wildcard tag nested inside a larger phrase without comma separation won't be matched. Keep tags as their own comma-separated tokens.

    It's a utilitarian node from a single author, not a polished ecosystem player - but for "batch 50, get 50 different prompts, no plugins" it's genuinely one of the simplest tools for the job.

    Categoryconditioning

    Inputs (4)

    NameTypeDefaultDescription
    input_prompt_1STRINGThe text to be encoded.
    input_prompt_2STRINGThe text to be encoded.
    folder_pathSTRINGWildcard按文件抽取路径wildcard folder
    file_pathSTRINGWildcard按行抽取路径wildcard file

    Outputs (1)

    NameTypeDescription
    STRINGSTRINGA conditioning containing the embedded text used to guide the diffusion model.