Nodes/comfyui-mrln-nodes/Prompt Template (MRLN)
ComfyUI Node

Prompt Template (MRLN)

Render positive + negative prompts from a library template. Loads a template from the two-tier prompt library (factory content shipped with the pack plus your persistent user library), resolves every slot as a fixed item or a seed-deterministic random draw, substitutes {variables} and inline {a|b} wildcards, and renders in the template's format or an override. The 'choices' output reports exactly what was selected or drawn. Batching: batch_count > 1 emits a LIST of prompts — item i drawn with master seed + i — so a batch of four gives four DIFFERENT images instead of four copies of one draw. batch_mode 'combinatorial' instead enumerates every combination of the slots that are currently random. At batch_count 1 the node behaves exactly as it always has. The 'gen_info' output carries the prompts, the seed and the drawn LoRAs' Civitai ids as an A1111 'parameters' string, so a metadata-capable save node can embed what this render actually knows. It states nothing it does not know: no Steps, Sampler, CFG or Model. This pack writes no images.

By master-merlin·Created 16 days ago·Updated 7 days ago· 2
Prompt Template (MRLN)
    • prompt
    • llm
    • loras
    • negative
    • choices
    • gen_info
    template
    template_namesslug
    trigger
    selection
    selection_mode
    seed0
    format
    text_length
    conflict_policy
    variables
    profilestandard
    batch_count1
    batch_modeincrement seed
    CategoryMRLN/prompt

    Inputs (13)

    NameTypeDefaultDescription
    templateCOMBOTemplate from the prompt library (factory + user merged; a user file with the same slug overrides factory). New files appear after 'Refresh node definitions'.
    template_namesCOMBOslugHow the template widget above names templates. 'slug' is the file path — the stable identifier, and what a shared workflow should carry. 'label' lets the widget hold the human name instead (the Composer's Apply to node writes that form), which reads better but breaks if the label is edited or a second template takes it. Either way a value that IS a known slug is read as one, so nothing already saved changes meaning.
    triggerSTRINGValue for the {trigger} variable — usually your LoRA trigger word or the subject line (e.g. 'BMWM4CS_G82'). Type it here or connect a STRING output from another node.
    selectionSTRINGPer-slot overrides, one 'slot=item' per line. 'slot=random' rolls the slot with the master seed, 'slot=random@123' with its own seed; 'slot=off' mutes the slot entirely; 'variant=<name|random|off>' picks or mutes the variant branch. Blank lines and # comments are ignored; unlisted slots use template defaults.
    selection_modeCOMBOMaster switch. 'as configured' honors each slot's fixed/random mode; 'randomize all' rolls every slot (and the variant); 'all fixed defaults' pins every slot to its template default.
    seedINT00–18446744073709550000Master seed for all random slots. Same seed + same library files = identical result; each slot draws independently, so fixed slots stay constant while random ones vary with the seed. Connect the same seed source as your sampler for lockstep.
    formatCOMBOOutput format override. 'string' joins everything into one line; 'string_labeled' emits 'Label: text' lines; 'json' emits one key per slot; 'json_flat' wraps the string render as {"prompt": ...}. Negative output is always a plain string.
    text_lengthCOMBOWhich item texts render: 'long' full descriptions, 'short' compact variants for tight tokenizers (e.g. SDXL). Items without a short text fall back to their long text. Draws are identical either way.
    conflict_policyCOMBOWhen a negative term also appears in the rendered prompt: 'negative prevails' keeps it in the negative output, 'positive prevails' drops it (a drawn section explicitly wants the term). Conflicts are always listed in the choices report.
    variablesoptSTRINGExtra template variables as 'name=value' lines. Each line fills the matching {name} placeholder in the template's prefix/suffix and item texts — e.g. 'plate=MRLN 500' sets the license plate caption {plate} in overdrive/full-shot. The template's Composer view lists which variables it declares.
    profileoptCOMBOstandardTarget-model profile: applies that profile's render overrides (format/text length) and emits its LLM system prompt on the llm output. 'standard' = the template's plain render. Profiles come from profiles.json (factory + user tier) extended by the template's own; explicit format/text_length widget choices still win.
    batch_countoptINT11–64How many prompts this node emits per queue — the fix for 'batch size 4, four identical images'. Every output becomes a LIST of that many prompts and ComfyUI runs the downstream graph once per item, so each image gets its own draw. Item i uses master seed + i, so fixed slots stay put while random ones vary. 1 (the default) is exactly the single value this node has always emitted — existing workflows are unaffected. IGNORED in 'combinatorial' mode, where the number of combinations sets the count.
    batch_modeoptCOMBOincrement seedHow the batch varies. 'increment seed': render batch_count prompts with master seeds seed, seed+1, seed+2 … — the usual 'give me N different ones'. 'combinatorial': ignore batch_count and emit EVERY combination of the slots that are currently random, in template order, each one pinned (they report as [fixed], and the batch line names the enumerated slots); leftover randomness such as a random variant stays on the master seed. Capped at 512 combinations — over that it errors with the computed size, and you shrink the space by fixing more slots in the selection box.

    Outputs (6)

    NameTypeDescription
    promptSTRINGThe rendered positive prompt in the chosen format.
    llmSTRINGThe 'Prompt Enhance (MRLN)' single wire: {target, prompt, protect, system, params} — the rendered prompt, the profile's LLM system prompt, and the LoRA trigger words the enhancer must keep verbatim.
    lorasSTRINGJSON list of the drawn LoRA blocks (file + strengths) — wire into the 'LoRA Apply (MRLN)' node between your model/clip loaders and the sampler.
    negativeSTRINGThe joined negative prompt (template + section + item negatives), always a plain string.
    choicesSTRINGReport of the variant/items chosen per slot with seed and tier — wire to a text preview to see what was drawn. Batched runs prefix each item with a 'batch i/N (seed …)' line.
    gen_infoSTRINGGeneration metadata in the A1111 'parameters' dialect, for a save node that can embed a metadata string: the positive prompt, a 'Negative prompt:' line when there is one, then 'Seed: <seed>' plus 'Civitai resources:' naming the drawn LoRAs by Civitai model-version id and weight (LoRAs without a Civitai AIR are left out). INCLUDED is only what this node knows — there is deliberately NO Steps, Sampler, CFG scale or Model here, because those live on your sampler and checkpoint nodes and a guessed value would travel with the image as if it were true. Civitai's own reader needs a 'Steps:' key before it looks at any of this, so the save node has to contribute the sampler settings on the same key/value line. This pack writes no images.