Nodes/😸 YFG Comical Nodes/🐯 YFG Random Prompt From File
ComfyUI Node

🐯 YFG Random Prompt From File

YFG Random Prompt From File (v1.1.0) Selects a random prompt from a .txt prompt file. File format: positive: your positive prompt negative: your negative prompt (empty is fine) name: optional label (defaults to filename) ---- (any number of hyphens as separator) range_start / range_end auto-fill when a file is selected. Toggle last_n_only to restrict picks to the newest entries. INDEX auto-syncs after every run β€” switch to by_index with no typing.

By gonzaluΒ·Created 2 years agoΒ·Updated 10 days agoΒ· 29
🐯 YFG Random Prompt From File
    • positive
    • negative
    • name
    • index_current
    • index_previous
    • total_count
    • file_path
    • file_name
    β—„prompt_fileβ€”β–Ί
    β—„selection_moderandomβ–Ί
    β—„index0β–Ί
    β—„range_start0β–Ί
    β—„range_end0β–Ί
    β—„last_n_onlyfalseβ–Ί
    β—„last_n_count100β–Ί
    β—„random_sourceautoβ–Ί
    β—„ensure_uniquetrueβ–Ί
    β—„history_size100β–Ί
    β—„time_window_sec0β–Ί
    β—„retry_limit20β–Ί
    β—„use_shuffle_bagtrueβ–Ί
    Category🐯 YFG/πŸ“ Prompts

    Inputs (13)

    NameTypeDefaultDescription
    prompt_fileSTRINGFull path to a .txt prompt file.
    selection_modeCOMBOrandomrandom picks from range_start..range_end. by_index uses INDEX directly.
    indexINT00–18446744073709550000Used by by_index mode. Auto-syncs after every run.
    range_startINT00–18446744073709550000First prompt index to include in random pool (auto-fills to 0 when file selected).
    range_endINT00–18446744073709550000Last prompt index to include in random pool (auto-fills to total-1 when file selected). 0 = last prompt.
    last_n_onlyBOOLEANfalseWhen ON, restricts the random pool to the last N entries only (newest prompts).
    last_n_countINT1001–18446744073709550000How many entries from the end of the file to pick from (only active when last_n_only is ON).
    random_sourceCOMBOautoauto uses random.org if API key exists; else local PRNG.
    ensure_uniqueBOOLEANtrueAvoid repeating prompts within history_size / time_window_sec.
    history_sizeINT1001–100000How many recent indices to track for uniqueness.
    time_window_secINT00–86400If >0, forget uniqueness entries older than this many seconds.
    retry_limitINT201–1000β€”
    use_shuffle_bagBOOLEANtrueCycle through all prompts before repeating, then reshuffle.

    Outputs (8)

    NameTypeDescription
    positiveSTRINGPositive prompt text.
    negativeSTRINGNegative prompt text (empty if not in file).
    nameSTRINGPrompt name β€” from 'name:' field or filename if omitted.
    index_currentINT0-based index of the selected prompt. Auto-syncs to INDEX widget.
    index_previousINTIndex of the previously selected prompt this session.
    total_countINTTotal number of valid prompts found in the file.
    file_pathSTRINGFull path to the selected prompt file.
    file_nameSTRINGFilename only (no path) of the selected prompt file.