Vendor complete MiniMax H3 upstream packs
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
"""Namespaced registrations for the complete vendored H3 upstream packs.
|
||||
|
||||
The source is kept under ``vendor/`` with its licenses and upstream layout
|
||||
intact. This module is the only integration point: every upstream node gets a
|
||||
DUMAS-prefixed ComfyUI id so the original packs can remain installed without
|
||||
node-id collisions.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import importlib
|
||||
import logging
|
||||
|
||||
|
||||
_PACKAGES = (
|
||||
("vendor.dumas_h3_continuum", "H3 Continuum"),
|
||||
("vendor.dumas_minimax_h3_refmod", "MiniMax H3 RefMod"),
|
||||
("vendor.dumas_h3_refmod_picker", "H3 RefMod Picker"),
|
||||
)
|
||||
|
||||
|
||||
def _load_pack(package_name):
|
||||
try:
|
||||
return importlib.import_module(package_name)
|
||||
except Exception:
|
||||
logging.getLogger("DumasNodes").exception(
|
||||
"Could not load vendored upstream pack %s", package_name,
|
||||
)
|
||||
return None
|
||||
|
||||
|
||||
def _namespaced_mappings():
|
||||
mappings = {}
|
||||
display = {}
|
||||
for package_name, label in _PACKAGES:
|
||||
pack = _load_pack(package_name)
|
||||
if pack is None:
|
||||
continue
|
||||
source_mappings = getattr(pack, "NODE_CLASS_MAPPINGS", {}) or {}
|
||||
source_display = getattr(pack, "NODE_DISPLAY_NAME_MAPPINGS", {}) or {}
|
||||
for node_id, node_class in source_mappings.items():
|
||||
# Keep upstream IDs so the complete upstream web UI and saved
|
||||
# workflows remain functional. The original packs must not also be
|
||||
# installed, otherwise ComfyUI will see duplicate node IDs.
|
||||
mappings[node_id] = node_class
|
||||
original_name = source_display.get(node_id, node_id)
|
||||
display[node_id] = f"DUMAS {label} · {original_name}"
|
||||
return mappings, display
|
||||
|
||||
|
||||
NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS = _namespaced_mappings()
|
||||
Reference in New Issue
Block a user