完成视频复刻和优化

This commit is contained in:
Azmat@qq.com
2026-08-27 11:54:47 +08:00
parent c25060c6c6
commit 51620bf25b
46 changed files with 2575 additions and 663 deletions
+14 -15
View File
@@ -98,7 +98,7 @@ logger = logging.getLogger(__name__)
class QuickCreateInProgress(APIException):
status_code = status.HTTP_409_CONFLICT
default_detail = "该项目正在极速成片中,请到极速成片页查看进度"
default_detail = "该项目正在一键成片中,请到一键成片页查看进度"
default_code = "quick_create_running"
@@ -553,7 +553,7 @@ class ProjectViewSet(TeamScopedViewSetMixin, ModelViewSet):
]
if text_model is None:
return Response(
{"detail": "极速成片需要的豆包 Seed 2.1 Pro 模型未启用,请联系管理员配置"},
{"detail": "一键成片需要的豆包 Seed 2.1 Pro 模型未启用,请联系管理员配置"},
status=status.HTTP_503_SERVICE_UNAVAILABLE,
)
if missing:
@@ -653,7 +653,7 @@ class ProjectViewSet(TeamScopedViewSetMixin, ModelViewSet):
team=team,
created_by=request.user,
product=product,
name=f"{name} · 极速成片",
name=f"{name} · 一键成片",
status=Project.Status.SCRIPTING,
current_stage=ProjectStage.Stage.SCRIPT,
metadata={
@@ -665,7 +665,7 @@ class ProjectViewSet(TeamScopedViewSetMixin, ModelViewSet):
"video_model_config_id": str(video_model.id),
"video_model_name": video_model.name,
"video_model_label": video_model.display_name,
"presentation_format": rec["format"],
"presentation_format": "oral",
"video_structure": rec["structure"],
"persona": rec["persona"],
},
@@ -676,7 +676,7 @@ class ProjectViewSet(TeamScopedViewSetMixin, ModelViewSet):
ProductSellingPoint.objects.create(
product=product,
title=name,
detail="极速成片根据商品名称自动填写",
detail="一键成片根据商品名称自动填写",
sort_order=0,
)
job = QuickCreateJob.objects.create(
@@ -686,7 +686,7 @@ class ProjectViewSet(TeamScopedViewSetMixin, ModelViewSet):
status=QuickCreateJob.Status.QUEUED,
phase=QuickCreateJob.Phase.PRODUCT,
progress=0,
message="等待开始极速成片",
message="等待开始一键成片",
)
try:
@@ -722,7 +722,7 @@ class ProjectViewSet(TeamScopedViewSetMixin, ModelViewSet):
def quick_create_status(self, request, job_id=None):
job = self._quick_job_queryset().filter(id=job_id).first()
if job is None:
return Response({"detail": "极速成片任务不存在"}, status=status.HTTP_404_NOT_FOUND)
return Response({"detail": "一键成片任务不存在"}, status=status.HTTP_404_NOT_FOUND)
from .services.quick_create import recover_quick_create
try:
@@ -736,7 +736,7 @@ class ProjectViewSet(TeamScopedViewSetMixin, ModelViewSet):
def quick_create_cancel(self, request, job_id=None):
job = self._quick_job_queryset().filter(id=job_id).first()
if job is None:
return Response({"detail": "极速成片任务不存在"}, status=status.HTTP_404_NOT_FOUND)
return Response({"detail": "一键成片任务不存在"}, status=status.HTTP_404_NOT_FOUND)
if job.status == QuickCreateJob.Status.SUCCEEDED:
return Response({"detail": "已完成的任务不能取消"}, status=status.HTTP_400_BAD_REQUEST)
from .services.quick_create import cancel_quick_create
@@ -749,7 +749,7 @@ class ProjectViewSet(TeamScopedViewSetMixin, ModelViewSet):
def quick_create_retry(self, request, job_id=None):
job = self._quick_job_queryset().filter(id=job_id).first()
if job is None:
return Response({"detail": "极速成片任务不存在"}, status=status.HTTP_404_NOT_FOUND)
return Response({"detail": "一键成片任务不存在"}, status=status.HTTP_404_NOT_FOUND)
if job.status == QuickCreateJob.Status.SUCCEEDED:
return Response({"detail": "任务已完成"}, status=status.HTTP_400_BAD_REQUEST)
if job.status == QuickCreateJob.Status.CANCELLED:
@@ -808,14 +808,13 @@ class ProjectViewSet(TeamScopedViewSetMixin, ModelViewSet):
"template_outline": render_outline_text({"outline": template.outline, "cta": template.cta}),
}
)
# 套路参数只在模板真有值时覆盖,空值不要把设定卡的智能推荐顶掉
# 旧模板可能存了中文标签(「短剧」),这里归一成 key 再写入 wizard。
# 表现形式已统一为口播;旧模板里的短剧/Vlog 只兼容读取结构,不能覆盖当前规则
raw_format = getattr(template, "presentation_format", "") or ""
raw_structure = getattr(template, "video_structure", "") or ""
if raw_format or raw_structure:
fmt, structure = coerce_template_combo(raw_format, raw_structure)
wizard["presentation_format"] = fmt
_fmt, structure = coerce_template_combo(raw_format, raw_structure)
wizard["video_structure"] = structure
wizard["presentation_format"] = "oral"
persona = coerce_persona(getattr(template, "persona", "") or "")
if persona:
wizard["persona"] = persona
@@ -860,7 +859,7 @@ class ProjectViewSet(TeamScopedViewSetMixin, ModelViewSet):
"""对话式脚本 agent · 流式(SSE)。出稿 + 改稿一体,多模型可选。
请求体:mode(auto|theme|revise)、prompt、model_config_id、selling_point_ids、persona、
base_version_id(改稿)、aspect_ratio、total_duration(15/30/45/60)、
presentation_format(oral|drama|vlog)、video_structure(pain|contrast|review|scene)。
video_structure(pain|contrast|review|scene)。表现形式固定为口播。
响应:text/event-stream,逐帧吐 tool/delta/draft/saved/done/error。"""
project = self.get_object()
mode = str(request.data.get("mode") or "auto")
@@ -870,7 +869,7 @@ class ProjectViewSet(TeamScopedViewSetMixin, ModelViewSet):
# 非法值一律由 agent 侧 coerce 兜底(夹区间/回落默认),这里不做 400,避免生成被参数噪声打断
total_duration = coerce_total_duration(request.data.get("total_duration"))
presentation_format, video_structure = combo_keys(
request.data.get("presentation_format"),
"oral",
request.data.get("video_structure"),
)
wizard = ((project.metadata or {}).get("wizard") if isinstance(project.metadata, dict) else None) or {}