Remote LLM settings and secrets, the response cache, LUT working catalogs and channel selection, and the LoRA header cache now live below user/__bv_nodepack/, which ComfyUI never serves through /userdata. Files from the public user/default/bv_nodepack/ tree are migrated once at startup: verified copy, then removal, never overwriting private state. Without the System User API the pack fails closed: no public fallback, API-key storage and custom bearer providers refuse with a clear message, LUT catalogs are served from the bundled files read-only, caches stay in memory. Fixed-catalog and local providers keep working. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
73 lines
2.3 KiB
Python
73 lines
2.3 KiB
Python
import importlib
|
|
from pathlib import Path
|
|
|
|
NODE_CLASS_MAPPINGS = {}
|
|
NODE_DISPLAY_NAME_MAPPINGS = {}
|
|
|
|
WEB_DIRECTORY = "./js"
|
|
|
|
# Runs before any module touches runtime storage: moves trusted files out of the
|
|
# HTTP-served user/default tree into ComfyUI's private System User directory.
|
|
try:
|
|
from .py.util.user_storage import run_startup_migration
|
|
|
|
run_startup_migration()
|
|
except Exception as error:
|
|
print(f"BV Node Pack: private storage check failed: {error}")
|
|
|
|
try:
|
|
from .py.util.completion import routes as _completion_routes # noqa: F401
|
|
except Exception as error:
|
|
print(f"BV Node Pack: completion API unavailable: {error}")
|
|
|
|
try:
|
|
from .py.util import remote_llm_routes as _remote_llm_routes # noqa: F401
|
|
except Exception as error:
|
|
print(f"BV Node Pack: remote LLM settings API unavailable: {error}")
|
|
|
|
try:
|
|
from .py.util import detector_routes as _detector_routes # noqa: F401
|
|
except Exception as error:
|
|
print(f"BV Node Pack: detector model API unavailable: {error}")
|
|
|
|
try:
|
|
from .py.util import lora_routes as _lora_routes # noqa: F401
|
|
except Exception as error:
|
|
print(f"BV Node Pack: LoRA catalog API unavailable: {error}")
|
|
|
|
try:
|
|
from .py.util import lut_routes as _lut_routes # noqa: F401
|
|
from .py.util.lut_catalog import start_lut_catalog_refresh
|
|
|
|
start_lut_catalog_refresh()
|
|
except Exception as error:
|
|
print(f"BV Node Pack: LUT catalog API unavailable: {error}")
|
|
|
|
|
|
def get_ext_dir(subpath=None, mkdir=False):
|
|
root = Path(__file__).parent
|
|
path = root / subpath if subpath else root
|
|
path = path.resolve()
|
|
|
|
if mkdir:
|
|
path.mkdir(parents=True, exist_ok=True)
|
|
return path
|
|
|
|
|
|
nodes_dir = get_ext_dir("py/nodes")
|
|
|
|
if nodes_dir.exists():
|
|
for file in nodes_dir.glob("*.py"):
|
|
if file.name == "__init__.py":
|
|
continue
|
|
|
|
module_name = f".py.nodes.{file.stem}"
|
|
try:
|
|
imported_module = importlib.import_module(module_name, __name__)
|
|
NODE_CLASS_MAPPINGS.update(getattr(imported_module, "NODE_CLASS_MAPPINGS", {}))
|
|
NODE_DISPLAY_NAME_MAPPINGS.update(getattr(imported_module, "NODE_DISPLAY_NAME_MAPPINGS", {}))
|
|
except Exception as e:
|
|
print(f"Failed to load module {module_name}: {e}")
|
|
|
|
__all__ = ["NODE_CLASS_MAPPINGS", "NODE_DISPLAY_NAME_MAPPINGS", "WEB_DIRECTORY"]
|