批量套版(远端合成)
Spreadsheet rows in, designed page previews out
- results_json
"套版" (tào bǎn) is the Chinese design-industry workflow of filling the same template with different data - think a product page, poster, or ad layout rendered once per row of a spreadsheet. RemoteTemplateBatchCompose automates that inside ComfyUI: it takes a design template plus an array of data rows, substitutes the data into the template locally, and calls a remote rendering service to produce a preview image per row. If you work with that kind of pipeline, this is your node. If you don't, it's the most domain-specific node in the pack and you can safely scroll past.
Here's the flow, worth understanding because the split is unusual. It validates the template once (checks layer.type == "template", that each templateRules entry references an existing unique node, and that types/column names agree). Then, per data item, it deep-copies the template, regenerates every node ID to keep renders independent, and swaps values in - text rules get node.content = value, image rules get node.src = value. The result is assembled into an editable canvas JSON (outer type: "page", template under layers). Then comes the remote part: POST {base_url}/open/api/agent/v1/template/replace renders the preview, and the node collects URL, dimensions, and the canvas JSON into a result per row.
The inputs that matter
template_json- required; the full template, following the pack's "拓版协议" (template protocol). Structure:layer+templateRules.items_json- required; an array of rows, each{"workId": ..., "input": {"field": "value", ...}, "rowNo": ..., "attempt": ...}.base_url- the remote render service. And here's a genuinely nice touch: leave it empty and the node uses a Mock placeholder image (https://placehold.co/1200x1200.png) instead of calling a server. That makes local testing of your template/data logic possible without a backend.auth_token- Bearer AK for the service, merged intoAuthorization.app_name,biz_code,file_type(png/jpg/webp),store_type(defaultoss),timeout(per call, default 300s).extra_headers- JSON object orKey: Valuelines;auth_tokenwins if both setAuthorization.
Output
One results_json array, one entry per input row. Successful rows carry status: "SUCCESS", the preview url, filename, width/height, and value (the editable canvas JSON). Failures get status: "FAILED" with an errorCode/errorMessage - and crucially, one bad row doesn't kill the batch; each row fails independently.
Honest caveats
The template replacement is text/image substitution with rule validation - it will not invent layouts or reflow content, and any rule type other than text/image raises. And the node only makes sense with the matching remote service; without a base_url you get mock placeholders (great for testing, useless for production). It's clearly an internal tool that was open-sourced, and the README never mentions it.
Installing
cd ComfyUI/custom_nodes
git clone https://github.com/jinchanz/ComfyUI-ADIC
Restart ComfyUI, or install "ComfyUI-ADIC" via ComfyUI Manager. requests only, no model downloads. The full protocol details live in the source (module/nodes_template_compose.py).
Inputs (10)
| Name | Type | Default | Description |
|---|---|---|---|
| template_json | STRING | 完整模板 JSON 字符串,结构遵循拓版协议 | |
| items_json | STRING | 待处理数据数组的 JSON 字符串 | |
| base_urlopt | STRING | 远端套版服务基础地址,例如 https://abcd.example;留空时使用 Mock 预览图 | |
| auth_tokenopt | STRING | Bearer AK,调用远端服务时写入 Authorization 头 | |
| app_nameopt | STRING | local | 远端服务 appName |
| biz_codeopt | STRING | 远端服务 bizCode | |
| file_typeopt | COMBO | png | 预览图文件格式 |
| store_typeopt | STRING | oss | 预览图存储类型 |
| timeoutopt | INT | 3005–1800 | 单条远端调用超时(秒) |
| extra_headersopt | STRING | 自定义请求头,支持 JSON 对象或每行一条 'Key: Value';与 Bearer Token 合并,auth_token 非空时 Authorization 以 auth_token 为准 |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| results_json | STRING | — |