From bfcaa3358b5c765921697492244eaaa9850b8485 Mon Sep 17 00:00:00 2001 From: bowtiedbluefin <95500901+bowtiedbluefin@users.noreply.github.com> Date: Sat, 8 Nov 2025 00:04:02 -0500 Subject: [PATCH] Add __init__.py for backward compatibility with older ComfyUI versions --- __init__.py | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 __init__.py diff --git a/__init__.py b/__init__.py new file mode 100644 index 0000000..0ee7f0f --- /dev/null +++ b/__init__.py @@ -0,0 +1,69 @@ +""" +ComfyUI AI CustomURL Extension + +Traditional __init__.py for backward compatibility with older ComfyUI versions. +For newer versions, see main.py with comfy_entrypoint(). +""" + +from .main import comfy_entrypoint + +# Try to use the modern API if available +try: + # Modern API - this will be used by newer ComfyUI versions + __all__ = ['comfy_entrypoint'] +except: + pass + +# Legacy support for older ComfyUI versions +try: + from .nodes.text_nodes import TextGenerationNode, TextAdvancedParamsNode + from .nodes.image_nodes import ImageGenerationNode, ImageAdvancedParamsNode + from .nodes.video_nodes import VideoGenerationNode, VideoAdvancedParamsNode + from .nodes.speech_nodes import SpeechGenerationNode, SpeechAdvancedParamsNode + from .nodes.utility_nodes import ImageURLLoaderNode, VideoURLLoaderNode + + # Legacy ComfyUI expects NODE_CLASS_MAPPINGS and NODE_DISPLAY_NAME_MAPPINGS + NODE_CLASS_MAPPINGS = { + "TextGeneration_AICustomURL": TextGenerationNode, + "TextAdvancedParams_AICustomURL": TextAdvancedParamsNode, + "ImageGeneration_AICustomURL": ImageGenerationNode, + "ImageAdvancedParams_AICustomURL": ImageAdvancedParamsNode, + "VideoGeneration_AICustomURL": VideoGenerationNode, + "VideoAdvancedParams_AICustomURL": VideoAdvancedParamsNode, + "SpeechGeneration_AICustomURL": SpeechGenerationNode, + "SpeechAdvancedParams_AICustomURL": SpeechAdvancedParamsNode, + "ImageURLLoader_AICustomURL": ImageURLLoaderNode, + "VideoURLLoader_AICustomURL": VideoURLLoaderNode, + } + + NODE_DISPLAY_NAME_MAPPINGS = { + "TextGeneration_AICustomURL": "Generate Text (AI CustomURL)", + "TextAdvancedParams_AICustomURL": "Text Advanced Parameters", + "ImageGeneration_AICustomURL": "Generate Image (AI CustomURL)", + "ImageAdvancedParams_AICustomURL": "Image Advanced Parameters", + "VideoGeneration_AICustomURL": "Generate Video (AI CustomURL)", + "VideoAdvancedParams_AICustomURL": "Video Advanced Parameters", + "SpeechGeneration_AICustomURL": "Generate Speech (AI CustomURL)", + "SpeechAdvancedParams_AICustomURL": "Speech Advanced Parameters", + "ImageURLLoader_AICustomURL": "Load Image from URL", + "VideoURLLoader_AICustomURL": "Load Video from URL", + } + + __all__ = ['NODE_CLASS_MAPPINGS', 'NODE_DISPLAY_NAME_MAPPINGS', 'comfy_entrypoint'] + + print("=" * 60) + print("AI CustomURL Extension Loaded (Legacy Mode)") + print("=" * 60) + print("Supports: Text, Image, Video, and Speech Generation") + print("Compatible with: OpenAI, Venice.ai, OpenRouter, Together.ai, Ollama") + print("=" * 60) + +except Exception as e: + print(f"Error loading AI CustomURL extension: {e}") + print("The extension requires the comfy_api.latest module.") + print("Please update ComfyUI to a newer version that supports the modern node API.") + + # Provide empty mappings to prevent crashes + NODE_CLASS_MAPPINGS = {} + NODE_DISPLAY_NAME_MAPPINGS = {} +