From 1530d1f8c84eab859e28844d7e6a9df326056366 Mon Sep 17 00:00:00 2001 From: puke <1129090915@qq.com> Date: Sun, 28 Dec 2025 14:56:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81runninghub=E5=B9=B6=E5=8F=91?= =?UTF-8?q?=E9=99=90=E5=88=B6=E5=8F=AF=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.example.yaml | 1 + pixelle_video/config/manager.py | 6 +++++- pixelle_video/config/schema.py | 1 + pixelle_video/pipelines/standard.py | 11 ++++++----- web/components/settings.py | 13 ++++++++++++- web/i18n/locales/en_US.json | 2 ++ web/i18n/locales/zh_CN.json | 2 ++ 7 files changed, 29 insertions(+), 7 deletions(-) diff --git a/config.example.yaml b/config.example.yaml index 5145aa9..f5613ee 100644 --- a/config.example.yaml +++ b/config.example.yaml @@ -24,6 +24,7 @@ comfyui: comfyui_api_key: "" # ComfyUI API key (optional, get from https://platform.comfy.org/profile/api-keys) # Note for Docker users: Use host.docker.internal:8188 (Mac/Windows) or host IP address (Linux) runninghub_api_key: "" # RunningHub API key (required for runninghub workflows) + runninghub_concurrent_limit: 1 # Concurrent execution limit for RunningHub (1-10, default 1 for regular members) # TTS-specific configuration tts: diff --git a/pixelle_video/config/manager.py b/pixelle_video/config/manager.py index 172fddc..9dfb4be 100644 --- a/pixelle_video/config/manager.py +++ b/pixelle_video/config/manager.py @@ -130,6 +130,7 @@ class ConfigManager: "comfyui_url": self.config.comfyui.comfyui_url, "comfyui_api_key": self.config.comfyui.comfyui_api_key, "runninghub_api_key": self.config.comfyui.runninghub_api_key, + "runninghub_concurrent_limit": self.config.comfyui.runninghub_concurrent_limit, "tts": { "default_workflow": self.config.comfyui.tts.default_workflow, }, @@ -147,7 +148,8 @@ class ConfigManager: self, comfyui_url: 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 ): """Set ComfyUI global configuration""" updates = {} @@ -157,6 +159,8 @@ class ConfigManager: updates["comfyui_api_key"] = comfyui_api_key if runninghub_api_key is not None: updates["runninghub_api_key"] = runninghub_api_key + if runninghub_concurrent_limit is not None: + updates["runninghub_concurrent_limit"] = runninghub_concurrent_limit if updates: self.update({"comfyui": updates}) diff --git a/pixelle_video/config/schema.py b/pixelle_video/config/schema.py index 0c45272..1929082 100644 --- a/pixelle_video/config/schema.py +++ b/pixelle_video/config/schema.py @@ -73,6 +73,7 @@ class ComfyUIConfig(BaseModel): comfyui_url: str = Field(default="http://127.0.0.1:8188", description="ComfyUI Server URL") 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_concurrent_limit: int = Field(default=1, ge=1, le=10, description="RunningHub concurrent execution limit (1-10)") tts: TTSSubConfig = Field(default_factory=TTSSubConfig, description="TTS-specific configuration") image: ImageSubConfig = Field(default_factory=ImageSubConfig, description="Image-specific configuration") video: VideoSubConfig = Field(default_factory=VideoSubConfig, description="Video-specific configuration") diff --git a/pixelle_video/pipelines/standard.py b/pixelle_video/pipelines/standard.py index f165d66..a7425c0 100644 --- a/pixelle_video/pipelines/standard.py +++ b/pixelle_video/pipelines/standard.py @@ -50,8 +50,6 @@ from pixelle_video.utils.prompt_helper import build_image_prompt from pixelle_video.services.video import VideoService -# Parallel limit for RunningHub workflows (Call by sequential if set to 1) -RUNNING_HUB_PARALLEL_LIMIT = 1 class StandardPipeline(LinearVideoPipeline): @@ -303,10 +301,13 @@ class StandardPipeline(LinearVideoPipeline): (config.media_workflow and config.media_workflow.startswith("runninghub/")) ) - if is_runninghub and RUNNING_HUB_PARALLEL_LIMIT > 1: - logger.info(f"🚀 Using parallel processing for RunningHub workflows (max {RUNNING_HUB_PARALLEL_LIMIT} concurrent)") + # Get concurrent limit from config (default to 1 for backward compatibility) + runninghub_concurrent_limit = self.core.config.get("comfyui", {}).get("runninghub_concurrent_limit", 1) + + if is_runninghub and runninghub_concurrent_limit > 1: + logger.info(f"🚀 Using parallel processing for RunningHub workflows (max {runninghub_concurrent_limit} concurrent)") - semaphore = asyncio.Semaphore(RUNNING_HUB_PARALLEL_LIMIT) + semaphore = asyncio.Semaphore(runninghub_concurrent_limit) completed_count = 0 async def process_frame_with_semaphore(i: int, frame: StoryboardFrame): diff --git a/web/components/settings.py b/web/components/settings.py index 2d470e0..1a29617 100644 --- a/web/components/settings.py +++ b/web/components/settings.py @@ -179,6 +179,16 @@ def render_advanced_settings(): f"[{tr('settings.comfyui.runninghub_get_api_key')}]" f"(https://www.runninghub{'.cn' if get_language() == 'zh_CN' else '.ai'}/?inviteCode=bozpdlbj)" ) + + # RunningHub concurrent limit + runninghub_concurrent_limit = st.number_input( + tr("settings.comfyui.runninghub_concurrent_limit"), + min_value=1, + max_value=10, + value=comfyui_config.get("runninghub_concurrent_limit", 1), + help=tr("settings.comfyui.runninghub_concurrent_limit_help"), + key="runninghub_concurrent_limit_input" + ) # ==================================================================== # Action Buttons (full width at bottom) @@ -199,7 +209,8 @@ def render_advanced_settings(): config_manager.set_comfyui_config( comfyui_url=comfyui_url if comfyui_url 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) ) # Only save to file if LLM config is valid diff --git a/web/i18n/locales/en_US.json b/web/i18n/locales/en_US.json index f0a0d10..91fb10b 100644 --- a/web/i18n/locales/en_US.json +++ b/web/i18n/locales/en_US.json @@ -195,6 +195,8 @@ "settings.comfyui.runninghub_api_key_help": "Visit https://runninghub.ai to register and get API Key", "settings.comfyui.runninghub_hint": "No local ComfyUI? Use RunningHub Cloud:", "settings.comfyui.runninghub_get_api_key": "Get RunningHub API Key", + "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", "tts.inference_mode": "Synthesis Mode", "tts.mode.local": "Local Synthesis", "tts.mode.comfyui": "ComfyUI Synthesis", diff --git a/web/i18n/locales/zh_CN.json b/web/i18n/locales/zh_CN.json index 001e0a0..3b46835 100644 --- a/web/i18n/locales/zh_CN.json +++ b/web/i18n/locales/zh_CN.json @@ -195,6 +195,8 @@ "settings.comfyui.runninghub_api_key_help": "访问 https://runninghub.ai 注册并获取 API Key", "settings.comfyui.runninghub_hint": "没有本地 ComfyUI?可用 RunningHub 云端:", "settings.comfyui.runninghub_get_api_key": "点此获取 RunningHub API Key", + "settings.comfyui.runninghub_concurrent_limit": "并发限制", + "settings.comfyui.runninghub_concurrent_limit_help": "RunningHub 并发执行数量(1-10),普通会员默认为1,请根据您的会员等级调整", "tts.inference_mode": "合成方式", "tts.mode.local": "本地合成", "tts.mode.comfyui": "ComfyUI 合成",