Nodes/ComfyUI-SimpleChat/Anima Prompt Router (Editable)
ComfyUI Node

Anima Prompt Router (Editable)

Let the LLM draft, then you override and lock whatever it keeps changing

By Moeblack·Created 9 months ago·Updated 7 months ago· 8
Anima Prompt Router (Editable)
    • quality_meta_year_safe
    • count
    • character
    • series
    • artist
    • style
    • environment
    • tags
    • neg
    • positive
    • negative
    • vars
    • obj
    • json_text
    • appearance
    json_text
    strip_code_fencetrue
    reset_latchesfalse
    lock_qualityfalse
    lock_countfalse
    lock_characterfalse
    lock_seriesfalse
    lock_artistfalse
    lock_stylefalse
    lock_environmentfalse
    lock_tagsfalse
    lock_negfalse
    override_quality
    override_count
    override_character
    override_series
    override_artist
    override_style
    override_environment
    override_tags
    override_neg
    lock_appearancefalse
    override_appearance

    LLM prompt generators have a nasty habit: you ask for a character, it gives you one, and on the very next run it gives you a different one. Same words in your system prompt, different artist tag, different hair color - because that's what models do. Anima Prompt Router (Editable) is this pack's answer: it parses an Anima-style JSON prompt into its named parts and puts you in charge of which parts actually reach the sampler, with two tools - manual overrides and lock latches.

    What the two tools do

    Think of it as a mixer board for the eight prompt segments (quality/meta/year/safety, count, character, series, artist, style, environment, tags, neg, plus an appearance field).

    • Overrides are just text fields: override_artist, override_style, and so on. Fill one in and it replaces whatever the LLM produced for that segment, every run. This is how you say "nice draft, but the artist is always going to be @xxx, no discussion."
    • Locks are the cleverer bit. Flip lock_artist and the node latches the current artist value - on the next run, even if the JSON brings a new artist, the output keeps the one it latched. It's a sticky "freeze this field" that survives fresh LLM output. reset_latches (default off) clears all of them when you want to thaw the board.

    The node then rebuilds positive and negative from the final parts, so everything downstream stays consistent even though you've surgically edited a JSON you never saw.

    Outputs

    This node is generous with ports: each part comes out individually (quality_meta_year_safe, count, character, series, artist, style, environment, tags, neg, appearance), plus the assembled positive / negative, a vars dict for Mustache templating, the raw parsed obj, and the updated json_text if you want to log or reuse it.

    Why the latch matters in practice

    The realistic workflow is a loop: Chat → LLM JSON → this node → sampler. If you're hunting for the right background, the LLM will keep drifting the character too, and every drift is a wasted render. Lock character and artist, let environment float, and each run now varies only what you're testing. That's the difference between "LLM roulette" and an actual controlled experiment - and it's the reason this node exists rather than you just pasting JSON into Prompt JSON Unpack.

    Installing and gotchas

    cd ComfyUI/custom_nodes
    git clone https://github.com/Moeblack/ComfyUI-SimpleChat
    

    Restart, or grab it via Manager ("ComfyUI-SimpleChat"). Only dependency: aiohttp.

    The gotcha is that latches live in node instance memory. They survive re-executions of the same workflow, but they do not survive saving and reloading the workflow - a fresh node instance starts with an empty latch table, so your carefully pinned artist silently unpins itself after a restart. If that happens, re-check your lock toggles; the lock flag itself is stored in the workflow, but the latched value was in RAM. Also, all the lock_* and override_* toggles only apply to the Anima segment names; if your LLM's JSON uses different keys, those parts come through empty and you'll be overriding everything from scratch.

    CategorySimpleChat/Utils

    Inputs (23)

    NameTypeDefaultDescription
    json_textSTRING
    strip_code_fenceBOOLEANtrue
    reset_latchesBOOLEANfalseClear all locked(latched) values.
    lock_qualityoptBOOLEANfalse
    lock_countoptBOOLEANfalse
    lock_characteroptBOOLEANfalse
    lock_seriesoptBOOLEANfalse
    lock_artistoptBOOLEANfalse
    lock_styleoptBOOLEANfalse
    lock_environmentoptBOOLEANfalse
    lock_tagsoptBOOLEANfalse
    lock_negoptBOOLEANfalse
    override_qualityoptSTRING
    override_countoptSTRING
    override_characteroptSTRING
    override_seriesoptSTRING
    override_artistoptSTRING
    override_styleoptSTRING
    override_environmentoptSTRING
    override_tagsoptSTRING
    override_negoptSTRING
    lock_appearanceoptBOOLEANfalse
    override_appearanceoptSTRING

    Outputs (15)

    NameTypeDescription
    quality_meta_year_safeSTRING
    countSTRING
    characterSTRING
    seriesSTRING
    artistSTRING
    styleSTRING
    environmentSTRING
    tagsSTRING
    negSTRING
    positiveSTRING
    negativeSTRING
    varsSIMPLECHAT_VARS
    objSIMPLECHAT_JSON
    json_textSTRING
    appearanceSTRING