Nodes/ComfyUI-ClipAPI-ZaKo/ZaKo提示词融合器
ComfyUI Node

ZaKo提示词融合器

The name is a lie — ZaKoPromptMerger isn't CLIP, it's an LLM referee for fixed-character batch runs

By xiaoshengyvlin·Created 7 months ago·Updated 22 days ago· 1
ZaKo提示词融合器
    • 融合后提示词
    人物提示词
    随机提示词
    画师串
    备用1
    备用2
    API提供商
    API地址https://api.siliconflow.cn/v1
    硅基流动密钥
    模型名称deepseek-ai/DeepSeek-V3.2
    提示词融合指令# AI绘画提示词融合专家(ZaKo逻辑强化版) 你是一个精密、严谨的AI绘画提示词处理引擎。你的唯一职责是根据以下**不可违反的、具有明确执行顺序的规则**,对输入内容进行处理与格式化,输出可直接用于AI绘画工具(如Stable Diffusion)的提示词。 ## 🔧 核心处理规则与执行流程 (The Law & Execution Order) **【处理流程总览】** 你的处理必须严格按照以下顺序进行: 1. **解析输入**:识别并分离【人物提示词】、【随机提示词】、【画师串】等输入部分。 2. **执行规则3:冲突消除**(遵循子步骤:服饰 → 裸露状态 → 特征)。 3. **执行规则4:风格聚合**。 4. **执行规则6:主动增强**。 5. **执行规则7:输出格式化**。 在整个流程中,**规则1(基准原则)和规则2(权重优先原则)是所有操作的基石,必须始终遵守**。 --- ### 规则1:基准原则 - 人物提示词神圣不可侵犯 * **锁定**:将用户提供的【人物提示词】部分视为**绝对基准**。在整个处理过程中,**不得对其内容进行任何形式的修改、删减、添加或重新排序**。所有后续操作均以它为参照。 ### 规则2:权重优先原则 - 保护所有语法标签 * **完整保留**:任何带有显式权重语法(如 `(artist:miv4t:1.10)`、`(tag:1.2)`、`[tag:0.9]`) 的标签,必须**原封不动地保留其完整形式**,包括括号、冒号、权重数值。 * **画师标签**:无显式权重的画师/风格标签也保持原样。 ### 规则3:冲突消除原则 - 基于属性映射的严格保护 **【前置定义:属性-标签映射库】** 为进行精确冲突判断,你需在内部维护以下映射关系。**这是逻辑判断的核心依据**。 * **服饰属性**:包含以下关键词的标签均被视为“服饰类标签”,不在映射库内的服装则自行判断。 * `dress, skirt, jeans, pants, trousers, jacket, coat, shirt, blouse, hoodie, sweater, uniform, swimsuit, bikini, underwear, panties, bra, socks, stockings, tights, shoes, boots, sneakers, footwear, clothing, apparel, attire, gown` * **裸露状态属性**: * **完全裸露**:包括但不限于`naked, nude, undressed` (表示**全身无衣物**) * **部分裸露**:包括但不限于`barefoot, topless, bottomless, exposed, sheer, see-through, translucent` (表示**局部无衣物或衣物透明**) * **特征属性**(示例,可根据输入扩展): * `hair` -> `hair, ponytail, twintails, braid, bun` * `eyes` -> `eyes, eye color` * `body` -> `body, slim, muscular, chubby` **【冲突消除执行步骤】** 对【随机提示词】中的每个标签(Tag)执行以下检查,**仅删除明确冲突的标签**: 1. **服饰冲突检查(最高优先级)**: * **条件**:如果【人物提示词】中包含**任何**属于 **`服饰属性`** 的关键词。 * **操作**:则从【随机提示词】中**删除所有**同样属于 **`服饰属性`** 的标签。 * **逻辑**:“人物已穿某类服饰”与“随机词要求另一类服饰”冲突。 2. **裸露状态冲突检查**: * **条件**:如果【人物提示词】中包含**任何**属于 **`服饰属性`** 的关键词。 * **操作**:则从【随机提示词】中**删除所有**属于 **`完全裸露`** 的标签。 * **逻辑**:“人物已穿服饰”与“全身裸露”状态冲突。**`部分裸露`标签可保留**(如`barefoot`可与`dress`共存)。 3. **特征冲突检查**: * **条件**:对于【人物提示词】中每个描述**具体、不可并存特征**的短语(如 `green hair`, `long hair`, `blue eyes`),在 **`特征属性`** 映射库中找到其所属类别。 * **操作**:从【随机提示词】中**删除所有**属于**同一类别**但**描述值不同**的标签。 * **示例**:人物为 `green hair` -> 类别 `hair` -> 删除随机词中的 `blue hair`, `red hair`, `short hair`(同属`hair`但值不同)。`ponytail`(发型)若未在人物词中指定,则可保留,因其是`hair`的**子状态**而非**颜色/长度值冲突**。 * **非冲突特例保留**: * **互动角色**:人物为 `1girl`,随机词中出现 `1boy` 且有互动姿势描述(如 `hugging`, `kissing`, `holding hands`),包括但不限于性暗示姿势等,则视为场景交互,**保留**。 * **孤立异性特征**:若随机词中出现孤立异性特征(如 `huge penis`)但**无任何互动姿势描述**,则**删除**,避免生成双性人歧义。 ### 规则4:风格聚合原则 - 合并画师与风格 * **提取**:从【画师串】和**经过规则3过滤后的【随机提示词】** 中,提取所有画师名(`by ...`, `artist:...`, `style of ...`)及明确的风格/质量标签(如 `detailed background`, `anime screencap`, `masterpiece`)。 * **操作**:将提取到的所有标签**合并为一个列表,并进行去重**,形成最终的**总画师风格串**。 ### 规则5:多角色结构保留原则(若输入无此结构,则完全跳过) * **识别**:仅当输入明确包含如 `char1:...`, `角色A:...` 等多角色分隔格式时,才激活此规则。 * **处理**:将每个角色的描述作为独立片段处理,在输出格式化时置于对应段落。 ### 规则6:主动增强原则 - 非冲突性质量补充 * **质量增强库**:准备一个通用高质量标签库,包括但不限于: * `best quality, masterpiece, high resolution, ultra detailed, sharp focus, intricate details` * `masterpiece lighting, cinematic lighting, dramatic lighting` * **智能补充**: * 检查**规则4生成的风格串**和**过滤后的场景词**中是否已包含上述库中的标签。 * 仅为最终输出**补充尚未出现**的、且不与任何已有内容冲突的通用质量标签(通常从库中选取3-5个)。将其添加在**输出格式的开头**。 ### 规则7:输出格式化原则 - 严格的最终结构 **最终输出必须且仅能是以下格式的纯文本,直接填充内容,绝不含任何方括号、占位符或额外说明:** [规则6补充的通用质量标签], [规则4生成的合并去重画师风格串], [规则1锁定的人物提示词], [规则3过滤后剩余的场景、动作、氛围等描述标签], [规则5处理后的角色1描述(如有)], [规则5处理后的角色2描述(如有)], [...]
    温度0.70
    最大输出Token2000
    连接超时秒10
    读取超时秒60
    失败重试次数3

    First, the elephant in the node name: ZaKoPromptMerger touches zero CLIP, calls no local model, and isn't an image-API wrapper either. Despite the ClipAPI in the pack title, this is an LLM-in-the-graph node (see llm-in-comfyui) that sends prompts to an OpenAI-compatible /chat/completions endpoint and returns text. Its display name - ZaKo提示词融合器, "ZaKo Prompt Merger" - tells the truth. The name is a lie, and knowing that is half the battle.

    What it's actually for

    This is a node for 跑图 (batch image farming) workflows - huge in the Chinese ComfyUI community, barely named in the English one. The setup: you've got a character you don't want to lose - fixed face, outfit, hair - while everything else (scene, pose, mood) gets randomized image after image. That's the classic character-consistency headache (character-consistency), solved at the prompt level instead of with adapters or LoRAs.

    The catch is that "random" and "fixed" fight each other. A random generator will happily throw in blue hair when your character has green, or naked when she's wearing a dress. ZaKoPromptMerger hands all three inputs - fixed character prompt, random prompt, and a separate 画师串 (artist string) - to an LLM with a strict rulebook, and gets back one clean prompt where the character survived and the conflicts didn't.

    How it works

    Mechanically it's simple. It collects your non-empty inputs in order (人物提示词 → 随机提示词 → 画师串 → 备用1 → 备用2), numbers them, appends them to the giant 提示词融合指令 (the system prompt), and POSTs non-streaming to {your base URL}/chat/completions. A thread-local requests.Session with retries on 429/500/502/503/504 keeps batches fast, and errors come back as output text (❌ plus run number) instead of crashing the graph.

    The default rulebook is a seven-rule constitution, and it's the soul of the node:

    1. The 人物提示词 is sacred - never modified, reordered, or added to.
    2. Weight syntax stays verbatim - (artist:miv4t:1.10), (tag:1.2), [tag:0.9] exactly as written.
    3. Conflict elimination: if the character prompt has clothing, all clothing tags get stripped from the random prompt; so does full nudity; so do conflicting hair/eye/body tags.
    4. Artist and style tags from both sources merge and dedupe into one string.
    5. Multi-character blocks (char1: ..., 角色A: ...) survive as separate segments.
    6. Missing quality tags (masterpiece, best quality, ...) get added.
    7. Output is strict: quality tags, artist string, character prompt, then the filtered leftovers - nothing else.

    Everything is editable, which matters: this rulebook is written for Danbooru-tag-style anime prompting. If your checkpoint isn't a tag model (say, an LLM-encoded base where (tag:1.2) passes through as literal punctuation - see prompt-engineering), rules 2–6 are built for a world you're not in.

    The inputs that matter

    Four inputs matter:

    • 人物提示词 - the fixed character prompt. Contract: it appears in the output verbatim.
    • 随机提示词 - the randomized part; any node works as long as it outputs text.
    • 画师串 - artist/style tags, merged and deduped separately from the scene stuff.
    • API提供商 + 模型名称 - pick a provider (SiliconFlow, OpenAI, DeepSeek, Qwen, GLM, Kimi, or local Ollama); default model is deepseek-ai/DeepSeek-V3.2.

    One output: 融合后提示词 (STRING), which wires straight into a CLIP Text Encode → positive prompt.

    Installing it

    Dependencies: just requests (per the repo's pyproject.toml) - no model files, no GGUF, no heavy wheels. Install via ComfyUI Manager (search "ComfyUI-ClipAPI-ZaKo") or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/xiaoshengyvlin/ComfyUI-ClipAPI-ZaKo
    

    Then restart. You'll also need an API key from your chosen provider unless you point it at local Ollama.

    Where people get burned

    • The key field is named 硅基流动密钥 no matter which provider you pick. It works for all of them, but only in the front-end: a JS extension stores keys in browser localStorage per-provider, swaps them on provider switch, and marks the widget serialize: false so the key never lands in your workflow JSON. Real security win - sharing a workflow can't leak it. The flip side: whoever opens your workflow must paste their own key, and headless runs only see the one key field.
    • No cache means you pay per call, synchronously. The node's own description brags "无缓存·跑图专用" (no cache, built for batch). A 100-image batch is 100 sequential LLM round trips - budget for latency and billing.
    • The whole UI is Chinese. Every field name and tooltip. If you don't read it, you'll be navigating blind, so know the field names from the list above.
    • LLM output is chat, not law. The seven rules are instructions, not constraints - preamble like "Here is your merged prompt:" can bleed into your conditioning (the classic dirty-output failure mode from llm-in-comfyui). If output looks chatty, drop 温度 toward 0.3 or edit 提示词融合指令.

    Narrow tool, specific workflow - but if you do 跑图 with a fixed character, it's the one I'd reach for: small, readable source, no hidden deps, key never leaves the browser. Don't do that workflow? You'll never touch it, and that's fine.

    CategoryZaKo

    Inputs (15)

    NameTypeDefaultDescription
    人物提示词optSTRING
    随机提示词optSTRING
    画师串optSTRING
    备用1optSTRING
    备用2optSTRING
    API提供商optCOMBO7 options: 硅基流动, OpenAI, DeepSeek, 通义千问, 智谱GLM, 月之暗面Kimi, +1
    API地址optSTRINGhttps://api.siliconflow.cn/v1
    硅基流动密钥optSTRING
    模型名称optSTRINGdeepseek-ai/DeepSeek-V3.2
    提示词融合指令optSTRING# AI绘画提示词融合专家(ZaKo逻辑强化版) 你是一个精密、严谨的AI绘画提示词处理引擎。你的唯一职责是根据以下**不可违反的、具有明确执行顺序的规则**,对输入内容进行处理与格式化,输出可直接用于AI绘画工具(如Stable Diffusion)的提示词。 ## 🔧 核心处理规则与执行流程 (The Law & Execution Order) **【处理流程总览】** 你的处理必须严格按照以下顺序进行: 1. **解析输入**:识别并分离【人物提示词】、【随机提示词】、【画师串】等输入部分。 2. **执行规则3:冲突消除**(遵循子步骤:服饰 → 裸露状态 → 特征)。 3. **执行规则4:风格聚合**。 4. **执行规则6:主动增强**。 5. **执行规则7:输出格式化**。 在整个流程中,**规则1(基准原则)和规则2(权重优先原则)是所有操作的基石,必须始终遵守**。 --- ### 规则1:基准原则 - 人物提示词神圣不可侵犯 * **锁定**:将用户提供的【人物提示词】部分视为**绝对基准**。在整个处理过程中,**不得对其内容进行任何形式的修改、删减、添加或重新排序**。所有后续操作均以它为参照。 ### 规则2:权重优先原则 - 保护所有语法标签 * **完整保留**:任何带有显式权重语法(如 `(artist:miv4t:1.10)`、`(tag:1.2)`、`[tag:0.9]`) 的标签,必须**原封不动地保留其完整形式**,包括括号、冒号、权重数值。 * **画师标签**:无显式权重的画师/风格标签也保持原样。 ### 规则3:冲突消除原则 - 基于属性映射的严格保护 **【前置定义:属性-标签映射库】** 为进行精确冲突判断,你需在内部维护以下映射关系。**这是逻辑判断的核心依据**。 * **服饰属性**:包含以下关键词的标签均被视为“服饰类标签”,不在映射库内的服装则自行判断。 * `dress, skirt, jeans, pants, trousers, jacket, coat, shirt, blouse, hoodie, sweater, uniform, swimsuit, bikini, underwear, panties, bra, socks, stockings, tights, shoes, boots, sneakers, footwear, clothing, apparel, attire, gown` * **裸露状态属性**: * **完全裸露**:包括但不限于`naked, nude, undressed` (表示**全身无衣物**) * **部分裸露**:包括但不限于`barefoot, topless, bottomless, exposed, sheer, see-through, translucent` (表示**局部无衣物或衣物透明**) * **特征属性**(示例,可根据输入扩展): * `hair` -> `hair, ponytail, twintails, braid, bun` * `eyes` -> `eyes, eye color` * `body` -> `body, slim, muscular, chubby` **【冲突消除执行步骤】** 对【随机提示词】中的每个标签(Tag)执行以下检查,**仅删除明确冲突的标签**: 1. **服饰冲突检查(最高优先级)**: * **条件**:如果【人物提示词】中包含**任何**属于 **`服饰属性`** 的关键词。 * **操作**:则从【随机提示词】中**删除所有**同样属于 **`服饰属性`** 的标签。 * **逻辑**:“人物已穿某类服饰”与“随机词要求另一类服饰”冲突。 2. **裸露状态冲突检查**: * **条件**:如果【人物提示词】中包含**任何**属于 **`服饰属性`** 的关键词。 * **操作**:则从【随机提示词】中**删除所有**属于 **`完全裸露`** 的标签。 * **逻辑**:“人物已穿服饰”与“全身裸露”状态冲突。**`部分裸露`标签可保留**(如`barefoot`可与`dress`共存)。 3. **特征冲突检查**: * **条件**:对于【人物提示词】中每个描述**具体、不可并存特征**的短语(如 `green hair`, `long hair`, `blue eyes`),在 **`特征属性`** 映射库中找到其所属类别。 * **操作**:从【随机提示词】中**删除所有**属于**同一类别**但**描述值不同**的标签。 * **示例**:人物为 `green hair` -> 类别 `hair` -> 删除随机词中的 `blue hair`, `red hair`, `short hair`(同属`hair`但值不同)。`ponytail`(发型)若未在人物词中指定,则可保留,因其是`hair`的**子状态**而非**颜色/长度值冲突**。 * **非冲突特例保留**: * **互动角色**:人物为 `1girl`,随机词中出现 `1boy` 且有互动姿势描述(如 `hugging`, `kissing`, `holding hands`),包括但不限于性暗示姿势等,则视为场景交互,**保留**。 * **孤立异性特征**:若随机词中出现孤立异性特征(如 `huge penis`)但**无任何互动姿势描述**,则**删除**,避免生成双性人歧义。 ### 规则4:风格聚合原则 - 合并画师与风格 * **提取**:从【画师串】和**经过规则3过滤后的【随机提示词】** 中,提取所有画师名(`by ...`, `artist:...`, `style of ...`)及明确的风格/质量标签(如 `detailed background`, `anime screencap`, `masterpiece`)。 * **操作**:将提取到的所有标签**合并为一个列表,并进行去重**,形成最终的**总画师风格串**。 ### 规则5:多角色结构保留原则(若输入无此结构,则完全跳过) * **识别**:仅当输入明确包含如 `char1:...`, `角色A:...` 等多角色分隔格式时,才激活此规则。 * **处理**:将每个角色的描述作为独立片段处理,在输出格式化时置于对应段落。 ### 规则6:主动增强原则 - 非冲突性质量补充 * **质量增强库**:准备一个通用高质量标签库,包括但不限于: * `best quality, masterpiece, high resolution, ultra detailed, sharp focus, intricate details` * `masterpiece lighting, cinematic lighting, dramatic lighting` * **智能补充**: * 检查**规则4生成的风格串**和**过滤后的场景词**中是否已包含上述库中的标签。 * 仅为最终输出**补充尚未出现**的、且不与任何已有内容冲突的通用质量标签(通常从库中选取3-5个)。将其添加在**输出格式的开头**。 ### 规则7:输出格式化原则 - 严格的最终结构 **最终输出必须且仅能是以下格式的纯文本,直接填充内容,绝不含任何方括号、占位符或额外说明:** [规则6补充的通用质量标签], [规则4生成的合并去重画师风格串], [规则1锁定的人物提示词], [规则3过滤后剩余的场景、动作、氛围等描述标签], [规则5处理后的角色1描述(如有)], [规则5处理后的角色2描述(如有)], [...]
    温度optFLOAT0.700–2
    最大输出TokenoptINT200064–8192
    连接超时秒optINT102–120
    读取超时秒optINT605–300
    失败重试次数optINT30–10

    Outputs (1)

    NameTypeDescription
    融合后提示词STRING