Nodes/ComfyUI Prompt Template/MIM Prompt Template Key Value
ComfyUI Node

MIM Prompt Template Key Value

MIM Prompt Template Key Value

By DaniilVdovin·Created 11 months ago·Updated 11 months ago· 1
MIM Prompt Template Key Value
  • clip
  • positive
  • negative
  • positive
  • negative
template_positiveA *obj on a *place
template_negative
variablesobj=cat place=wooden table style=photorealistic

Some people don't want to touch JSON, and this node exists for them. It's the same *variable template idea as the rest of the ComfyUI Prompt Template pack from DaniilVdovin - write A *obj on a *place, define the values, get conditioning out - but the values go in as plain key=value lines instead of a JSON object. It's the quick-and-dirty sibling of the Json node, and honestly the one I'd hand to someone who just wants to swap a subject and go.

Where the Json node is for structured reuse and chaining multiple templates together, this one is for the single-shot edit: you've got a template and three values, you type them as three lines, you're done. The README's own example is the whole pitch:

character=cyberpunk robot
outfit=neon armor
background=city at night

How it works

The node parses your variables box line by line, splitting each on the first = (so values containing = survive), stripping whitespace, skipping blank lines, and treating any line starting with # as a comment. Then it does the same simple .replace() on the templates - every *character becomes cyberpunk robot, and so on. The one structural difference from the Json node: clip is required here, not optional. There's no text-only mode; this node always encodes, so it always sits between your prompt text and the KSampler.

The inputs that matter

  • template_positive - the template with *obj, *place etc. (default A *obj on a *place).
  • template_negative - same syntax for the negative side.
  • variables - the key=value lines, one per line, # for comments.
  • clip - required, so connect your CLIP model (e.g. from a checkpoint/dual clip loader).

Outputs: positive and negative CONDITIONING for the KSampler, plus positive and negative STRING with the fully substituted text - handy to eyeball what actually got sent to the sampler via a text display node. Note there's no json output on this one, so it doesn't participate in the Json node's chaining game.

Installing

Zero dependencies - the whole pack is pure Python stdlib with no requirements file and nothing to download. Manager search: "ComfyUI Prompt Template". Or the manual route:

cd ComfyUI/custom_nodes
git clone https://github.com/DaniilVdovin/ComfyUI-prompt-templating.git

Then restart ComfyUI; it shows up under MIM_Prompts.

Gotchas

Same family quirks as the Json node: replacement is a naive string replace, so keep variable names from being prefixes of each other (*obj and *obj2 is a trap), and a # only comments out a whole line - you can't use it mid-line. Also, since clip is mandatory, you can't use this node purely for text; if that's what you need, the Json node with clip disconnected is your friend. For everything else, this is the least ceremony you'll get out of a *var templating node.

CategoryMIM_Prompts

Inputs (4)

NameTypeDefaultDescription
clipCLIP
template_positiveoptSTRINGA *obj on a *place
template_negativeoptSTRING
variablesoptSTRINGobj=cat place=wooden table style=photorealistic

Outputs (4)

NameTypeDescription
positiveCONDITIONING
negativeCONDITIONING
positiveSTRING
negativeSTRING