From 0b2bd1dd13a3db62f482c2ab8f222eb3ee0c820b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=91=E6=9E=97=5FCyril=20Pilgrim?= Date: Tue, 17 Feb 2026 10:12:05 +0800 Subject: [PATCH] fix(llm_loader): restore self-contained URL mapping Motivation: from nodes.openai_compatible import ProviderRegistry clashed with ComfyUI's own nodes module, causing the LLM_Loader node to fail loading entirely. Implementation: Reverted to a local _BASE_URL_MAPPING dict, keeping the dead import cleanup from the previous refactor. The mapping is now self-contained with no cross-module dependencies. --- nodes/llm_loader.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/nodes/llm_loader.py b/nodes/llm_loader.py index 6ad8e52..f9b831f 100644 --- a/nodes/llm_loader.py +++ b/nodes/llm_loader.py @@ -1,5 +1,18 @@ from typing import Optional -from nodes.openai_compatible import ProviderRegistry + +# Provider URL mapping (self-contained to avoid cross-module import issues with ComfyUI) +_BASE_URL_MAPPING = { + "Qwen/通义千问": "https://dashscope.aliyuncs.com/compatible-mode/v1", + "DeepSeek/深度求索": "https://api.deepseek.com/v1", + "DouBao/豆包": "https://ark.cn-beijing.volces.com/api/v3", + "Spark/星火": "https://spark-api-open.xf-yun.com/v1", + "GLM/智谱清言": "https://open.bigmodel.cn/api/paas/v4/", + "Moonshot/月之暗面": "https://api.moonshot.cn/v1", + "Baichuan/百川": "https://api.baichuan-ai.com/v1", + "MiniMax/MiniMax": "https://api.minimax.chat/v1", + "StepFun/阶跃星辰": "https://api.stepfun.com/v1", + "SenseChat/日日新": "https://api.sensenova.cn/compatible-mode/v1", +} class LLM_Loader: @@ -61,13 +74,11 @@ class LLM_Loader: CATEGORY = "🚦ComfyUI_LLMs_Toolkit/Loader" def generate(self, provider: str, model: str, api_key: str, custom_base_url: str = ""): - # Use ProviderRegistry as single source of truth if provider == "Custom/自定义": actual_base_url = custom_base_url.strip() print(f"[LLMs_Toolkit] 配置加载: Custom URL ({actual_base_url}) / {model}") else: - provider_config = ProviderRegistry.get_provider(provider) - actual_base_url = provider_config.base_url + actual_base_url = _BASE_URL_MAPPING.get(provider, "") print(f"[LLMs_Toolkit] 配置加载: {provider} / {model}") config = {