Nodes/VRGameDevGirl Video Enhancement Nodes/VRGDG_SaveTextAdvancedConcat
ComfyUI Node

VRGDG_SaveTextAdvancedConcat

The text-saver that grows a JSON list as you go

By vrgamegirl19·Created about a year ago·Updated about 7 hours ago· 718
VRGDG_SaveTextAdvancedConcat
    • text
    • file_path
    • json
    • json_string
    folder_namestory
    file_namestory
    overwritefalse
    concatfalse
    text
    trigger0

    VRGDG_SaveTextAdvancedConcat is VRGDG_SaveTextAdvanced with an accumulation mode bolted on. Same folder_name, file_name, text, and trigger inputs - but there's a new concat boolean and the output side grows a json and a json_string. When concat is on, each run appends to the file instead of replacing it, and it tracks what you've accumulated as a JSON array. It's the node you use when a workflow generates pieces of a story one at a time and needs them collected into one growing structure.

    How it works

    Required inputs:

    • folder_name / file_name - where it writes (both default to story, so name them or two of these will collide).
    • overwrite - note this defaults to false here, unlike the plain Advanced node. The default posture is "don't clobber," because this node is built for accumulation.
    • concat - the switch that makes it accumulate. Off, it behaves like the plain saver: write the text, done. On, it appends and maintains the running JSON array.
    • text - the chunk to add.
    • trigger - the integer "run it now" pedal. Bump it to force an append even when the text didn't change.

    Outputs: text and file_path as before, plus json (the accumulated entries as a real JSON object you can wire into a JSON-consuming node) and json_string (the same thing as text, for when you want to eyeball it or pass it to something that only reads strings).

    The pattern in practice: a storyboard loop runs N times, each pass generates one scene's worth of data, and this node appends each chunk into a single JSON array that the final assembly stage reads. You get persistence and structure - the file on disk is your record, the json output is the live view.

    The one trap

    The overwrite default being false plus concat existing is a recipe for stale data. If you've run the workflow before, the file already has last run's entries, and concat will happily build a new run on top of old ones. When you want a clean slate, that's what overwrite is for - or delete the file. People hit "my storyboard has duplicates" and it's almost always last run's data still sitting in the file.

    Install

    Standard pack install:

    cd ComfyUI/custom_nodes
    git clone https://github.com/vrgamegirl19/comfyui-vrgamedevgirl
    

    or ComfyUI Manager → "vrgamedev" → restart, then the pack's requirements.txt (kornia, librosa, imageio) installs with it - on Windows portable, run it from python_embeded.

    This is a workflow node, not a general-purpose one. If you're not collecting chunks of story data into a list, the plain SaveTextAdvanced is simpler. If you are, though, this saves you the whole "read the file, parse it, append, rewrite it" rigmarole that you'd otherwise be building by hand.

    CategoryVRGDG/General

    Inputs (6)

    NameTypeDefaultDescription
    folder_nameSTRINGstory
    file_nameSTRINGstory
    overwriteBOOLEANfalse
    concatBOOLEANfalse
    textSTRING
    triggerINT00–18446744073709550000

    Outputs (4)

    NameTypeDescription
    textSTRING
    file_pathSTRING
    jsonJSON
    json_stringSTRING