Nodes/ComfyUI-Multi-Lora/Prompt Segments
ComfyUI Node

Prompt Segments

Booru autocomplete and a shortcut past the CLIP Text Encoder

By Danchi93·Created 2 months ago·Updated 6 days ago· 9
Prompt Segments
  • clip
  • prompts_out
  • conditioning
segments[]
insert_pos1
prompts_in

If you've stared at a single giant textarea full of comma-separated tags and lost the ability to tell which block does what, Prompt Segments is the answer. It's a prompt organizer: you split your prompt into labeled segments - quality tags, character, pose, background - and the node stitches them back together in order when the graph runs. Each segment gets its own enable/disable toggle, so turning "outfit" off for a reroll is a click instead of an edit.

It ships in the same Danchi93/ComfyUI-Multi-Lora pack as the Multi LoRA Loader, and the two are designed to play together: the LoRA loader's triggers output feeds this node's prompts_in input, which is how trigger words get injected without you retyping them.

How it works

Under the hood the whole thing is a hidden JSON string in a widget called segments - a list of {"enabled": true, "label": "...", "text": "..."} entries. The pretty multi-row editor you actually see is a DOM widget that serializes into that JSON, which is why your segments survive saving and reloading the workflow. The node then joins the enabled segments with ", " in order and hands you the result as a string.

Two inputs are worth knowing about:

  • insert_pos - where the incoming prompts_in text lands (1 means front, which is the default). Since earlier tokens get stronger attention on the SDXL-lineage models, shoving your most important tags to the front is genuinely useful.
  • clip - optional. If you wire a CLIP model in here, the node tokenizes the merged prompt and hands you a ready-made conditioning output, skipping a separate CLIP Text Encode node entirely. No clip connected? You still get prompts_out as a plain string to feed any text input.

The standout feature is the tag autocomplete: a bundled 10,000-tag Danbooru dictionary. Type two characters and suggestions pop up; click one, or use arrows + Tab to keyboard-navigate. When a suggestion inserts, underscores are replaced with spaces - which matches how these models actually want to be prompted, since long_hair in a prompt is worse than long hair.

Where it's great - and where it isn't

This node lives in the booru-tag world: Illustrious, NoobAI, Pony, that whole SDXL anime ecosystem where comma-separated tags and masterpiece, best quality still carry real weight. For those models it's a genuinely nice quality-of-life upgrade. For natural-language models - Flux, Z-Image, the LLM-encoded crowd - a tag list isn't the input those encoders want, so the autocomplete loses most of its value and the conditioning shortcut only works when the checkpoint's encoder is actually CLIP. Know which model family you're prompting before you bother.

Troubleshooting

The two most likely ways this node misbehaves are both frontend issues. If autocomplete never shows suggestions, the tag dictionary (js/tags/tag_dictionary.json) failed to load - the code logs a warning to the browser console, so check there. If the whole pretty UI is missing and you're staring at a raw JSON string in a textbox, the pack's js/ folder isn't being served - reinstall the pack cleanly so its WEB_DIRECTORY registers. The node still works in that broken state (it parses that JSON), it's just miserable to use.

Installing

ComfyUI Manager, search ComfyUI-Multi-Lora, install, restart. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/Danchi93/ComfyUI-Multi-Lora

Restart ComfyUI afterward. No requirements.txt, no model downloads - the 10k tag dictionary ships in the repo, so it works offline. One trap: the README's clone URL references the project's old name, ComfyUI-Workflow-Tools; the live repo is ComfyUI-Multi-Lora. And if you want the UI in Chinese, flip the LANG constant at the top of the pack's .js files from "en" to "zh".

Categoryconditioning

Inputs (4)

NameTypeDefaultDescription
segmentsSTRING[]
insert_posINT1
prompts_inoptSTRING
clipoptCLIP

Outputs (2)

NameTypeDescription
prompts_outSTRING
conditioningCONDITIONING