ComfyUI Node

Configuration

One node to rule them all (and load the knowledge base)

By kunail0804·Created 2 months ago·Updated 2 months ago· 0
Configuration
    • config
    • knowledge_base
    • warnings
    • errors
    analyzer_modelllama3
    analyzer_temperature0.0
    analyzer_max_retries3
    analyzer_timeout300
    resolver_strict_modetrue
    resolver_allow_aliasestrue
    resolver_expansion_enabledtrue
    resolver_max_expansion_depth8
    resolver_include_nsfwfalse
    validator_allow_unknown_fieldsfalse
    prompt_remove_duplicate_tagstrue
    debug_enabledfalse
    debug_levelbasic
    resolver_knowledge_base_version
    semantic_enabledfalse
    semantic_min_similarity0.50
    semantic_backendchar_ngram
    knowledge_base_reload0

    The Configuration node is where the pack's settings live, and it's also your Knowledge Base loader - two jobs folded into one node in version 2.1 because asking users to wire a separate loader node was silly when the Knowledge Base ships inside the package. You drop this node down, and it does two things: it collects every compiler setting you'd ever want to touch into a single config connection, and it reads the ~1.8 MB Danbooru-derived Knowledge Base that ships with the pack and emits it on knowledge_base. From there you wire both into the pipeline.

    It's the node that makes the rest of the pack usable. The Analyzer, Validator, and Resolver each take an optional config input - plug the same Configuration output into all three, and you can change behavior from one place instead of editing a dozen widgets. In earlier versions of this pack the analyzer model was set in two disconnected places; v2 fixed that by centralizing everything here. That's the honest version of "fewer nodes, more sense."

    The inputs that actually matter

    There are a lot of widgets on this node. Beginners should care about roughly five:

    • analyzer_model - which local Ollama model reads your description. Default is llama3; set it to whatever you've actually pulled.
    • analyzer_temperature - default 0, which means "most consistent." This is a determinism-first pack; leave it at 0 unless you have a reason not to.
    • resolver_include_nsfw - off by default, which keeps results safe-for-work. If you're doing explicit stuff, this is the switch.
    • semantic_enabled - the opt-in "closest known tag" fallback for concepts that miss an exact Knowledge Base lookup. Off by default, and it can only return tags that already exist in the Knowledge Base, so it never invents anything.
    • knowledge_base_reload - a counter. Bump it after you edit the Knowledge Base (via the optional browser editor at http://127.0.0.1:8188/scene-compiler/kb) to force a fresh read. The Knowledge Base is cached process-wide so it only loads once, and this is how you tell it "load again."

    The rest - retries, timeout, alias mapping, expansion depth, debug level - are sensible defaults you'll mostly leave alone, and each has a tooltip written in plain English if you're curious.

    Outputs

    • config (COMPILER_CONFIG) - wire into the Analyzer, Validator, and Resolver.
    • knowledge_base (KNOWLEDGE_BASE) - wire into the Resolver. This is the only thing that feeds the Resolver's tag lookup.
    • warnings / errors (STRING) - mostly here so a KB load failure is visible instead of silent.

    Installing and the gotchas

    cd ComfyUI/custom_nodes
    git clone https://github.com/kunail0804/ComfyUI-Scene-Compiler.git
    

    Then restart ComfyUI. The pack's runtime dependency list is remarkably small - just jsonschema>=4.18, on Python 3.11+ - and the Knowledge Base is already in the repo, so there are no heavy model downloads to chase. The only external piece is Ollama for the analyzer stage.

    The trap most people hit: they edit the Knowledge Base, see no change, and assume it's broken. It's not - the load-once cache is doing its job. Bump knowledge_base_reload. The other recurring gotcha is forgetting the analyzer runs whatever model is in this node, so if you renamed your Ollama model, the defaults here (llama3) won't match what you pulled.

    CategoryScene Compiler

    Inputs (18)

    NameTypeDefaultDescription
    analyzer_modelSTRINGllama3Which local Ollama model reads your description (e.g. llama3).
    analyzer_temperatureFLOAT0.00–2How freely the model interprets. 0 = most consistent.
    analyzer_max_retriesINT30–10How many times to retry if the model returns a bad answer.
    analyzer_timeoutINT3001–3600How long to wait for the model, in seconds. The default is generous so the first run (while the model loads) doesn't time out.
    resolver_strict_modeBOOLEANtrueReport concepts not in the Knowledge Base instead of guessing.
    resolver_allow_aliasesBOOLEANtrueMap synonyms to the same tag (e.g. 'girl' = 'female').
    resolver_expansion_enabledBOOLEANtrueAutomatically add related tags (e.g. an outfit's parts).
    resolver_max_expansion_depthINT81–32How far related tags are followed. Higher adds more tags.
    resolver_include_nsfwBOOLEANfalseAllow explicit (NSFW) tags. Off keeps results safe-for-work.
    validator_allow_unknown_fieldsBOOLEANfalseKeep unexpected fields in the scene data. Usually leave off.
    prompt_remove_duplicate_tagsBOOLEANtrueRemove repeated tags from the final prompt. Recommended on.
    debug_enabledBOOLEANfalseTurn on extra logging to troubleshoot.
    debug_levelCOMBObasicHow much detail the logs include.
    resolver_knowledge_base_versionoptSTRINGAdvanced: pin a Knowledge Base version. Empty = default.
    semantic_enabledoptBOOLEANfalseFind the closest known tag when a concept isn't recognized. Off by default; it never invents tags.
    semantic_min_similarityoptFLOAT0.500–1How close a match must be for the closest-tag search.
    semantic_backendoptSTRINGchar_ngramAdvanced: which method the closest-tag search uses.
    knowledge_base_reloadoptINT0Bump this if you edited the Knowledge Base, to reload it.

    Outputs (4)

    NameTypeDescription
    configCOMPILER_CONFIG
    knowledge_baseKNOWLEDGE_BASE
    warningsSTRING
    errorsSTRING