🐠RH批量LLM提示词@炮老师的小课堂
A/B/C/D image groups, one aligned prompt per image — RH's batch LLM writer
- 🖼️ A组图像
- 🖼️ B组图像
- 🖼️ C组图像
- 🖼️ D组图像
- 📝 提示词列表
- 📄 完整响应
- ℹ️ 处理信息
Here's the workflow this node exists for: you have a folder of reference images and you want an LLM to write one prompt per image for a downstream image generator or editor. Now add the twist that makes it genuinely hard - the reference images come in aligned groups (A/B/C/D), where A is the image you're writing for and B/C/D are the same row's context: the style reference, the product angle, the edited version. DapaoRHBatchLLMPromptNode is the RunningHub-pack node that does exactly this: reads A/B/C/D groups from folders or wired IMAGE inputs, aligns them, and emits a prompt per A-image, with concurrency, retries, and a failure policy so a 200-image batch runs unattended.
The inputs that matter
- 🌐 API渠道 + 🔑 API密钥 - the RH rule: domestic/international keys don't cross. This node calls the RH LLM endpoint (
llm.runninghub.cn), which is separate from the image/video API - so the key is a RunningHub LLM key. - 🤖 模型ID - 72 model IDs, default
google/gemini-3.1-flash-lite-preview. The flash-lite default is the right call for a job where you want volume, not a flagship's price tag. - 🎯 系统角色 - defaults to "you are a professional batch image-editing prompt expert" who strictly writes one prompt per aligned group. This is the prompt-discipline contract; leave it unless you know why.
- 🧾 元指令 - the meta-instruction block describing what each group's images mean and how to fuse them. The default is well-written - a good template to adapt rather than replace.
- 📂 A组文件夹 / B组 / C组 / D组文件夹 - read entire folders of images. This is the scale path: point at folders, not individual wires. A/B/C/D组图像 (IMAGE inputs) are the small-scale alternative.
- 🧩 缺失处理策略 - what happens when groups have unequal lengths (strict error default vs. tolerant fills).
- 🔢 无图默认数量 - how many items to produce when a group is empty.
- 🛡️ 多图模式最大提示词数量 - cap on prompts in multi-image mode (0 = no cap).
- 🚦 多图推理模式 - 并发逐条请求 (concurrent per-item requests, default) vs the serial alternative. 🚀 并发数 - 4 default. 🛟 失败重试次数 - 1. 🧪 推理失败策略 - 失败占位继续 (placeholder-and-continue) default.
- 🖼️ 发送图片最长边 (1024) and 🗜️ 发送图片JPEG质量 (85) - the compression that keeps token costs sane on image-heavy batches.
- 🧠 推理强度 - four levels, default
none. Some RH LLM models support a reasoning pass; this dials it. - Standard 🌡️ 温度 0.7, 📝 最大输出令牌 2048, 🎲 Top_P 1, 🎲 随机种 (cache-only), ⏱️ 超时时间 180, plus ➕ 额外参数JSON.
Outputs
📝 提示词列表 - a list of STRING, one prompt per aligned A-image (this is the deliverable), plus 📄 完整响应 and ℹ️ 处理信息 for auditing.
The honest read
This is a niche-but-real pattern - "aligned image groups → one downstream prompt each" is exactly what you'd hand-build with a loop and a VLM node, and this node packages the alignment, concurrency, retry, and failure policy so you don't have to. The llm-in-comfyui.md framing applies: the LLM is a translation layer between your aligned reference set and the downstream generator, and subject drift is the standing risk - which is why the default 元指令 insists on "only output the current item's prompt, one-to-one with image A." Keep that discipline in whatever you write.
Two cost realities: every item is a separate paid LLM call (72 model IDs means a wide price range - flash-lite exists so you don't pay flagship rates for 500 prompts), and the JPEG/1024 compression is your real money saver on image-heavy batches. Don't crank 发送图片最长边 up and wonder why the bill doubled.
Gotchas
- Unequal groups - folder lengths that don't match will trip the strict error strategy; set 缺失处理策略 to tolerant if you're running ragged folders.
- Placeholder-and-continue hides failures - the 提示词列表 will contain placeholder strings; audit 处理信息 before feeding the list downstream.
- Key mismatch - image/video RH keys vs LLM keys may be different credentials; make sure the key actually has LLM access.
- Chinese-only labels.
Install: ComfyUI Manager → "dapaoAPI", or git clone https://github.com/paolaoshi/ComfyUI-dapaoAPI.git → pip install -r requirements.txt → restart. RunningHub account + API key required.
Inputs (29)
| Name | Type | Default | Description |
|---|---|---|---|
| 🌐 API渠道 | COMBO | 国内版 | 国内版与国外版使用不同的 API 地址和 API 密钥,请选择与密钥一致的渠道。 |
| 🔑 API密钥 | STRING | 国内版和国外版密钥不通用。 | |
| 🤖 模型ID | COMBO | google/gemini-3.1-flash-lite-preview | 复用 RH LLM 模型列表。 |
| 🎯 系统角色 | STRING | 你是一个专业的批量图像编辑提示词专家。你会严格根据每一组已对齐图片和用户元指令,为当前编号图片生成一个专属提示词。 | — |
| 🧾 元指令 | STRING | 请根据当前组图片生成一个适合下游图像生成/图像编辑模型使用的最终提示词。 要求: 1. 只输出当前这一项的最终提示词文本。 2. 不输出编号、标题、Markdown、JSON、解释、寒暄或多余前后缀。 3. 必须保持与当前 A 图一一对应,不要描述其他编号图片。 4. 如果有 B/C/D 图,请按它们的角色说明理解并融合。 | — |
| 📂 A组文件夹 | STRING | — | |
| 📂 B组文件夹 | STRING | — | |
| 📂 C组文件夹 | STRING | — | |
| 📂 D组文件夹 | STRING | — | |
| 🧩 缺失处理策略 | COMBO | 严格报错 | 智能对齐找不到对应图片时的处理方式。默认严格报错,防止错位。 |
| 🔢 无图默认数量 | INT | 11–100 | 完全没有接入图片/文件夹时使用。若指令里写了 10组/10个/十组,会优先自动识别文本数量。 |
| 🛡️ 多图模式最大提示词数量 | INT | 00–10000 | 只限制有图/文件夹模式。0 表示不限制;例如填 50 时最多处理 A组前 50 项,避免误传大文件夹消耗大量 token。 |
| 🚦 多图推理模式 | COMBO | 并发逐条请求 | 并发逐条请求每个任务只发当前配对图,通常更接近单独节点速度;单次批量请求会把所有图片塞进一次请求,图片多时可能很慢。 |
| 🚀 并发数 | INT | 41–20 | 有图/文件夹模式下同时请求 RH LLM 的任务数量。过高可能触发限流,建议 2-6。 |
| 🛟 失败重试次数 | INT | 10–5 | 单个图片配对任务失败后的额外重试次数。 |
| 🧪 推理失败策略 | COMBO | 失败占位继续 | 失败占位继续会保留列表位置;跳过失败继续会减少输出数量;任一失败中断会直接报错。 |
| 🖼️ 发送图片最长边 | INT | 1024256–4096 | 发送给 LLM 前会等比缩放图片,默认最长边 1024。调小更快更省 token;调大细节更多但更慢。 |
| 🗜️ 发送图片JPEG质量 | INT | 8540–100 | 发送给 LLM 的 JPEG 压缩质量。默认 85,通常足够做提示词/编辑指令分析。 |
| 🌡️ 温度 | FLOAT | 0.700–2 | — |
| 📝 最大输出令牌 | INT | 20481–65536 | — |
| 🎲 Top_P | FLOAT | 1.000–1 | — |
| 🧠 推理强度 | COMBO | none | 4 options: none, low, medium, high |
| 🎲 随机种 | INT | 00–18446744073709550000 | 只用于 ComfyUI 缓存控制;不会发送给 RH LLM。 |
| ⏱️ 超时时间 | INT | 18030–1200 | — |
| 🖼️ A组图像opt | IMAGE | — | |
| 🖼️ B组图像opt | IMAGE | — | |
| 🖼️ C组图像opt | IMAGE | — | |
| 🖼️ D组图像opt | IMAGE | — | |
| ➕ 额外参数JSONopt | STRING | {} | JSON对象,会合并到 RH 请求体;同名字段会覆盖节点控件生成的参数。 |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| 📝 提示词列表 | STRING | — |
| 📄 完整响应 | STRING | — |
| ℹ️ 处理信息 | STRING | — |