Nodes/comfyui-flower-tools/🌸Flower Multiline Prompt Selector
ComfyUI Node

🌸Flower Multiline Prompt Selector

Per-file picks, not per-token dice rolls

By weichenglin0215·Created 8 months ago·Updated 2 months ago· 0
🌸Flower Multiline Prompt Selector
    • text
    ◄directory►
    ◄filter_keyword►
    ◄negativeKeyword►
    ◄exclude_ascii_onlyfalse►
    ◄seed0►
    ◄continuous_processing1►
    ◄output_mode組合模式 Combination►
    ◄remove_commentstrue►
    ◄file_configs{}►

    Most wildcard systems work like a roulette wheel per token: each {cat|dog} in your prompt picks independently on every run. Flower Multiline Prompt Selector is a different, more deliberate beast. It treats each text file as a library of prompts - every line (or {...} block) is one complete unit - and you get per-file control over whether units are picked randomly, in order, or by hand. That's the difference between "roll dice inside a sentence" and "curate a folder of options and sequence through them." If you've ever wanted a wildcard system where the file is the concept and the lines are the variants, this is the one.

    How it works

    Point directory at a folder of .txt (or .md) files and the node lists them with per-file buttons in its UI. It ships with a populated wildcards folder - sample files for nationality, age, expression, body type, lighting, composition - so you can see the pattern working before you write your own. Three decisions drive the output:

    Unit parsing. In each file, a non-empty line is one unit, and a block wrapped in { … } (full-width or half-width, trailing comma tolerated, nesting supported) is one unit too - so a three-line "mood" description stays together instead of shattering into fragments. Lines and blocks are the atomic options.

    Per-file mode. Each file independently runs Random (pick a unit), Ordered (step through units using the seed), or Picked (you fixed a unit). That per-file setting lives in the file_configs JSON widget, which the UI maintains for you - don't hand-edit it.

    Output mode. Three flavors:

    • 組合模式 Combination (default): one unit from each enabled file, joined with commas - the "vary nationality, age, and expression independently" mode.
    • 循序模式 Sequential: all files' units merge into one pool and you get one unit per run, stepping through the whole collection in order.
    • 依序輸出整個文字檔 Whole File: emit an entire file's contents as a single output - the mode for "output this whole prompt document."

    The seed and continuous_processing pair work like a batch index: the actual pick is seed // continuous_processing, so bumping continuous_processing to N keeps the same pick for N consecutive images - classic "generate variations of the same prompt" behavior. There's also a Refresh button that previews the output without running the graph, plus filter_keyword / negativeKeyword (supporting | for OR and & for AND) and exclude_ascii_only to prune the list. remove_comments (default on) strips /* … */ notes from the output while the preview keeps them, so you can annotate your wildcard files freely.

    Where it shines

    This is the node the pack's author actually built the pack around - the README's whole framing (wildcard management, per-file buttons, Chinese-natural sorting) starts here. The Combination mode paired with Flower Keyword Replacer is the flagship pipeline: pick a nationality, age, and expression from separate files, then a replacer slots them into a fixed prompt template. You get consistent variety without ever retyping a prompt, and because picks are seed-driven and files sort naturally (numbers and Chinese both order sensibly), results are reproducible - a big step up from token-level dice rolling.

    Install

    cd ComfyUI/custom_nodes
    git clone https://github.com/weichenglin0215/comfyui-flower-tools.git
    

    Then restart, or ComfyUI Manager → search ComfyUI Flower Tools. The pack ships its wildcards folder with sample files; your own go in ComfyUI/custom_nodes/comfyui-flower-tools/wildcards/, or anywhere you point directory at. No models, no heavy deps.

    Gotchas

    • Output is one STRING regardless of mode - you're not getting a list of picks, you're getting the assembled text. For list-shaped needs, the Flower List of Strings node handles that.
    • Seed-based, not literally random per run. Same seed + same settings = same pick. That's a feature for reproducibility; it surprises people who expect true dice.
    • file_configs is JSON and auto-managed - editing it by hand is a fast way to break the UI's mental model. Use the buttons.
    • It's output-node-flavored: text feeds a Text Encode directly, and the node displays its result in the UI, so it works as a prompt viewer too.
    Categoryflower-tools

    Inputs (9)

    NameTypeDefaultDescription
    directorySTRING—
    filter_keywordSTRING—
    negativeKeywordSTRING—
    exclude_ascii_onlyBOOLEANfalse—
    seedINT00–18446744073709550000—
    continuous_processingINT11–9999999—
    output_modeCOMBO組合模式 Combination3 options: 組合模式 Combination, 循序模式 Sequential, 依序輸出整個文字檔 Whole File
    remove_commentsBOOLEANtrue—
    file_configsSTRING{}—

    Outputs (1)

    NameTypeDescription
    textSTRING—