added resources module to get models and metadata

This commit is contained in:
donny committed 2026-01-03 17:43:10 -07:00
1 parent 6711e006c1
commit 7d2b95df19
3 files changed
+368

No files matched your search

+20
View File
@@ -2,6 +2,7 @@ from server import PromptServer
from .progress import add_progress_hook
from .routes import SetupRoutes
from .workflows import *
from . import resources
from io import BytesIO
import json
@@ -45,5 +46,24 @@ add_progress_hook(my_progress_callback)
# Register API routes
SetupRoutes(PromptServer.instance)
# Optional: Index all new models at startup (set to True to enable)
AUTO_INDEX_ON_STARTUP = True
if AUTO_INDEX_ON_STARTUP:
import threading
def index_on_startup():
print("[ImageLab] Starting background indexing of new models...")
try:
indexed = resources.index_all_new_models()
if indexed:
print(f"[ImageLab] Indexed models: {indexed}")
else:
print("[ImageLab] No new models to index")
except Exception as e:
print(f"[ImageLab] Error during startup indexing: {e}")
# Run in background thread to not block startup
threading.Thread(target=index_on_startup, daemon=True).start()
NODE_CLASS_MAPPINGS = {}
NODE_DISPLAY_NAME_MAPPINGS = {}