新增runninghub的48G显存机器调用支持
This commit is contained in:
@@ -131,6 +131,7 @@ class ConfigManager:
|
|||||||
"comfyui_api_key": self.config.comfyui.comfyui_api_key,
|
"comfyui_api_key": self.config.comfyui.comfyui_api_key,
|
||||||
"runninghub_api_key": self.config.comfyui.runninghub_api_key,
|
"runninghub_api_key": self.config.comfyui.runninghub_api_key,
|
||||||
"runninghub_concurrent_limit": self.config.comfyui.runninghub_concurrent_limit,
|
"runninghub_concurrent_limit": self.config.comfyui.runninghub_concurrent_limit,
|
||||||
|
"runninghub_instance_type": self.config.comfyui.runninghub_instance_type,
|
||||||
"tts": {
|
"tts": {
|
||||||
"default_workflow": self.config.comfyui.tts.default_workflow,
|
"default_workflow": self.config.comfyui.tts.default_workflow,
|
||||||
},
|
},
|
||||||
@@ -149,7 +150,8 @@ class ConfigManager:
|
|||||||
comfyui_url: Optional[str] = None,
|
comfyui_url: Optional[str] = None,
|
||||||
comfyui_api_key: Optional[str] = None,
|
comfyui_api_key: Optional[str] = None,
|
||||||
runninghub_api_key: Optional[str] = None,
|
runninghub_api_key: Optional[str] = None,
|
||||||
runninghub_concurrent_limit: Optional[int] = None
|
runninghub_concurrent_limit: Optional[int] = None,
|
||||||
|
runninghub_instance_type: Optional[str] = None
|
||||||
):
|
):
|
||||||
"""Set ComfyUI global configuration"""
|
"""Set ComfyUI global configuration"""
|
||||||
updates = {}
|
updates = {}
|
||||||
@@ -161,6 +163,9 @@ class ConfigManager:
|
|||||||
updates["runninghub_api_key"] = runninghub_api_key
|
updates["runninghub_api_key"] = runninghub_api_key
|
||||||
if runninghub_concurrent_limit is not None:
|
if runninghub_concurrent_limit is not None:
|
||||||
updates["runninghub_concurrent_limit"] = runninghub_concurrent_limit
|
updates["runninghub_concurrent_limit"] = runninghub_concurrent_limit
|
||||||
|
if runninghub_instance_type is not None:
|
||||||
|
# Empty string means disable (treat as None for storage)
|
||||||
|
updates["runninghub_instance_type"] = runninghub_instance_type if runninghub_instance_type else None
|
||||||
|
|
||||||
if updates:
|
if updates:
|
||||||
self.update({"comfyui": updates})
|
self.update({"comfyui": updates})
|
||||||
|
|||||||
@@ -74,6 +74,7 @@ class ComfyUIConfig(BaseModel):
|
|||||||
comfyui_api_key: Optional[str] = Field(default=None, description="ComfyUI API Key (optional)")
|
comfyui_api_key: Optional[str] = Field(default=None, description="ComfyUI API Key (optional)")
|
||||||
runninghub_api_key: Optional[str] = Field(default=None, description="RunningHub API Key (optional)")
|
runninghub_api_key: Optional[str] = Field(default=None, description="RunningHub API Key (optional)")
|
||||||
runninghub_concurrent_limit: int = Field(default=1, ge=1, le=10, description="RunningHub concurrent execution limit (1-10)")
|
runninghub_concurrent_limit: int = Field(default=1, ge=1, le=10, description="RunningHub concurrent execution limit (1-10)")
|
||||||
|
runninghub_instance_type: Optional[str] = Field(default=None, description="RunningHub instance type (optional, set to 'plus' for 48GB VRAM)")
|
||||||
tts: TTSSubConfig = Field(default_factory=TTSSubConfig, description="TTS-specific configuration")
|
tts: TTSSubConfig = Field(default_factory=TTSSubConfig, description="TTS-specific configuration")
|
||||||
image: ImageSubConfig = Field(default_factory=ImageSubConfig, description="Image-specific configuration")
|
image: ImageSubConfig = Field(default_factory=ImageSubConfig, description="Image-specific configuration")
|
||||||
video: VideoSubConfig = Field(default_factory=VideoSubConfig, description="Video-specific configuration")
|
video: VideoSubConfig = Field(default_factory=VideoSubConfig, description="Video-specific configuration")
|
||||||
|
|||||||
@@ -120,6 +120,10 @@ class PixelleVideoCore:
|
|||||||
kit_config["api_key"] = comfyui_config["comfyui_api_key"]
|
kit_config["api_key"] = comfyui_config["comfyui_api_key"]
|
||||||
if comfyui_config.get("runninghub_api_key"):
|
if comfyui_config.get("runninghub_api_key"):
|
||||||
kit_config["runninghub_api_key"] = comfyui_config["runninghub_api_key"]
|
kit_config["runninghub_api_key"] = comfyui_config["runninghub_api_key"]
|
||||||
|
# Only pass instance_type if it has a non-empty value
|
||||||
|
instance_type = comfyui_config.get("runninghub_instance_type")
|
||||||
|
if instance_type and instance_type.strip():
|
||||||
|
kit_config["runninghub_instance_type"] = instance_type
|
||||||
|
|
||||||
return kit_config
|
return kit_config
|
||||||
|
|
||||||
|
|||||||
@@ -231,6 +231,7 @@ class ComfyBaseService:
|
|||||||
self,
|
self,
|
||||||
comfyui_url: Optional[str] = None,
|
comfyui_url: Optional[str] = None,
|
||||||
runninghub_api_key: Optional[str] = None,
|
runninghub_api_key: Optional[str] = None,
|
||||||
|
runninghub_instance_type: Optional[str] = None,
|
||||||
) -> Dict[str, Any]:
|
) -> Dict[str, Any]:
|
||||||
"""
|
"""
|
||||||
Prepare ComfyKit configuration
|
Prepare ComfyKit configuration
|
||||||
@@ -238,6 +239,7 @@ class ComfyBaseService:
|
|||||||
Args:
|
Args:
|
||||||
comfyui_url: ComfyUI URL (optional, overrides config)
|
comfyui_url: ComfyUI URL (optional, overrides config)
|
||||||
runninghub_api_key: RunningHub API key (optional, overrides config)
|
runninghub_api_key: RunningHub API key (optional, overrides config)
|
||||||
|
runninghub_instance_type: RunningHub instance type (optional, overrides config)
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
ComfyKit configuration dict
|
ComfyKit configuration dict
|
||||||
@@ -262,6 +264,16 @@ class ComfyBaseService:
|
|||||||
if final_rh_key:
|
if final_rh_key:
|
||||||
kit_config["runninghub_api_key"] = final_rh_key
|
kit_config["runninghub_api_key"] = final_rh_key
|
||||||
|
|
||||||
|
# RunningHub instance type (priority: param > global config > env)
|
||||||
|
# Only pass if non-empty value
|
||||||
|
final_instance_type = (
|
||||||
|
runninghub_instance_type
|
||||||
|
or self.global_config.get("runninghub_instance_type")
|
||||||
|
or os.getenv("RUNNINGHUB_INSTANCE_TYPE")
|
||||||
|
)
|
||||||
|
if final_instance_type and final_instance_type.strip():
|
||||||
|
kit_config["runninghub_instance_type"] = final_instance_type
|
||||||
|
|
||||||
logger.debug(f"ComfyKit config: {kit_config}")
|
logger.debug(f"ComfyKit config: {kit_config}")
|
||||||
return kit_config
|
return kit_config
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ dependencies = [
|
|||||||
"fastapi>=0.115.0",
|
"fastapi>=0.115.0",
|
||||||
"uvicorn[standard]>=0.32.0",
|
"uvicorn[standard]>=0.32.0",
|
||||||
"python-multipart>=0.0.12",
|
"python-multipart>=0.0.12",
|
||||||
"comfykit>=0.1.11",
|
"comfykit>=0.1.12",
|
||||||
"beautifulsoup4>=4.14.2",
|
"beautifulsoup4>=4.14.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
8
uv.lock
generated
8
uv.lock
generated
@@ -432,7 +432,7 @@ wheels = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "comfykit"
|
name = "comfykit"
|
||||||
version = "0.1.11"
|
version = "0.1.12"
|
||||||
source = { registry = "https://pypi.org/simple" }
|
source = { registry = "https://pypi.org/simple" }
|
||||||
dependencies = [
|
dependencies = [
|
||||||
{ name = "aiofiles" },
|
{ name = "aiofiles" },
|
||||||
@@ -442,9 +442,9 @@ dependencies = [
|
|||||||
{ name = "pydantic" },
|
{ name = "pydantic" },
|
||||||
{ name = "websockets" },
|
{ name = "websockets" },
|
||||||
]
|
]
|
||||||
sdist = { url = "https://files.pythonhosted.org/packages/2c/c2/55612d8ee85f0f003113b36795ee40c2ce5ea4f3806baa6b056fb88e696a/comfykit-0.1.11.tar.gz", hash = "sha256:1dc96c15da81a1c69a5f42af2f0f156f9574e534ac925476d1e469b02f2736b0", size = 50179 }
|
sdist = { url = "https://files.pythonhosted.org/packages/1b/d3/6213304fae8823441567b00a5e62ea2f9ae229c86e62ad5996df18851511/comfykit-0.1.12.tar.gz", hash = "sha256:129aedbb1966e78f406ab96cc713e5ade089182156a1cafd3c4c79cac4fcd3c9", size = 50671 }
|
||||||
wheels = [
|
wheels = [
|
||||||
{ url = "https://files.pythonhosted.org/packages/c0/e5/9fdd7da9a944fa8ad32f1e7623604d5bbc0a37f8a6d9beda23e51e3e3698/comfykit-0.1.11-py3-none-any.whl", hash = "sha256:d23cf636adc360976f4724cfc5a0f3ef23dd77735c852a1f83f061256a7b9a2e", size = 53286 },
|
{ url = "https://files.pythonhosted.org/packages/d9/e6/c008888d1386cb75ba2fde68b07f45821500e262536039aead9689d335c3/comfykit-0.1.12-py3-none-any.whl", hash = "sha256:30ec8c8368b5b8224a26bb21cdf2240b5aff9938146a76229c079427f7c12421", size = 53697 },
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1697,7 +1697,7 @@ dev = [
|
|||||||
requires-dist = [
|
requires-dist = [
|
||||||
{ name = "beautifulsoup4", specifier = ">=4.14.2" },
|
{ name = "beautifulsoup4", specifier = ">=4.14.2" },
|
||||||
{ name = "certifi", specifier = ">=2025.10.5" },
|
{ name = "certifi", specifier = ">=2025.10.5" },
|
||||||
{ name = "comfykit", specifier = ">=0.1.11" },
|
{ name = "comfykit", specifier = ">=0.1.12" },
|
||||||
{ name = "edge-tts", specifier = "==7.2.1" },
|
{ name = "edge-tts", specifier = "==7.2.1" },
|
||||||
{ name = "fastapi", specifier = ">=0.115.0" },
|
{ name = "fastapi", specifier = ">=0.115.0" },
|
||||||
{ name = "fastmcp", specifier = ">=2.0.0" },
|
{ name = "fastmcp", specifier = ">=2.0.0" },
|
||||||
|
|||||||
@@ -180,15 +180,35 @@ def render_advanced_settings():
|
|||||||
f"(https://www.runninghub{'.cn' if get_language() == 'zh_CN' else '.ai'}/?inviteCode=bozpdlbj)"
|
f"(https://www.runninghub{'.cn' if get_language() == 'zh_CN' else '.ai'}/?inviteCode=bozpdlbj)"
|
||||||
)
|
)
|
||||||
|
|
||||||
# RunningHub concurrent limit
|
# RunningHub concurrent limit and instance type (in one row)
|
||||||
runninghub_concurrent_limit = st.number_input(
|
limit_col, instance_col = st.columns(2)
|
||||||
tr("settings.comfyui.runninghub_concurrent_limit"),
|
with limit_col:
|
||||||
min_value=1,
|
runninghub_concurrent_limit = st.number_input(
|
||||||
max_value=10,
|
tr("settings.comfyui.runninghub_concurrent_limit"),
|
||||||
value=comfyui_config.get("runninghub_concurrent_limit", 1),
|
min_value=1,
|
||||||
help=tr("settings.comfyui.runninghub_concurrent_limit_help"),
|
max_value=10,
|
||||||
key="runninghub_concurrent_limit_input"
|
value=comfyui_config.get("runninghub_concurrent_limit", 1),
|
||||||
)
|
help=tr("settings.comfyui.runninghub_concurrent_limit_help"),
|
||||||
|
key="runninghub_concurrent_limit_input"
|
||||||
|
)
|
||||||
|
with instance_col:
|
||||||
|
# Check if instance type is "plus" (48G VRAM enabled)
|
||||||
|
current_instance_type = comfyui_config.get("runninghub_instance_type") or ""
|
||||||
|
is_plus_enabled = current_instance_type == "plus"
|
||||||
|
# Instance type options with i18n
|
||||||
|
instance_options = [
|
||||||
|
tr("settings.comfyui.runninghub_instance_24g"),
|
||||||
|
tr("settings.comfyui.runninghub_instance_48g"),
|
||||||
|
]
|
||||||
|
runninghub_instance_type_display = st.selectbox(
|
||||||
|
tr("settings.comfyui.runninghub_instance_type"),
|
||||||
|
options=instance_options,
|
||||||
|
index=1 if is_plus_enabled else 0,
|
||||||
|
help=tr("settings.comfyui.runninghub_instance_type_help"),
|
||||||
|
key="runninghub_instance_type_input"
|
||||||
|
)
|
||||||
|
# Convert display value back to actual value
|
||||||
|
runninghub_48g_enabled = runninghub_instance_type_display == tr("settings.comfyui.runninghub_instance_48g")
|
||||||
|
|
||||||
# ====================================================================
|
# ====================================================================
|
||||||
# Action Buttons (full width at bottom)
|
# Action Buttons (full width at bottom)
|
||||||
@@ -206,11 +226,14 @@ def render_advanced_settings():
|
|||||||
config_manager.set_llm_config(llm_api_key, llm_base_url, llm_model)
|
config_manager.set_llm_config(llm_api_key, llm_base_url, llm_model)
|
||||||
|
|
||||||
# Save ComfyUI configuration (optional fields, always save what's provided)
|
# Save ComfyUI configuration (optional fields, always save what's provided)
|
||||||
|
# Convert checkbox to instance type: True -> "plus", False -> ""
|
||||||
|
instance_type = "plus" if runninghub_48g_enabled else ""
|
||||||
config_manager.set_comfyui_config(
|
config_manager.set_comfyui_config(
|
||||||
comfyui_url=comfyui_url if comfyui_url else None,
|
comfyui_url=comfyui_url if comfyui_url else None,
|
||||||
comfyui_api_key=comfyui_api_key if comfyui_api_key else None,
|
comfyui_api_key=comfyui_api_key if comfyui_api_key else None,
|
||||||
runninghub_api_key=runninghub_api_key if runninghub_api_key else None,
|
runninghub_api_key=runninghub_api_key if runninghub_api_key else None,
|
||||||
runninghub_concurrent_limit=int(runninghub_concurrent_limit)
|
runninghub_concurrent_limit=int(runninghub_concurrent_limit),
|
||||||
|
runninghub_instance_type=instance_type
|
||||||
)
|
)
|
||||||
|
|
||||||
# Only save to file if LLM config is valid
|
# Only save to file if LLM config is valid
|
||||||
|
|||||||
@@ -197,6 +197,10 @@
|
|||||||
"settings.comfyui.runninghub_get_api_key": "Get RunningHub API Key",
|
"settings.comfyui.runninghub_get_api_key": "Get RunningHub API Key",
|
||||||
"settings.comfyui.runninghub_concurrent_limit": "Concurrent Limit",
|
"settings.comfyui.runninghub_concurrent_limit": "Concurrent Limit",
|
||||||
"settings.comfyui.runninghub_concurrent_limit_help": "RunningHub concurrent execution limit (1-10), default is 1 for regular members, adjust based on your membership level",
|
"settings.comfyui.runninghub_concurrent_limit_help": "RunningHub concurrent execution limit (1-10), default is 1 for regular members, adjust based on your membership level",
|
||||||
|
"settings.comfyui.runninghub_instance_type": "Machine Spec",
|
||||||
|
"settings.comfyui.runninghub_instance_type_help": "Select RunningHub machine spec, 48G VRAM is suitable for large models or high-resolution generation (requires membership support)",
|
||||||
|
"settings.comfyui.runninghub_instance_24g": "24G VRAM",
|
||||||
|
"settings.comfyui.runninghub_instance_48g": "48G VRAM",
|
||||||
"tts.inference_mode": "Synthesis Mode",
|
"tts.inference_mode": "Synthesis Mode",
|
||||||
"tts.mode.local": "Local Synthesis",
|
"tts.mode.local": "Local Synthesis",
|
||||||
"tts.mode.comfyui": "ComfyUI Synthesis",
|
"tts.mode.comfyui": "ComfyUI Synthesis",
|
||||||
|
|||||||
@@ -197,6 +197,10 @@
|
|||||||
"settings.comfyui.runninghub_get_api_key": "点此获取 RunningHub API Key",
|
"settings.comfyui.runninghub_get_api_key": "点此获取 RunningHub API Key",
|
||||||
"settings.comfyui.runninghub_concurrent_limit": "并发限制",
|
"settings.comfyui.runninghub_concurrent_limit": "并发限制",
|
||||||
"settings.comfyui.runninghub_concurrent_limit_help": "RunningHub 并发执行数量(1-10),普通会员默认为1,请根据您的会员等级调整",
|
"settings.comfyui.runninghub_concurrent_limit_help": "RunningHub 并发执行数量(1-10),普通会员默认为1,请根据您的会员等级调整",
|
||||||
|
"settings.comfyui.runninghub_instance_type": "机器规格",
|
||||||
|
"settings.comfyui.runninghub_instance_type_help": "选择 RunningHub 机器规格,48G 显存适用于大模型或高分辨率生成(需要会员支持)",
|
||||||
|
"settings.comfyui.runninghub_instance_24g": "24G 显存",
|
||||||
|
"settings.comfyui.runninghub_instance_48g": "48G 显存",
|
||||||
"tts.inference_mode": "合成方式",
|
"tts.inference_mode": "合成方式",
|
||||||
"tts.mode.local": "本地合成",
|
"tts.mode.local": "本地合成",
|
||||||
"tts.mode.comfyui": "ComfyUI 合成",
|
"tts.mode.comfyui": "ComfyUI 合成",
|
||||||
|
|||||||
Reference in New Issue
Block a user