From 2ff2798c97ba42d3fffa3299b9efa362bf13d201 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Fri, 14 Aug 2026 14:54:37 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=B0=81=E9=9D=A2?= =?UTF-8?q?=E6=A0=87=E9=A2=98=E5=8F=A0=E5=8A=A0=E6=A0=B9=E5=9B=A0=20-=20cu?= =?UTF-8?q?stom=5Ftitle=20=E6=9C=AA=E4=BC=A0=E5=85=A5=E6=B8=B2=E6=9F=93?= =?UTF-8?q?=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - _render_video 函数签名新增 custom_title 参数 - 函数体内注入 custom_title 到 plan_config 覆盖模板标题 - 调用处传入 task_info.get('custom_title', '') --- apps/worker/worker_app/tasks/generation.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/apps/worker/worker_app/tasks/generation.py b/apps/worker/worker_app/tasks/generation.py index fb0079eb2..e422739e9 100644 --- a/apps/worker/worker_app/tasks/generation.py +++ b/apps/worker/worker_app/tasks/generation.py @@ -1123,6 +1123,7 @@ def _render_video( resolution: str = "", bgm_config: dict | None = None, voice_ids: list[str] | None = None, + custom_title: str = "", ) -> tuple[Path, float]: """渲染视频(含配音混音)。 @@ -1169,6 +1170,20 @@ def _render_video( merged_bgm.get("source", ""), ) + # 用户自定义标题覆盖模板标题(用户指定优先级最高) + if custom_title and custom_title.strip(): + plan_cfg = dict(virtual_plan.config or {}) + title_cfg = dict(plan_cfg.get("title", {}) or {}) + title_cfg["text"] = custom_title.strip() + title_cfg["enabled"] = True + plan_cfg["title"] = title_cfg + virtual_plan.config = plan_cfg + logger.info( + "[task_id=%s] [渲染] 用户自定义标题已注入: title=%s", + task_id, + custom_title[:50], + ) + # 确保输出分辨率配置存在 # 优先级:用户指定 > 模板配置 > 默认 1280x720 # 预览模式:强制 854x480 + 低码率 @@ -1529,6 +1544,7 @@ def generate_video(self, task_id: str) -> dict: resolution=_resolved_resolution, bgm_config=task_info.get("bgm_config", {}), voice_ids=task_info.get("voice_ids", []), + custom_title=task_info.get("custom_title", ""), ) if gen_task: -- 2.54.0