Nodes/ComfyUI-Brekel/Brekel Auto Prompt Generator
ComfyUI Node

Brekel Auto Prompt Generator

Randomized prompts without wildcard syntax

By Brekel·Created about a year ago·Updated 8 days ago· 19
Brekel Auto Prompt Generator
    • STRING
    prefix
    random_line_file1subjects.txt
    random_line_file2locations.txt
    random_line_file3styles.txt
    random_line_file4details.txt
    random_line_file5
    seed0
    modeRandom Prompt
    static_prompt
    postfix
    delimiter,
    clean_whitespacetrue

    Want to batch out fifty images that share a subject but vary the location, style, and lighting? That's what this node is for. It stitches a prompt together from random lines pulled out of your own text files - one file of subjects, one of locations, one of styles - so every run comes out a little different. It's the old wildcard-trick idea from the A1111 days, packaged as a ComfyUI node that needs no {this|that} syntax and no extra extension.

    The pack ships with example files (subjects.txt, locations.txt, styles.txt, details.txt) in ComfyUI/custom_nodes/ComfyUI-Brekel/auto_prompt_generator/, each with one candidate per line. Replace them with your own vocabulary and the node instantly becomes your personal prompt roulette wheel.

    How it works

    The node reads every .txt file in that subfolder and turns them into the dropdown options for five slots, random_line_file1 through random_line_file5. For each slot, pick a file (or "None" to skip it), and the node seeds Python's random generator with your seed, picks one line, and joins the results with the delimiter - ", " by default, "\n" if you type the literal characters \n and want a line break. Your prefix lands at the front, your postfix at the end, and clean_whitespace trims the whole thing.

    The mode toggle is the escape hatch: Random Prompt does all of the above, Static Prompt bypasses the files entirely and outputs whatever you typed into static_prompt. That's handy when you're A/B testing a fixed prompt against the random machine.

    The inputs that matter

    • random_line_file1–5 - the files to draw from. Setting them to "None" skips the slot entirely, so you can run a two-slot combo or a five-slot monster.
    • seed - controls which lines get picked. A fixed seed reproduces the same combination, which is how you keep a variant you liked. Zero with control_after_generate means fresh lines every queue pass.
    • prefix / postfix - your LoRA trigger words and fixed framing go here so they survive the random shuffle.
    • delimiter - how the pieces get glued together. Comma-space for tag-style prompts, \n if you're building the block-structured prompts some LLM-encoded models like.

    Output

    A single STRING with the assembled prompt. Feed it to your positive prompt input and iterate - the beauty of this node is that the randomness lives in the graph, so you can run a batch and keep the seed of anything that worked.

    Installing it

    Same pack as the rest of Brekel's nodes - ComfyUI Manager, search "Brekel", install, restart. Manually:

    cd ComfyUI/custom_nodes/
    git clone https://github.com/Brekel/ComfyUI-Brekel.git
    

    No Python dependencies for this node; the requirements.txt (bitsandbytes, accelerate) is only for the LLM Prompt Enhancer. You're in the Brekel menu category.

    Where people get burned

    Two things. First, the file list is read when the node loads, so when you add a new .txt you have to refresh the node (right-click → Refresh Node Definitions, or just reload ComfyUI) before it shows up in the dropdowns. Second, files are matched by a dropdown of names - there's no arbitrary file-path field here, so if your files aren't in the pack's auto_prompt_generator subfolder, the node won't see them at all. Drop them in that exact folder, one item per line, no blank lines unless you want blank candidates. Skip the file-slot idea that reads from elsewhere - it doesn't exist.

    One more: if your prompts come out looking repetitive, it's because the example files are short. Curate your own lists - a hundred subjects, fifty locations, thirty lighting moods - and this becomes the cheapest variety generator you own.

    CategoryBrekel

    Inputs (12)

    NameTypeDefaultDescription
    prefixSTRINGPrefix to prepend at the start of the prompt, for example to add your Lora trigger word(s).
    random_line_file1COMBOsubjects.txtFile to pick a random line from. File must be in the 'ComfyUI/custom_nodes/ComfyUI-Brekel/auto_prompt_generator' subfolder. If 'None' is selected, no line will be picked from this file.
    random_line_file2COMBOlocations.txtFile to pick a random line from. File must be in the 'ComfyUI/custom_nodes/ComfyUI-Brekel/auto_prompt_generator' subfolder. If 'None' is selected, no line will be picked from this file.
    random_line_file3COMBOstyles.txtFile to pick a random line from. File must be in the 'ComfyUI/custom_nodes/ComfyUI-Brekel/auto_prompt_generator' subfolder. If 'None' is selected, no line will be picked from this file.
    random_line_file4COMBOdetails.txtFile to pick a random line from. File must be in the 'ComfyUI/custom_nodes/ComfyUI-Brekel/auto_prompt_generator' subfolder. If 'None' is selected, no line will be picked from this file.
    random_line_file5COMBOFile to pick a random line from. File must be in the 'ComfyUI/custom_nodes/ComfyUI-Brekel/auto_prompt_generator' subfolder. If 'None' is selected, no line will be picked from this file.
    seedINT00–1152921504606847000
    modeCOMBORandom PromptGenerate a random prompt or use the static
    static_promptSTRINGStatic prompt to use when 'use_static_prompt' is set to 'true'. If empty, no static prompt will be used.
    postfixSTRINGPostfix to append at the end of the prompt, for example to add your Lora trigger word(s).
    delimiterSTRING, Delimiter to use between items. Use '\n' for a newline character.
    clean_whitespaceCOMBOtrueRemove leading and trailing whitespace from the final prompt

    Outputs (1)

    NameTypeDescription
    STRINGSTRING