mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-03-22 05:32:12 -03:00
Bug fixes: - Add null guards for base_models_roots/embeddings_roots in backup cleanup - Fix null-safety initialization of extra_unet_roots Formatting: - Apply consistent code style across Python files - Fix line wrapping, quote consistency, and trailing commas - Add type ignore comments for dynamic/platform-specific code
37 lines
1.1 KiB
Python
37 lines
1.1 KiB
Python
import os
|
|
import logging
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
# Check if running in standalone mode
|
|
standalone_mode = (
|
|
os.environ.get("LORA_MANAGER_STANDALONE", "0") == "1"
|
|
or os.environ.get("HF_HUB_DISABLE_TELEMETRY", "0") == "0"
|
|
)
|
|
|
|
if not standalone_mode:
|
|
from .metadata_hook import MetadataHook
|
|
from .metadata_registry import MetadataRegistry
|
|
|
|
def init():
|
|
# Install hooks to collect metadata during execution
|
|
MetadataHook.install()
|
|
|
|
# Initialize registry
|
|
registry = MetadataRegistry()
|
|
|
|
logger.info("ComfyUI Metadata Collector initialized")
|
|
|
|
def get_metadata(prompt_id=None): # type: ignore[no-redef]
|
|
"""Helper function to get metadata from the registry"""
|
|
registry = MetadataRegistry()
|
|
return registry.get_metadata(prompt_id)
|
|
else:
|
|
# Standalone mode - provide dummy implementations
|
|
def init():
|
|
logger.info("ComfyUI Metadata Collector disabled in standalone mode")
|
|
|
|
def get_metadata(prompt_id=None): # type: ignore[no-redef]
|
|
"""Dummy implementation for standalone mode"""
|
|
return {}
|