Nodes/comfyui_ai_prompt/AI 提示词模板
ComfyUI Node

AI 提示词模板

The pack's other node is a glorified text box, and that's fine

By Bigesila-B·Created 25 days ago·Updated a day ago· 1
AI 提示词模板
    • system_template
    note提示词模板备注
    templateYou are a precise image prompt assistant.

    Let's not oversell this one. AIPromptTemplate doesn't call an API, doesn't touch a model, doesn't have a single interesting mechanism. It's a labeled text box that hands a string to the rest of your workflow. What it does do is give you a tidy home for your system prompt, which is more useful than it sounds.

    What it is

    The comfyui_ai_prompt pack ships two nodes. AIChatPrompt is the one doing the actual LLM work; this one is its sidekick. It takes a system prompt you write once and outputs it as a STRING named system_template. And here's the neat part: that's the exact input name AIChatPrompt exposes, so the two nodes snap together. You keep the system prompt here, wire the output into the generator, and never touch the generator's settings to tune your model's "voice" again.

    Inputs and output

    • note - a plain label for keeping your canvas organized. Cosmetic only; it never reaches the API, so don't expect it to do anything.
    • template - the actual system prompt. Multiline, so paste your whole preamble in here.
    • Output: system_template (STRING) - wire it into AIChatPrompt's system_template input, or anywhere else that takes a string.

    Under the hood the node's render() function just returns the template verbatim. It's a passthrough, deliberately, because its job is organization, not transformation. Think of it as ComfyUI's String node with better semantics - the output name tells you what it's for, not just what it is.

    Why you'd bother

    ComfyUI has no shortage of constant/string nodes, so the honest case for this one is workflow hygiene. If you run several AIChatPrompt nodes in one graph - a vision captioner, an enhancer, a plain writer - a single shared template means you edit the system prompt in one place and every branch picks it up. It also survives saving as a workflow template, so your shop-standard "You are a precise image prompt assistant" preamble rides along every time. If you only have one generator and one prompt, skip it and type straight into the generator's field. The node earns its keep the moment you have more than one.

    Installing it

    Same pack, same install as its bigger sibling:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Bigesila-B/comfyui_ai_prompt.git
    cd comfyui_ai_prompt
    python -m pip install -r requirements.txt
    

    Search AI Prompt in ComfyUI Manager if you'd rather, then restart ComfyUI and look under the AI 提示词 category. Dependencies are just requests, Pillow, and numpy - nothing to download.

    Things to know

    The failure modes here are essentially zero, because the node does so little. One gotcha: the note field looks like it should do something (it's marked "备注", a remark) but it's pure housekeeping. The other thing worth saying: this node can't run at all if the pack fails to import, so if it's missing from your menu, the usual suspects apply - install the requirements with the same Python that launches ComfyUI, especially on the Portable build, and restart fully. When it's working, it's boring in the best way: a system prompt that stays put, in one place, feeding your LLM-powered prompt workflow.

    CategoryAI 提示词

    Inputs (2)

    NameTypeDefaultDescription
    noteSTRING提示词模板备注
    templateSTRINGYou are a precise image prompt assistant.

    Outputs (1)

    NameTypeDescription
    system_templateSTRING