FunUI Enhance Prompt
An Enhancer That Hands Your Prompt Back Unchanged When It Fails
- clip
- image
- enhanced
- status
The pitch for a prompt enhancer is always the same: type six words, get a cinema-ready paragraph. The reality, as anyone who's chained a local model into a graph knows, is two failure modes - the model writes chat boilerplate into your conditioning, or it invents narrative you didn't ask for. FunUI Enhance Prompt is built around a third, rarer virtue: if it fails, your original prompt walks out the other side and the status string tells you why.
That sounds small. It's the reason you can leave it switched on in a batch run.
What it actually does
It runs a language model that's already in your graph. The clip input isn't a CLIP encoder in the SD sense - it's a text encoder that can generate, the Gemma/Qwen chat encoders H3 and friends ship. The node drives ComfyUI's own generate/decode pair on it, so nothing extra is loaded if you're already using that encoder for the model itself. If the connected encoder can't generate text, the status says exactly that and the prompt passes through.
You get real decoding control, not a magic button: temperature, top_p, top_k, min_p, repetition and presence penalties, a token budget (max_length, default 400), greedy for always-likeliest output, and thinking for reasoning models - with the honest warning in the tooltip that reasoning eats the budget.
Then the bits that go beyond a rewrite: a seed where 0 means a fresh rewrite every run and any other number repeats the same one, an instructions field to replace the built-in system prompt, and a chat field for your comments on earlier rewrites. There are also shortcuts and lorebooks (paths to JSON) that hand the model named reference entries before it writes, plus image + use_image to show it a picture - the VLM route: caption what's actually there and let it write from that.
Inputs and outputs
Minimum viable setup:
- clip - a generative text encoder. On H3 this is not H3's own encoder; the pack's own docs say pick a chat encoder like Gemma because H3's can't write prose.
- text - the prompt.
- enabled - default false. Off means no model run at all, prompt through untouched.
Then, if you want to tune it: max_length, greedy, the sampling dials, seed, thinking, instructions, encoder_file + encoder_family (use a separate encoder just for rewriting; the node caches it so a second Generate doesn't reload nine gigabytes), image/use_image, shortcuts/lorebooks/reference_intro, chat.
Two outputs:
- enhanced - the string to encode. Identical to your input on any failure.
- status -
off,skipped: the prompt is empty,unavailable: the connected CLIP does not expose text generation, a character count on success, or the failure reason. This is the node's best feature; ignore it and you'll blame the model.
Installing it
cd ComfyUI/custom_nodes
git clone https://github.com/digital-garbage/FunUI
cd FunUI && pip install -r requirements.txt
ComfyUI Manager: search FunUI. Restart after installing, and check Settings ▸ About FunUI for the version. No separate LLM server, no API key, no Ollama - it borrows the encoder you already have. (Pack page says olivv-cs/ComfyUI-FunPack; repo is digital-garbage/FunUI. Rename, not a fork.)
The requirements file wants comfy-kitchen>=0.2.32 and gguf and pointedly does not upgrade torch. If pip starts offering to change torch, numpy or transformers, stop and think - the pack's docs say the same thing.
Where people get burned
Drift. An enhancer earns its name by adding detail and will happily add detail you never asked for; the community answer is narrower instructions and chained, tightly-scoped steps rather than one open-ended rewrite. Set instructions and be specific about what must not change.
Markup, eaten. If the prompt has (word:1.5) or [a@2-4], the model reads it as punctuation. The node logs a warning about exactly this. Enhance first, mark up after.
Encoder mismatch. H3's own encoder can't write prose. Wire Gemma or Qwen, or use encoder_file to point at one, and keep encoder_family at its default unless your file belongs to another family.
Treating a rewrite as deterministic. With seed at 0 it isn't. If you're comparing two prompts, fix the seed or you're comparing noise.
Expecting it to write better than you can. A local 8B–30B model removing the blank-page problem is a real win. It is not a writer, and the honest ceiling for local models on this job is modest. Use it to restructure what you meant, not to invent what you didn't.
Inputs (22)
| Name | Type | Default | Description |
|---|---|---|---|
| clip | CLIP | A text encoder that can generate text (Gemma, Qwen...). | |
| text | STRING | — | |
| enabled | BOOLEAN | false | Off: the prompt passes through and the model is not run. |
| instructionsopt | STRING | What the model is told to do. Empty uses the built-in instructions. | |
| max_lengthopt | INT | 40032–4096 | The longest rewrite, in tokens. |
| greedyopt | BOOLEAN | false | Always the likeliest word. Hides the sampling dials below. |
| temperatureopt | FLOAT | 0.700–2 | — |
| top_popt | FLOAT | 0.920–1 | — |
| top_kopt | INT | 501–1000 | top_p and min_p only apply while top_k is above 0. |
| min_popt | FLOAT | 0.050–1 | — |
| repetition_penaltyopt | FLOAT | 1.301–2 | — |
| presence_penaltyopt | FLOAT | 0.000–2 | — |
| seedopt | INT | 00–18446744073709550000 | 0 = a fresh rewrite every run. Any other number repeats the same rewrite. |
| thinkingopt | BOOLEAN | false | Let a thinking model reason first. Its reasoning eats the token budget. |
| encoder_fileopt | STRING | A text encoder file just for rewriting (Gemma, Qwen...). Empty uses the model's own encoder. | |
| encoder_familyopt | STRING | stable_diffusion | Which family that file is for. Only used with an encoder file. |
| imageopt | IMAGE | Shown to the model alongside the prompt. | |
| use_imageopt | BOOLEAN | true | Send the picture (when one is connected) to the model. |
| shortcutsopt | STRING | Shortcut names to hand the model as reference, one per line. | |
| lorebooksopt | STRING | Paths to lorebook or shortcuts JSON files, one per line. | |
| reference_introopt | STRING | The line above the reference entries. Empty uses the built-in one. | |
| chatopt | STRING | Your comments on earlier rewrites (Composer > Chat). |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| enhanced | STRING | — |
| status | STRING | — |