ComfyUI Node

SummaryReader

Rebuild a generation from the settings blurb it printed

By morino-kumasan·Created 2 years ago·Updated a day ago· 1
SummaryReader
    • STRING
    • STRING
    • STRING
    • INT
    • STRING
    summary

    PromptDecode emits a human-readable Summary - the exports block, then the positive prompt, the negative prompt and the LoRA list under labelled sections. SummaryReader is the inverse: paste that text in, get the pieces back out as separate outputs. It's the pack's round-trip node, and it's how a second workflow stages itself off the first one's results.

    The author's sample workflows use it both ways. In summary2i.sample.json, a summary string pasted into a primitive node is unpacked and wired into the encoder, the LoRA loader and the sampler - a full generation reconstructed from text. In hiresfix2.sample.json, a StringPicker pulls the summary out of a previous run's PNG and feeds this node, so stage two configures itself from stage one's file.

    How it works

    It scans for section headers of the form ---- Name ----, using them as cut points:

    for m in re.finditer(r"\n*---- ([a-zA-Z0-9]+) ----\n", summary, flags=re.MULTILINE):
    

    Everything before the first header is the exports block, which is parsed as key: value lines into a small dictionary. Then each section's body is assigned by name: positive, negative, lora. The last output is that exports dictionary, JSON-encoded - so it's the same shape PromptDecode emits, and can be fed straight into the pack's JsonExtract* nodes.

    The seed output comes from the exports: the code looks for a key literally named seed in that header block, or for a ---- seed ---- section. Worth knowing because PromptDecode writes its own seed into the header as prompt_seed, which is not the key this node looks up. If you want the seed to survive the round trip through SummaryReader, add a seed entry to your TOML's [_exports] table (or fall back to reading it with a JsonExtractInt on the last output, which is unambiguous). The code's own "Seed Not Found" check is a no-op assert True, so a missing seed doesn't shout.

    Inputs and outputs

    One input: summary (multiline STRING, tooltip "PromptDecode summary."). Five outputs: Positive, Negative, Loaded LoRA name list, Random seed (INT), and Json Formatted Exports (STRING). The three strings and the exports are what you route; a summary paired with this node plus a KSamplerFromString makes a "replay this generation" setup that doesn't need the original prompt file at all.

    Install

    Manager search for the pack, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/morino-kumasan/comfyui-toml-prompt
    

    restart ComfyUI, and that's it - the repo's requirements.txt is empty and this node is pure regex and json. The README's install block is stale (it still says comfyui-utils and clones over SSH); use the HTTPS URL above.

    Where people get burned

    It's a format parser, and the format has to be exact. The regex wants ---- Positive ----, the exports section wants key: value lines. Edit the summary by hand - trim a stray line, rename a heading - and sections silently stop resolving; there's an assert on positive/negative/lora being found, but nothing that tells you which heading you mangled.

    Paste, don't retype. The summaries are long and the value is that they're byte-identical to what PromptDecode produced. Copy the whole block including the exports header, or you lose the settings.

    It doesn't load anything. No model, no LoRA, no sampling. It just parses text and hands you strings - every one of them still has to reach the loader that uses it. It looks like more of a node than it is because the sample workflows wire half a graph off it.

    Categoryutils

    Inputs (1)

    NameTypeDefaultDescription
    summarySTRINGPromptDecode summary.

    Outputs (5)

    NameTypeDescription
    STRINGSTRINGPositive prompt
    STRINGSTRINGNegative prompt
    STRINGSTRINGLoaded LoRA name list
    INTINTRandom seed
    STRINGSTRINGJson Formatted Exports