ComfyUI Node

Text Prompt

A text box that stops jumping your cursor to the end when you type {a|b}

By alchemine·Created about a year ago·Updated a day ago· 2
Text Prompt
    • text
    text
    seed0

    Dynamic prompts - the {a|b|c} syntax where ComfyUI picks one option per run - are great for batch variation and miserable to edit. ComfyUI's built-in text widget has dynamicPrompts switched on, which re-parses the field as you type, and every keystroke inside a {...} block jumps the cursor to the end of the line. Try to fix one option out of five and you'll spend the whole time fighting the box. TextPrompt is the same multiline text widget with that flag turned off, plus wildcard resolution done properly at execution time in Python.

    How it works

    Two small behaviors. The widget is declared with dynamicPrompts: False, so it behaves like a plain text box - type {a|b} and the cursor stays where you put it. Then at execution, a regex loop resolves the groups innermost-first: one random pick per group, nesting supported, all seeded by the seed input. Because expansion happens in the node rather than the widget, it's reproducible - the same text and seed give the same picks every run.

    The inputs and output

    • text - multiline, required. Your prompt, with {option1|option2|...} groups wherever you want variation.
    • seed - this is where beginners get confused: it's input-only. There's no little box on the node; you have to connect a seed source (a primitive or any int node) if you want reproducible picks. Leave it unwired and every run rolls fresh. That's the only real gotcha here.
    • output: text - the resolved prompt, wired straight into a CLIP Text Encode like any prompt string.

    What it doesn't do

    It handles the {a|b} dynamic-prompt syntax only. It won't read __file__-style wildcard files from disk - that's a different feature (the pack's FilterTags and ProcessTags do that with their own wildcards.yaml). If you're coming from the Dynamic Prompts extension, think of this as the minimal local version: no file wildcards, no magic, just seedable {a|b} groups without the cursor fight. If you need real wildcard files, keep the extension around; this node doesn't replace it.

    Where it fits

    Dynamic prompts are a genuinely live ComfyUI feature - a few hundred Reddit threads over the last couple of years, still going - and the cursor behavior is the part people quietly hate. If you're a tag-prompt person doing batch variation, or you just like {...} groups, this is a drop-in replacement for the core text box that removes the friction for free. It's a tiny node from a pack that's mostly about serious Danbooru prompt plumbing; this one is the quiet quality-of-life item.

    Install

    ComfyUI Manager: search for ComfyUI-Alchemine-Pack, install, restart. Or manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/alchemine/comfyui-alchemine-pack
    pip install -r requirements.txt
    

    then restart. The pack's only Python dependency is python-dotenv; no model downloads, no API key, nothing at load time.

    Troubleshooting

    • No seed box on the node → normal, not a bug. seed is a wired input; connect a primitive or int node.
    • Picks change every run → expected when seed is unwired.
    • {a|b} appearing literally in the output → expansion didn't run, which happens when the group syntax doesn't match - mismatched braces, or a nested { inside a group that breaks the regex. Keep the groups simple.
    CategoryAlcheminePack/Prompt

    Inputs (2)

    NameTypeDefaultDescription
    textSTRING
    seedoptINT00–18446744073709550000

    Outputs (1)

    NameTypeDescription
    textSTRING