Nodes/Comfyui-WL-MainImageDesign/🔄 WL Prompt Batch Converter
ComfyUI Node

🔄 WL Prompt Batch Converter

The boring glue node that chunks your prompt lists into batches

By senhaicc·Created 8 months ago·Updated 8 months ago· 0
🔄 WL Prompt Batch Converter
    • batch_output
    prompts_list
    batch_size5

    Every pack has one node that isn't the headline act, and this is it. WL Prompt Batch Converter does exactly one thing: it takes a big block of text containing lots of prompts and splits it into fixed-size batches, separated by --- lines. No API, no API key, no models, no GPU. It's the plain sibling of the pack's LLM-powered generator, and it's genuinely fine at what it does.

    Why would you want this? Any workflow where you feed prompts through in groups - process five at a time, queue a batch, or reorganize a long list before you paste it somewhere. It's the kind of node you'd normally write inline or not bother with, except that when you've got 30 prompts from the generator next door and you want them chunked cleanly, having it as a node beats reaching for a Python script.

    How it works

    Mechanically it's about twenty lines of logic. The prompts_list input is a STRING with forceInput on, so it wants text - either pasted into the widget or wired from another text output. If that text starts with [, the node tries to parse it as a JSON array of strings. Otherwise (or if the JSON parse fails) it splits the text on newlines and drops empty lines. Then it walks the list in steps of batch_size, joins each batch with newlines, and glues the batches together with \n---\n.

    Output is a single batch_output STRING. Wire it to a text save node, a display, or anything downstream that consumes ----separated blocks.

    The two inputs

    • prompts_list - your prompt text. Multiline. Can be a JSON array or plain newline-separated lines.
    • batch_size - how many prompts per batch. Default 5, range 1–20. The tooltip literally says "每批处理数量": the count per batch.

    That's the whole interface. This is a utility, not a sandbox.

    Gotchas that will actually bite you

    • It strips blank lines. If your original list used empty lines to separate prompts, those are silently removed. That's usually what you want - but don't rely on blank lines as intentional structure, because you'll lose them.
    • The [ JSON trap. If the text starts with [ but isn't valid JSON, the fallback is a newline split. If your "JSON" is all on one line, that means the entire block becomes a single giant "prompt" and you get one batch of one. If you're pasting JSON, make sure it actually parses.
    • Empty input returns the string Error: No prompts list provided rather than an empty batch. Treat that as your signal to actually type something in.

    One design note that trips people up: the pack's other node, WL Main Image Designer, outputs prompts_list as a real list of strings, but this converter expects a single STRING. They don't snap together port-to-port - you'll either paste the generator's output as text or route it through a list-to-string helper. It's a small seam in an otherwise tidy pack, worth knowing before you build the workflow.

    Install

    You already have it if you installed the pack for the generator. If not:

    cd ComfyUI/custom_nodes
    git clone https://github.com/senhaicc/Comfyui-WL-MainImageDesign
    

    Restart ComfyUI and look for 🔄 WL Prompt Batch Converter under the 🎨 WL-MainImageDesign category. No extra dependencies - this node uses nothing ComfyUI doesn't already ship.

    Category🎨 WL-MainImageDesign

    Inputs (2)

    NameTypeDefaultDescription
    prompts_listSTRING
    batch_sizeINT51–20每批处理数量

    Outputs (1)

    NameTypeDescription
    batch_outputSTRING