Nodes/ComfyUI-TemplateReference/Prompt Template LoRA
ComfyUI Node

Prompt Template LoRA

One dropdown that swaps your prompt AND its LoRA

By Tsubasa109·Created 4 months ago·Updated 2 months ago· 0
Prompt Template LoRA
  • model
  • clip
  • selected_prompt
  • prompt
  • lora_model
  • lora_clip
  • template_json
prompt_template_json{"version":1,"items":[]}

Here's the workflow that drives people to this node: you've got fifteen LoRAs, and each one only makes sense with its prompt - the trigger word, the style phrasing, the character description that belongs to it. You spend half your session re-plumbing the Lora Loader and re-typing prompts every time you switch. Prompt Template LoRA (from the same pack as Template Reference) binds each prompt to its LoRA, so one dropdown selection swaps both at once.

It's the Prompt Template node from this pack with LoRA application bolted on. Each block holds a title, prompt text, an optional reference image, and - new bit - a LoRA with a strength. Select a block in the Output dropdown, and the node hands you that block's prompt text and a model/clip with that block's LoRA already applied. Change blocks, and you've effectively changed the whole character or style preset in one click.

How it works

Under the hood it's a plain ComfyUI node with a custom frontend. The frontend edits a JSON state that round-trips through the prompt_template_json input; on execute the node finds the selected block, reads its configured LoRA name and strength, loads the file from ComfyUI's lora folder, and applies it with ComfyUI's own load_lora_for_models - the same call a LoraLoader makes. Loaded LoRAs are cached in memory, so flipping between blocks you've already used doesn't reload weights. The LoRA screen and STRENGTH slider live in the node UI, and the README notes the saved JSON gets "lora" appended to the filename so it won't clobber your plain prompt-template files.

Inputs and outputs

Three inputs, all required:

  • model (MODEL) and clip (CLIP) - the base model, usually straight out of a Checkpoint Loader. The LoRA applies to both, which is why it needs both.
  • prompt_template_json (STRING) - the serialized blocks; UI-owned, don't hand-edit it.

Outputs:

  • selected_prompt and prompt (both STRING) - identical text from the selected block; the second is just a convenience so you don't fight for a port.
  • lora_model (MODEL) and lora_clip (CLIP) - the LoRA-applied model and clip.
  • template_json (STRING) - the normalized state, echoed back.

Wire lora_model into your sampler and lora_clip into a CLIP Text Encode, then feed selected_prompt into that same Text Encode's text input. Selection change, preset change, done.

Gotchas worth knowing

  • The LoRA is your responsibility. This node will happily load an SDXL LoRA onto a Flux model and produce... nothing useful, because LoRAs are architecture-bound - the KB's LoRA panel is blunt about that. It also won't insert trigger words for you; the block's prompt text still has to contain them.
  • One LoRA per block, not a stack. If you need three LoRAs on everything, rgthree's Power Lora Loader is still the tool for that. This node is the opposite trade: fewer weights, but the prompt and weight move as one unit.
  • Silent-ish failure. If the LoRA file is missing, the node logs a warning and passes model/clip through untouched. If your output looks "un-LoRA'd," check the console before debugging your sampler.
  • Strength defaults to 1.0. The old SDXL "start at 0.7" instinct is dated - check the LoRA's page for its intended weight, per the KB - but 1.0 is what you get unless you touch the slider.

Installing

ComfyUI Manager, search ComfyUI-TemplateReference, or:

cd ComfyUI/custom_nodes
git clone https://github.com/Tsubasa109/ComfyUI-TemplateReference

Restart ComfyUI. No Python deps beyond ComfyUI, no model downloads - the only files it needs are the LoRAs already sitting in your models/loras folder. The pack is young and has no real community footprint yet, so budget a little trial-and-error, but the mechanism here is honest: it's a LoraLoader whose inputs come from a dropdown instead of a wire.

Categorytemplate_reference

Inputs (3)

NameTypeDefaultDescription
modelMODELModel to apply the selected prompt block LoRA to.
clipCLIPCLIP to apply the selected prompt block LoRA to.
prompt_template_jsonSTRING{"version":1,"items":[]}Serialized prompt template blocks edited by the custom UI.

Outputs (5)

NameTypeDescription
selected_promptSTRING
promptSTRING
lora_modelMODEL
lora_clipCLIP
template_jsonSTRING