Nodes/MilitantHitchhiker-SwitchbladePack/Prompt Generator (Dictionary)
ComfyUI Node

Prompt Generator (Dictionary)

Random Prompts From Your Own Dictionary Files

By MilitantHitchhiker·Created 2 years ago·Updated 11 months ago· 3
Prompt Generator (Dictionary)
    • STRING
    dict1_file
    dict2_file
    dict3_file
    dict4_file
    enable_dict1true
    enable_dict2true
    enable_dict3true
    enable_dict4true
    dict1_delimiter;
    dict2_delimiter;
    dict3_delimiter;
    dict4_delimiter;
    output_delimiter,
    seed0

    Random prompt assembly is one of those ideas that looks trivial until you need it. Batch a character sheet across 32 generations, shuffle lighting and camera styles between runs, or just stop typing "masterpiece, best quality" by hand. The Prompt Generator (Dictionary) node (class IntegratedRandomPromptGenerator) does exactly the wildcard thing without any wildcard syntax to learn: you drop .txt dictionary files in a folder, and it picks one random item from each enabled file and joins them into a prompt string.

    How it works

    The node scans ComfyUI/input/Dictionaries - note input, not custom_nodes - recursively at load time and lists every .txt file it finds in the dropdowns. Each file is a bag of prompt fragments separated by a delimiter, ; by default. For every dictionary you enable, it picks one random item and joins the winners with the output delimiter (default , ). The pack ships a sample file with 1,000 prebuilt prompts if you want to see the intended format.

    There's a real seed input, and it's honest about it: random.seed(seed) runs before the picks, so the same seed, dictionaries, and delimiters give the same combination every time. That's the difference between "random generator" and "I can't reproduce anything" - set a seed you like and keep it.

    The inputs that matter

    You get up to four dictionary slots, and the only ones you'll actually touch most days:

    • dict1_file..dict4_file - the dropdowns, populated from input/Dictionaries (subfolders appear as folder/file.txt). Set a slot to none to ignore it.
    • enable_dict1..enable_dict4 - handy when you want to keep a file loaded but switch it off without re-selecting.
    • dict1_delimiter..dict4_delimiter - per-file item separators, ; by default. This is where people get burned (below).
    • output_delimiter - what goes between the selected items; , keeps prompt fragments readable.
    • seed - the reproducibility knob.

    Output is a single STRING - the joined prompt - which you wire straight into a CLIP Text Encode positive input.

    Installing it

    It ships in the Switchblade Pack, so install the pack once and you get this plus the other nodes:

    • ComfyUI Manager → search MilitantHitchhiker-SwitchbladePack (or "Switchblade") → Install → restart. Or clone manually:
    cd ComfyUI/custom_nodes
    git clone https://github.com/MilitantHitchhiker/MilitantHitchhiker-SwitchbladePack
    

    Restart ComfyUI. No models to download, no Python dependencies - this node is pure standard-library.

    Where people get burned

    The delimiter mismatch is the classic failure. If your file is separated by commas but the node splits on ;, you get one giant "item" and the node just picks the whole file. Match the delimiter to what's actually in your file, or reformat the file to use ;.

    The other trap is placement: the dropdown list builds from ComfyUI/input/Dictionaries at node-creation time. Drop in a new .txt file and you won't see it until you refresh the node list or restart - don't go hunting for a typo in your workflow when the file simply isn't registered yet. And remember every enabled dictionary contributes an item, so a file that fails to load silently contributes nothing: your "random" prompt can quietly stop varying.

    One honest caveat for a node called a "prompt generator": it only picks and joins. There's no weighting, no __ wildcard syntax, no conditioning logic. If you want per-item weights and dynamic interpolation, the dedicated wildcard/dynamic-prompt packs do more - but for "give me a different prompt each run from my own files," this is about as simple as it gets.

    CategoryMilitantAI/Switchblade/Text Processing

    Inputs (14)

    NameTypeDefaultDescription
    dict1_fileCOMBO1 options: none
    dict2_fileCOMBO1 options: none
    dict3_fileCOMBO1 options: none
    dict4_fileCOMBO1 options: none
    enable_dict1BOOLEANtrue
    enable_dict2BOOLEANtrue
    enable_dict3BOOLEANtrue
    enable_dict4BOOLEANtrue
    dict1_delimiterSTRING;
    dict2_delimiterSTRING;
    dict3_delimiterSTRING;
    dict4_delimiterSTRING;
    output_delimiterSTRING,
    seedINT00–18446744073709550000

    Outputs (1)

    NameTypeDescription
    STRINGSTRING