mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2025-08-02 23:14:49 +08:00
Fix ComfyExtension registration not working
This commit is contained in:
@@ -6,7 +6,7 @@ from comfy_api.latest import (
|
|||||||
)
|
)
|
||||||
from typing import Type, TYPE_CHECKING
|
from typing import Type, TYPE_CHECKING
|
||||||
from comfy_api.internal.async_to_sync import create_sync_class
|
from comfy_api.internal.async_to_sync import create_sync_class
|
||||||
from comfy_api.latest import io, ui #noqa: F401
|
from comfy_api.latest import io, ui, ComfyExtension #noqa: F401
|
||||||
|
|
||||||
|
|
||||||
class ComfyAPIAdapter_v0_0_2(ComfyAPI_latest):
|
class ComfyAPIAdapter_v0_0_2(ComfyAPI_latest):
|
||||||
@@ -41,4 +41,5 @@ __all__ = [
|
|||||||
"Input",
|
"Input",
|
||||||
"InputImpl",
|
"InputImpl",
|
||||||
"Types",
|
"Types",
|
||||||
|
"ComfyExtension",
|
||||||
]
|
]
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
import torch
|
import torch
|
||||||
import time
|
import time
|
||||||
from comfy_api.latest import io, ui, _io, ComfyExtension
|
from comfy_api.latest import io, ui, _io
|
||||||
|
from comfy_api.latest import ComfyExtension
|
||||||
import logging # noqa
|
import logging # noqa
|
||||||
import comfy.utils
|
import comfy.utils
|
||||||
import asyncio
|
import asyncio
|
||||||
|
16
nodes.py
16
nodes.py
@@ -30,7 +30,7 @@ import comfy.controlnet
|
|||||||
from comfy.comfy_types import IO, ComfyNodeABC, InputTypeDict, FileLocator
|
from comfy.comfy_types import IO, ComfyNodeABC, InputTypeDict, FileLocator
|
||||||
from comfy_api.internal import register_versions, ComfyAPIWithVersion
|
from comfy_api.internal import register_versions, ComfyAPIWithVersion
|
||||||
from comfy_api.version_list import supported_versions
|
from comfy_api.version_list import supported_versions
|
||||||
from comfy_api.latest import io
|
from comfy_api.latest import io, ComfyExtension
|
||||||
|
|
||||||
import comfy.clip_vision
|
import comfy.clip_vision
|
||||||
|
|
||||||
@@ -2174,7 +2174,7 @@ async def load_custom_node(module_path: str, ignore=set(), module_parent="custom
|
|||||||
extension = await entrypoint()
|
extension = await entrypoint()
|
||||||
else:
|
else:
|
||||||
extension = entrypoint()
|
extension = entrypoint()
|
||||||
if not isinstance(extension, io.ComfyExtension):
|
if not isinstance(extension, ComfyExtension):
|
||||||
logging.warning(f"comfy_entrypoint in {module_path} did not return a ComfyExtension, skipping.")
|
logging.warning(f"comfy_entrypoint in {module_path} did not return a ComfyExtension, skipping.")
|
||||||
return False
|
return False
|
||||||
node_list = await extension.get_node_list()
|
node_list = await extension.get_node_list()
|
||||||
@@ -2189,20 +2189,10 @@ async def load_custom_node(module_path: str, ignore=set(), module_parent="custom
|
|||||||
node_cls.RELATIVE_PYTHON_MODULE = "{}.{}".format(module_parent, get_module_name(module_path))
|
node_cls.RELATIVE_PYTHON_MODULE = "{}.{}".format(module_parent, get_module_name(module_path))
|
||||||
if schema.display_name is not None:
|
if schema.display_name is not None:
|
||||||
NODE_DISPLAY_NAME_MAPPINGS[schema.node_id] = schema.display_name
|
NODE_DISPLAY_NAME_MAPPINGS[schema.node_id] = schema.display_name
|
||||||
|
return True
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.warning(f"Error while calling comfy_entrypoint in {module_path}: {e}")
|
logging.warning(f"Error while calling comfy_entrypoint in {module_path}: {e}")
|
||||||
return False
|
return False
|
||||||
# V3 node definition
|
|
||||||
elif getattr(module, "NODES_LIST", None) is not None:
|
|
||||||
for node_cls in module.NODES_LIST:
|
|
||||||
node_cls: io.ComfyNode
|
|
||||||
schema = node_cls.GET_SCHEMA()
|
|
||||||
if schema.node_id not in ignore:
|
|
||||||
NODE_CLASS_MAPPINGS[schema.node_id] = node_cls
|
|
||||||
node_cls.RELATIVE_PYTHON_MODULE = "{}.{}".format(module_parent, get_module_name(module_path))
|
|
||||||
if schema.display_name is not None:
|
|
||||||
NODE_DISPLAY_NAME_MAPPINGS[schema.node_id] = schema.display_name
|
|
||||||
return True
|
|
||||||
else:
|
else:
|
||||||
logging.warning(f"Skip {module_path} module for custom nodes due to the lack of NODE_CLASS_MAPPINGS or NODES_LIST (need one).")
|
logging.warning(f"Skip {module_path} module for custom nodes due to the lack of NODE_CLASS_MAPPINGS or NODES_LIST (need one).")
|
||||||
return False
|
return False
|
||||||
|
Reference in New Issue
Block a user