Nodes/Comfyui_PDuse/PD文本列表打包
ComfyUI Node

PD文本列表打包

PD文本列表打包 is your batch feed

By 7BEII·Created 2 years ago·Updated 15 days ago· 53
PD文本列表打包
    • text_list
    • filename_text
    • count
    text_1
    filename_1
    text_2
    filename_2
    text_3
    filename_3
    text_4
    filename_4
    text_5
    filename_5
    input_text_list
    input_filename_text

    It assembles a text batch so you don't have to

    PD_TextListPack (display name "PD文本列表打包", "pack text list") is the front door of the pack's text-batch pipeline. You drop up to five text contents into text_1 through text_5, give each an optional filename, and it hands you back a proper text list, a matching newline-joined filename_text string, and a count. You can also feed in a pre-existing list via input_text_list and it merges with the manual slots.

    Why bother? ComfyUI's text nodes are famously one-string-at-a-time, and the moment you want to save ten captions, sort a batch, or drive a loop you need a list. This node is the "many boxes in, one list out" step - the exact repetition-fighting plumbing the KB describes in comfyui-node-plumbing.md. Pair it with the pack's sort node (PD_TextListSort) and the folder loader, and you have a mini batch pipeline with zero Python.

    How it works

    Straight from the source: it collects the five optional text_N/filename_N pairs, filters out empty text, merges in anything from input_text_list, and then pads the filename list to match - any text without a filename gets a default file_N.txt. The filenames are joined with newlines into filename_text, and the node returns the list plus its length.

    The subtle part: text_list is a real list output (OUTPUT_IS_LIST). That's deliberate - it's meant to feed other list-aware nodes in the pack. But it's also the thing that will confuse you the first time you wire it into a plain text node and get a type error.

    Inputs and outputs

    • text_1 through text_5 - the contents. All optional, multiline.
    • filename_1 through filename_5 - one per text. Leave blank and you get file_N.txt.
    • input_text_list - feed an existing list in here to merge with the manual slots.
    • input_filename_text - newline-joined filenames to go with that list.
    • Outputs: text_list (list), filename_text (newline string), count (int).

    Installing it

    Ships in Comfyui_PDuse:

    cd ComfyUI/custom_nodes
    git clone https://github.com/7BEII/Comfyui_PDuse.git
    cd Comfyui_PDuse
    pip install -r requirements.txt
    

    Or search "Comfyui_PDuse" in ComfyUI Manager and restart.

    The traps

    First and biggest: a list is not a string. The text_list output won't plug into an ordinary STRING socket - you need a list-capable consumer, or run it through the pack's unpack node (PD_TextListUnpack) to pull one item out. Second, the filename-count padding is silent: type four texts and forget a filename, and you get a default name instead of an error, which can produce surprising filenames when you save. Third, if every slot is empty the node returns [""] and count = 0 - a technically valid empty list that some downstream nodes will cheerfully process as one blank item. Fill at least one slot and you're fine. For assembling a clean batch before sorting or saving, it does the job with no fuss.

    CategoryPDuse/Text

    Inputs (12)

    NameTypeDefaultDescription
    text_1optSTRING
    filename_1optSTRING
    text_2optSTRING
    filename_2optSTRING
    text_3optSTRING
    filename_3optSTRING
    text_4optSTRING
    filename_4optSTRING
    text_5optSTRING
    filename_5optSTRING
    input_text_listoptSTRING可选:直接输入text_list列表(会与单独输入的文本合并)
    input_filename_textoptSTRING

    Outputs (3)

    NameTypeDescription
    text_listSTRING
    filename_textSTRING
    countINT