Custom Persona
Build one reusable prompt template with fill-in variables
- system_or_user_prompt_input
Writing a fresh prompt every time you want the same kind of output for a different subject is a chore - and it's exactly the kind of thing that should be a template with a blank to fill in, not a copy-paste job. Custom Persona is comfyui_LLM_party's answer: write your prompt once with a placeholder, supply the fill-in value as JSON, and get back the assembled prompt ready for the pack's LLM node.
It sits in the pack's persona category, which is really about shaping how an LLM behaves - a system prompt, a role, a fixed instruction - rather than a one-off question. This node is the templating layer underneath that idea.
How it works
prompt holds your template text, written with a placeholder in curly braces (the node's own default is "Based on background knowledge, please help me write an article about {theme}."). prompt_template is a JSON object supplying the actual value for that placeholder (default {"theme": "artificial intelligence"}). The node substitutes the JSON values into the matching placeholders in your prompt text and outputs the finished result.
The real payoff is when you're not typing prompt_template by hand every run - feed it from an upstream node instead (a row from Excel Iterator, a value pulled out by JSON Get Value, whatever's driving your batch) and the same prompt template gets reused across an entire run of different subjects without touching the prompt text itself.
The inputs and outputs that matter
prompt(multiline) - your template, with{placeholder}markers for whatever should vary between runs.prompt_template(multiline, JSON) - the values that fill those placeholders, one run at a time.is_enable- the pack's standard bypass toggle.file_content(optional) - pipe in document text alongside the templated prompt, useful if your persona's instructions reference "the background knowledge" the default template's own wording implies - combine a loaded document with a parametrized instruction in one node.
Output: system_or_user_prompt_input (STRING) - the assembled prompt, named to make clear it's meant to plug into either the LLM node's system prompt slot or its user prompt slot, whichever role you're building.
How to install it
Search comfyui_LLM_party in ComfyUI Manager and install, then restart. Manual route:
cd ComfyUI/custom_nodes
git clone https://github.com/heshengtao/comfyui_LLM_party.git
Run pip install -r requirements.txt from inside the pack's folder using ComfyUI's own Python, then restart. This node is plain text templating with nothing of its own to install - the heavier dependencies in this pack (LLM clients, embeddings, OCR, TTS) belong to other nodes sharing the same combined requirements.txt.
Common issues & troubleshooting
The placeholder doesn't get replaced - it shows up literally in the output. The key in prompt_template's JSON has to match the placeholder name in prompt exactly, including case. A typo in either one means the substitution silently doesn't happen for that field, and you'll see the raw {placeholder} text pass through unchanged.
prompt_template errors out or gets ignored. It has to be valid JSON - a missing quote or trailing comma breaks the parse. If you're building this field dynamically from another node rather than typing it by hand, running it through this pack's JSON Repair node first is cheap insurance.
You want more than one variable filled in. That's supported - prompt_template's JSON can hold multiple keys, and prompt can reference each with its own {placeholder}. There's no hard limit on how many you use, just keep the keys and placeholders matched up one to one.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| is_enable | BOOLEAN | true | — |
| prompt | STRING | 根据背景知识,请帮我写一篇关于{主题}的文章。 | — |
| prompt_template | STRING | {"主题":"人工智能"} | — |
| file_contentopt | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| system_or_user_prompt_input | STRING | — |