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.
π― 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)
| Name | Type | Default | Description |
|---|---|---|---|
| prompt_file | STRING | Full path to a .txt prompt file. | |
| selection_mode | COMBO | random | random picks from range_start..range_end. by_index uses INDEX directly. |
| index | INT | 00β18446744073709550000 | Used by by_index mode. Auto-syncs after every run. |
| range_start | INT | 00β18446744073709550000 | First prompt index to include in random pool (auto-fills to 0 when file selected). |
| range_end | INT | 00β18446744073709550000 | Last prompt index to include in random pool (auto-fills to total-1 when file selected). 0 = last prompt. |
| last_n_only | BOOLEAN | false | When ON, restricts the random pool to the last N entries only (newest prompts). |
| last_n_count | INT | 1001β18446744073709550000 | How many entries from the end of the file to pick from (only active when last_n_only is ON). |
| random_source | COMBO | auto | auto uses random.org if API key exists; else local PRNG. |
| ensure_unique | BOOLEAN | true | Avoid repeating prompts within history_size / time_window_sec. |
| history_size | INT | 1001β100000 | How many recent indices to track for uniqueness. |
| time_window_sec | INT | 00β86400 | If >0, forget uniqueness entries older than this many seconds. |
| retry_limit | INT | 201β1000 | β |
| use_shuffle_bag | BOOLEAN | true | Cycle through all prompts before repeating, then reshuffle. |
Outputs (8)
| Name | Type | Description |
|---|---|---|
| positive | STRING | Positive prompt text. |
| negative | STRING | Negative prompt text (empty if not in file). |
| name | STRING | Prompt name β from 'name:' field or filename if omitted. |
| index_current | INT | 0-based index of the selected prompt. Auto-syncs to INDEX widget. |
| index_previous | INT | Index of the previously selected prompt this session. |
| total_count | INT | Total number of valid prompts found in the file. |
| file_path | STRING | Full path to the selected prompt file. |
| file_name | STRING | Filename only (no path) of the selected prompt file. |