优化住流程和添加复刻视频页面

This commit is contained in:
Azmat@qq.com
2026-08-26 18:44:03 +08:00
parent 0ee498d807
commit c25060c6c6
30 changed files with 2574 additions and 155 deletions
+18 -3
View File
@@ -894,6 +894,20 @@ class VideoSubmissionStateUnknown(ProviderOutcomeUnknownError):
"""视频提交可能已到达供应商但未拿到可靠任务 ID;禁止自动重提。"""
NO_EMBEDDED_CAPTIONS_REQUIREMENT = (
"【成片硬性规则】画面不得出现字幕、台词字幕、花字、标题、价格贴片、UI 文字或其他后期文字叠加;"
"只保留商品包装上参考图中原有的真实物理文字与标识。旁白和环境音可以保留,但不要把声音转成画面文字。"
)
def enforce_no_embedded_captions(prompt: str) -> str:
"""所有视频入口最终汇入这里,避免某个入口漏传“无字幕”导致模型自行加花字。"""
base = (prompt or "").strip()
if NO_EMBEDDED_CAPTIONS_REQUIREMENT in base:
return base
return f"{base}\n{NO_EMBEDDED_CAPTIONS_REQUIREMENT}".strip()
def execute_routed_video_submit(
*,
task: AITask,
@@ -913,6 +927,7 @@ def execute_routed_video_submit(
"""异步视频只路由“提交”阶段;拿到 Provider 任务 ID 后固定该实际模型轮询。"""
from apps.billing.pricing import quote_video_estimate
prompt = enforce_no_embedded_captions(prompt)
references = list(reference_images or [])
routed_content_items = list(content_items) if content_items is not None else None
pricing_refs = list(pricing_references or [])
@@ -2693,7 +2708,7 @@ def build_storyboard_frame_prompt(project, segment, extra_prompt: str = "") -> s
补充=(("\n" + extra_prompt.strip()) if extra_prompt else ""),
)
cleaned = "\n".join(line for line in rendered.split("\n") if line.strip())
return _apply_storyboard_output_ratio(cleaned, project)
return enforce_no_embedded_captions(_apply_storyboard_output_ratio(cleaned, project))
def build_video_segment_prompt(project, video_segment, scene, refs, user_prompt: str = "") -> str:
@@ -2729,7 +2744,7 @@ def build_video_segment_prompt(project, video_segment, scene, refs, user_prompt:
脚本=(script_text or f"第 {video_segment.sort_order + 1} 段"),
时长=video_segment.target_duration_seconds,
)
return "\n".join(line for line in rendered.split("\n") if line.strip())
return enforce_no_embedded_captions("\n".join(line for line in rendered.split("\n") if line.strip()))
def ensure_storyboard_shots(project) -> list:
@@ -2904,7 +2919,7 @@ def build_storyboard_frame_prompt_refs(project, segment, refs: list[dict], extra
补充=(("\n" + extra_prompt.strip()) if extra_prompt else ""),
)
cleaned = "\n".join(line for line in rendered.split("\n") if line.strip())
return _apply_storyboard_output_ratio(cleaned, project)
return enforce_no_embedded_captions(_apply_storyboard_output_ratio(cleaned, project))
def _is_transient_error(exc: Exception) -> bool: