Nodes/ComfyUI-Brekel/Brekel Prompt Line Chooser
ComfyUI Node

Brekel Prompt Line Chooser

Queue a whole list of prompts and walk them one by one

By Brekel·Created about a year ago·Updated a day ago· 19
Brekel Prompt Line Chooser
    • prompt
    file_path/tmp/ComfyUI/custom_nodes/ComfyUI-Brekel/prompt_line_chooser/prompts.txt
    line_index0
    skip_blank_linestrue
    skip_comment_linestrue

    You've got a base workflow that finally works - checkpoint, sampler, LoRA all dialed in - and what you actually want now is to see forty prompts against it without editing the text box forty times. That's this node's whole job. It reads a plain .txt file where each line is one prompt, hands back the line you asked for as a STRING, and you feed that into your CLIP Text Encode. Instant prompt-testing rig.

    How it works

    The trick is that line_index is a plain number widget, and ComfyUI gives number widgets that little fixed / increment / decrement / randomize control underneath. Set it to increment, queue 40 runs, and each run pulls the next line of your file. Set it to randomize and each run grabs a random line. The index wraps around (modulo) when it overshoots the line count, so you can also just leave it large and cycle forever.

    That's the real reason to reach for this over the wildcard {a|b|c} bracket trick people use for prompt variety: when your alternatives are long sentences instead of single words, a file is a much nicer home for them. You can edit the list in any text editor, keep notes with # comments, and reuse the same file across several workflows. Same goal, less fiddling inside one cramped text widget.

    Two details show the author thought about how you actually run batches. First, the node checks the file's modification time every execution, so saving your prompts.txt re-runs the node even when no widget value changed - no "did it cache?" head-scratching. Second, after a run it prints a readout at the bottom of the node (Line 3/5: a robot tending a greenhouse...) so you always know which prompt just fired. Small thing, huge quality of life when you're queueing thirty generations.

    Inputs and output

    Only four inputs, and you'll touch two of them:

    • file_path - path to your one-prompt-per-line file. It defaults to the example prompts.txt that ships inside the pack folder (five prompts, including a dog riding a skateboard - charming), and it's computed relative to the install, so the default just works wherever you cloned it. Leave blank to fall back to that example.
    • line_index - which line to output, with the increment/randomize control. The other two, skip_blank_lines and skip_comment_lines, both default to true so empty lines and lines starting with # never eat an index. That's your built-in commenting system.

    Output is one prompt STRING. Wire it into the text slot of a CLIP Text Encode - positive or negative - or any other text input. If you want the actual prompt recorded in the PNG, the same pack's Brekel Save Image node takes an optional caption input that'll happily embed it.

    Installing

    ComfyUI Manager → search Brekel → install ComfyUI-Brekel, restart. Or:

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

    Then restart ComfyUI. This node needs nothing beyond base ComfyUI - no models, no keys. The only real dependencies in the pack (requirements.txt: bitsandbytes, accelerate) exist for the Prompt Enhancer LLM node, so skip the pip install unless you plan to use that one.

    Gotchas

    The worst failure mode is a quiet one: point it at a wrong path or an all-commented file and it doesn't crash - it outputs a string like ERROR: Prompt file not found at '...', which then flows straight into your prompt box and silently poisons the generation. Watch the console log. The file also needs to be UTF-8.

    One honest limitation: randomize is the stock ComfyUI control, not a seeded RNG, so it isn't reproducible. For a controlled A/B sweep where you know which line made which image, fixed + increment is the move - pair it with a locked seed. This is one of those tiny nodes that feels unremarkable until you need it, and then it's the thing saving you from an evening of copy-paste.

    CategoryBrekel

    Inputs (4)

    NameTypeDefaultDescription
    file_pathSTRING/tmp/ComfyUI/custom_nodes/ComfyUI-Brekel/prompt_line_chooser/prompts.txtPath to a .txt file containing one prompt per line.
    line_indexINT00–1152921504606847000Which line to output, wraps around when it is larger than the number of lines.
    skip_blank_linesBOOLEANtrueIgnore empty lines so they do not take up an index.
    skip_comment_linesBOOLEANtrueIgnore lines starting with '#' so the file can hold comments.

    Outputs (1)

    NameTypeDescription
    promptSTRING