Boyo Prompt Injector
The Node That Hands Your Loop Its Next Prompt
- prompt_config
- prompt
Looping a workflow is easy. Looping a workflow with a different prompt on every pass is where people reach for scripts and end up with a mess. BoyoPromptInjector is the clean answer: it sits inside a loop, takes the current iteration number, and returns the prompt for that pass. If you've used the pack's BoyoPromptLoop to build a prompt list, this is the node that feeds it into your CLIP encoder one at a time.
The mechanism is dead simple: feed it a prompt_config (a PROMPT_LOOP_CONFIG object - the exact output type of BoyoPromptLoop) and an iteration_index, and it returns the prompt at that position in the config's prompt list. Run out of prompts mid-loop? It wraps around with modulo arithmetic, so iteration 7 of a 5-prompt list gives you prompt index 2 rather than an error.
There's one input worth knowing: fallback_prompt (default "a beautiful image"). If the config is missing, malformed, or empty - say you wired a bare string into it instead of a real config - you get the fallback instead of a crash, which keeps a long loop from dying on iteration three because of one bad connection.
Where it fits
The canonical setup is a bastard-loop (the pack's While/For loop nodes) around a sampler:
BoyoPromptLoop → prompt_config ─┐
Boyo For Loop → counter ────┴→ BoyoPromptInjector → prompt → CLIP Text Encode → KSampler
Each pass of the loop reads a different prompt, and when the loop wraps you start the list over. That's your prompt-variation batch run without touching the UI between passes. It also composes with the pack's other loop nodes - the same iteration_index that drives BoyoOverlapSwitch can drive this, so prompt changes and video-overlap changes stay in sync.
Installing it
Part of the Boyonodes pack (DragonDiffusionbyBoyo):
cd ComfyUI/custom_nodes
git clone https://github.com/DragonDiffusionbyBoyo/Boyonodes
Restart ComfyUI or install "Boyonodes" via ComfyUI Manager. No extra dependencies - it's a list lookup.
Gotchas
- It only works with a real
PROMPT_LOOP_CONFIG. A plain text string won't do - that's what triggers the fallback. iteration_indexis expected to start at 0. If your loop counter starts at 1, your prompts shift by one.- There's no validation that your index is meaningful - out-of-range just wraps, which is fine for loops but silently hides a misconfiguration if you meant to stop.
Small, purpose-built, and exactly what a prompt loop needs: in goes the iteration, out comes the sentence your sampler will draw this time.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| prompt_config | PROMPT_LOOP_CONFIG | — | |
| iteration_index | INT | 00–999 | — |
| fallback_promptopt | STRING | a beautiful image | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| prompt | STRING | — |