Nodes/ComfyUI_Eclipse/Danbooru Category Apply
ComfyUI Node

Danbooru Category Apply

The validation gate that commits your LLM's Danbooru tag categories

By r-vage·Created 10 months ago·Updated about 23 hours ago· 32
Danbooru Category Apply
    • categorized_text
    • report
    • remaining
    reviewed_text
    batch_token

    Straight talk up front: this node is useless on its own, and that's by design. Danbooru Category Apply is the last link in Eclipse's two-pass LLM categorization chain. Its one job is to take the output of a second LLM pass, check it against a private manifest of what it was supposed to categorize, and atomically commit only the valid tag→category assignments. If you're not running that whole pipeline, you don't need this node - Danbooru Prompt Forge reads the rating corpora directly and works fine without any categorization at all.

    When you are running the full loop, this is the gate that keeps garbage out of your tag index. categorized_tags.txt is what Prompt Forge's categories filter consults, so every bad assignment committed here is bad output you'd otherwise be stuck with.

    How it works

    The node takes exactly two inputs, both forced - you can't type text into them, they must be connected:

    • reviewed_text - the text output of Smart LM Loader #2 (the second-pass reviewer).
    • batch_token - the matching token from Danbooru Corpus Maintenance, which acts as the manifest: which tags, in what order, against what corpus hash, produced under what category rules.

    It then validates the model's JSON against that manifest and applies a unique, ordered subset of the assignments. The interesting part is how tolerant it is of imperfect LLM output without ever being sloppy:

    • A response truncated by up to three trailing } or ] delimiters gets repaired and run through normal validation.
    • If the output cuts off mid-assignment, it commits every complete, manifest-matched assignment before the cutoff and leaves the truncated one pending - no guessing, no invented string endings.
    • The known quirk where a model writes category" (missing the opening quote) is corrected, but only that one.
    • If a model turned long_hair into long hair, it's restored only when the reverse substitution matches one exact manifest tag. Case, punctuation, anything else - rejected.
    • Markdown fences, extra root fields, expired tokens, or category files changed after preparation reject the batch outright.

    The three outputs are categorized_text (list of validated [category] tag lines, one batch's worth each), report (what got applied and what didn't), and remaining (how many general tags are still pending).

    Why the no-progress error is a feature

    Here's the trap that catches people: if the node applies nothing while tags remain pending, it raises an execution error - deliberately - so ComfyUI's Auto Queue stops instead of looping the same rejected batch forever. When you see that, don't blame the node. The fix is your LLM: the output format, the model, or both. Check the report output, fix the model or prompt, and queue again.

    Wiring it up

    Full chain, from Corpus Maintenance:

    1. Maintenance categorization_system_prompt → Loader 1 system_prompt
    2. Maintenance categorization_prompt → Loader 1 user_prompt
    3. Loader 1 text → Loader 2 user_prompt
    4. Maintenance review_system_prompt → Loader 2 system_prompt
    5. Loader 2 textCategory Apply reviewed_text
    6. Maintenance batch_tokenCategory Apply batch_token

    That means you need the separate ComfyUI SmartLLM pack, plus an LLM that's been proven to hold the exact-preserving behavior this demands - the author's baseline is Qwen 3.5 9B; Qwen 3.8 27B works but has been observed replacing underscores with spaces (which this node can partially recover). Smaller or unqualified models should be trialed on a small batch before you process the whole backlog.

    Installing and gotchas

    Same pack for all three Danbooru nodes: ComfyUI Manager → search "Eclipse", or git clone https://github.com/r-vage/ComfyUI_Eclipse custom_nodes/ComfyUI_Eclipse, then restart. Install ComfyUI SmartLLM too. If you're upgrading from the old RvTools_v2 era, Eclipse v4.0.0 removed legacy nodes - migrate old workflows with the built-in Workflow Migration Tool rather than fighting the loader.

    Two final things worth internalizing. First, remaining is your health meter: zero, and the backlog's drained; nonzero, and there's still work queued for the next pass. Second, this node is where "the LLM did a decent job" gets separated from "the LLM did an exactly-correct job" - and for a tag index that feeds your prompt generation, exact is the only kind that matters.

    Category🌒 Eclipse/ Danbooru

    Inputs (2)

    NameTypeDefaultDescription
    reviewed_textSTRINGConnect Smart LM Loader #2 text output.
    batch_tokenSTRINGConnect the matching maintenance-node batch tokens.

    Outputs (3)

    NameTypeDescription
    categorized_textSTRINGValidated [category] tag lines for each accepted batch.
    reportSTRINGValidation/application report.
    remainingINTGeneral tags still pending.