ComfyUI Node

VRGDG_PromptMapJsonFixer

When your prompt map comes back broken, this repairs it

By vrgamegirl19·Created about a year ago·Updated about 7 hours ago· 718
VRGDG_PromptMapJsonFixer
    • fixed_text
    • json_output
    • was_fixed
    • notes
    • prompt_count
    text
    use_srt_filefalse
    srt_file

    LLMs are great at writing scene prompts and terrible at emitting valid JSON. Trailing commas, unescaped quotes, a stray apostrophe blowing up the whole object - if you've had the Qwen node in this pack hand you a prompt map that refuses to parse, you've met the problem this node exists to solve. VRGDG_PromptMapJsonFixer takes broken prompt-map text, repairs it, and validates it against how many scenes you actually need.

    It's a repair-and-check node, not a generator: you feed it whatever the LLM (or a hand-edited file) produced, and it returns clean JSON plus a report of what it had to fix.

    How it works

    Two inputs that matter:

    • text - the prompt-map JSON as text. This is where you paste the LLM's output or wire it in.
    • use_srt_file - the interesting one. Flip it on and the node counts the scene entries in your SRT subtitle file and requires the prompt count to match it. This is the pack's lyric-sync logic: one subtitle = one scene, so if the prompt map has 30 prompts but the song has 34 subtitle entries, the mismatch is exactly the bug you need to catch before rendering 34 scenes' worth of video.
    • srt_file (optional) - the SRT path or raw SRT text, used only when the toggle is on. The pack's workflow gets this from the audio-transcription step.

    Outputs: fixed_text (the repaired JSON as a string), json_output (as real JSON), was_fixed (a boolean - did it have to change anything), notes (what it changed, human-readable), and prompt_count (how many prompts survived the repair).

    The pattern it's part of

    This is the pack's answer to a real failure mode in the music video pipeline: the LLM writes the prompt map, but the transcription step owns the scene count. If those two disagree, either you render scenes with no lyrics, or you drop lyrics with no scene. The fixer is the checkpoint that catches the disagreement before you commit hours of GPU time to a 30-scene render. That's worth emphasizing - a 30-scene music video on a midrange GPU is a multi-hour project, and validating the JSON before you start is cheap insurance.

    Installing it

    It ships with the pack:

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

    restart, or ComfyUI Manager → search vrgamedev. No models needed. The SRT-counting feature is pure text processing.

    Gotchas

    was_fixed is your friend for debugging: if a scene keeps coming out wrong, check whether the fixer rewrote its prompt - sometimes "fixing" a prompt map means the LLM's original intent got mangled. And if use_srt_file is on but the count still won't match, the most likely culprit is an empty trailing subtitle entry, not your JSON. Delete it and re-run.

    CategoryVRGDG/General

    Inputs (3)

    NameTypeDefaultDescription
    textSTRING
    use_srt_fileBOOLEANfalseWhen enabled, count scene entries in the connected SRT file/text and require it to match the prompt count.
    srt_fileoptSTRINGConnect an SRT file path, or raw SRT text. Ignored when Use SRT File is off.

    Outputs (5)

    NameTypeDescription
    fixed_textSTRING
    json_outputJSON
    was_fixedBOOLEAN
    notesSTRING
    prompt_countINT