ComfyUI Node

Scene Parser

Turning an LLM's Wall of Text into Three Usable Prompts

By IIEleven11·Created about a year ago·Updated about a year ago· 7
Scene Parser
    • scene_1
    • scene_2
    • scene_3
    • extracted_constants
    ollama_text
    debug
    scene_constants
    constants_position
    constants_format

    If you've got an LLM happily narrating a scene and you want it broken into three image-ready chunks, this is the node you're looking for. SceneParser is the front door of the FairyTaler pack: it takes text from an Ollama Generate node and splits it into scene_1, scene_2, and scene_3 - three strings you can feed into CLIP encoders and samplers. The whole pack exists to turn roleplay chat (SillyTavern or otherwise) into a three-panel visual, and everything downstream assumes this node did its job.

    How it actually parses

    No AI is involved here. The parsing is plain regex: it looks for Scene 1:, Scene 2:, Scene 3: markers in the LLM output and grabs everything after each one. Because LLMs don't always follow formatting instructions, it has two fallbacks - split on the word "Scene" if the regex misses, then split into paragraphs if that also fails. That's the mechanism, and it's why the format you ask your LLM to use matters so much. The README's example prompt explicitly asks for Scene 1: [description], Scene 2: [description], Scene 3: [description]; stick to that and parsing is near-bulletproof.

    The clever bit is the scene constants system. You feed it a string like 1 girl around 25 years old, at a cabin in the woods, gloomy and country aesthetic, and it injects that into every scene so the three panels at least describe the same world. It can even auto-extract the constants from the LLM output if you tell the LLM to include a Constants: line - that's what extracted_constants is for. Manual scene_constants always wins over the auto-extracted ones.

    The inputs that matter

    • ollama_text - the raw LLM output, wired straight from an Ollama Generate node. This is the only one you can't skip.
    • scene_constants (optional) - the author's framing: without this the model "will do whatever it wants." Include appearance, age, setting, and mood.
    • constants_position - beginning, end, or both. both is maximum nagging, useful when a model keeps drifting mid-generation.
    • constants_format - natural (adds commas, reads like prose), tags (raw), or descriptive (full sentences).

    There's also a debug toggle that prints everything to the console - enable it the first time so you can see exactly what got parsed and what constants got extracted.

    Wiring it up

    scene_1, scene_2, scene_3 (all STRING) feed into whatever encodes prompts in your image model - CLIP Text Encode for SD-class models, or the pack's own Scene to Conditioning node. extracted_constants is informational; you'd have to route it back into a text box to reuse it.

    Installing

    It ships in the ComfyUI-FairyTaler pack, so this installs everything:

    cd ComfyUI/custom_nodes
    git clone https://github.com/IIEleven11/ComfyUI-FairyTaler.git
    

    Restart ComfyUI and the nodes appear under FairyTaler/Storyboard. ComfyUI Manager can also install it by searching "FairyTaler". There's no requirements.txt - the pack only needs torch, numpy, and Pillow, which ComfyUI already ships. No model downloads, no API keys, nothing runs remotely.

    Where people get burned

    Scenes come back empty when the LLM didn't use the Scene N: format - the paragraph fallback only kicks in on blank-line separation, and a solid block of text defeats all three strategies. Also remember this is description-level consistency, the weakest form of character consistency in the game: a constants string keeps the prompt consistent, but it can't keep the face consistent - that's what LoRAs and image-editing are for. And if your output looks random, take the author's own advice and put the word "realistic" in your constants. They weren't kidding.

    CategoryFairyTaler/Storyboard

    Inputs (5)

    NameTypeDefaultDescription
    ollama_textSTRING
    debugCOMBO2 options: enable, disable
    scene_constantsoptSTRING
    constants_positionoptCOMBO3 options: beginning, end, both
    constants_formatoptCOMBO3 options: natural, tags, descriptive

    Outputs (4)

    NameTypeDescription
    scene_1STRING
    scene_2STRING
    scene_3STRING
    extracted_constantsSTRING