上传素材管控-历史素材success

This commit is contained in:
2026-07-08 16:25:03 +08:00
parent 657505e63b
commit d085a6d2ec
47 changed files with 5424 additions and 447 deletions
+25 -5
View File
@@ -227,6 +227,7 @@ class ShotReplicateMaterialUpdateRequest(BaseModel):
)
material_image_url: str | None = Field(None, min_length=1, description="素材图片链接,未传则沿用旧值。用于新产品/目标素材图片,来自已有上传接口")
material_image_resource_id: str | None = Field(None, max_length=32, description="可选,拆镜模块上传接口返回的图片 UploadResource.id")
source_project_name: str | None = Field(None, min_length=1, max_length=20, description="视频素材内容项目名称,未传则沿用旧值")
target_project_name: str | None = Field(None, min_length=1, max_length=20, description="生成项目名称,未传则沿用旧值")
core_content_point: str | None = Field(None, min_length=1, max_length=50, description="生成项目核心内容点,最多50字,未传则沿用旧值")
@@ -243,7 +244,7 @@ class ShotReplicateMaterialUpdateRequest(BaseModel):
@model_validator(mode="after")
def _require_at_least_one(self) -> "ShotReplicateMaterialUpdateRequest":
if not any(getattr(self, field) is not None for field in ("material_image_url", "source_project_name", "target_project_name", "core_content_point")):
if not any(getattr(self, field) is not None for field in ("material_image_url", "source_project_name", "target_project_name", "core_content_point", "material_image_resource_id")):
raise ValueError("至少需要传入一个需要修改的字段")
return self
@@ -482,9 +483,11 @@ class ShotReplicateActionOut(BaseModel):
class ShotReplicateDeleteOut(BaseModel):
message: str = Field(..., description="删除结果提示")
project_id: str = Field(..., description="被软删除的总任务项目ID")
project_id: str = Field(..., description="被软删除的内部拆镜复刻 ModuleGenerationProject ID")
deleted: bool = Field(..., description="是否已软删除")
released_size_bytes: int = Field(0, description="本次软删释放的用户容量占用字节数;不删除物理文件")
released_size_bytes: int = Field(0, description="本次软删释放的用户容量占用字节数;UploadResource 真实文件在事务提交后清理")
upload_resource_released: int = Field(0, description="本次标记删除的上传资源数量")
pending_delete_resource_ids: list[str] = Field(default_factory=list, exclude=True, description="内部字段:commit 后待删除真实文件的 UploadResource ID")
class ShotSegmentDeleteOut(BaseModel):
@@ -493,7 +496,20 @@ class ShotSegmentDeleteOut(BaseModel):
task_set_id: str = Field(..., description="所属拆镜总任务集ID")
deleted: bool = Field(..., description="是否已软删除")
deleted_module_project_id: str | None = Field(None, description="联动软删除的拆镜复刻项目ID;没有关联项目时为空")
released_size_bytes: int = Field(0, description="本次释放的用户容量占用字节数;只释放数据账本,不删除物理文件")
released_size_bytes: int = Field(0, description="本次释放的用户容量占用字节数;UploadResource 真实文件在事务提交后清理")
upload_resource_released: int = Field(0, description="本次标记删除的上传资源数量")
pending_delete_resource_ids: list[str] = Field(default_factory=list, exclude=True, description="内部字段:commit 后待删除真实文件的 UploadResource ID")
class ShotTaskSetDeleteOut(BaseModel):
message: str = Field(..., description="删除结果提示")
task_set_id: str = Field(..., description="被软删除的拆镜任务集ID")
deleted: bool = Field(..., description="是否已软删除")
deleted_segment_count: int = Field(0, description="本次软删除的片段数量")
deleted_module_project_count: int = Field(0, description="本次联动软删除的内部复刻项目数量")
released_size_bytes: int = Field(0, description="本次释放的用户容量占用字节数;UploadResource 真实文件在事务提交后清理")
upload_resource_released: int = Field(0, description="本次标记删除的上传资源数量")
pending_delete_resource_ids: list[str] = Field(default_factory=list, exclude=True, description="内部字段:commit 后待删除真实文件的 UploadResource ID")
@@ -568,6 +584,7 @@ class ShotTaskSetCreate(BaseModel):
"example": {
"video_url": "/uploads/2026/06/11/demo.mp4",
"video_duration_seconds": 31.42,
"video_resource_id": "0019...",
"title": "游戏视频拆镜",
"idempotency_key": "frontend-shot-task-001",
}
@@ -576,6 +593,7 @@ class ShotTaskSetCreate(BaseModel):
video_url: str = Field(..., min_length=1, description="已有上传接口返回的视频链接。必须能反解到 storage/uploads 下文件")
video_duration_seconds: float = Field(..., gt=0, description="前端获取的视频时长秒数,允许浮点;后端会用 ffprobe 校验并以后端真实时长为准")
video_resource_id: str | None = Field(None, max_length=32, description="可选,拆镜模块上传接口返回的视频 UploadResource.id;创建任务集后用于绑定资源")
title: str | None = Field(None, max_length=160, description="拆镜总任务标题")
idempotency_key: str | None = Field(None, max_length=64, description="创建总任务幂等键")
@@ -742,6 +760,7 @@ class ShotSegmentReplicationCreateRequest(BaseModel):
"target_project_name": "新产品推广视频",
"core_content_point": "突出产品附近交友和快速脱单",
"material_image_url": "/uploads/2026/06/11/product.png",
"material_image_resource_id": "0019...",
"idempotency_key": "optional-key",
}
}
@@ -750,9 +769,10 @@ class ShotSegmentReplicationCreateRequest(BaseModel):
target_project_name: str = Field(..., min_length=1, max_length=20, description="生成项目名称,最多20字;会写入 module_generation_projects.title 和第1步 material_input")
core_content_point: str = Field(..., min_length=1, max_length=50, description="生成项目核心内容点,最多50字;用于后续图片 AI 提词和视频 AI 提词")
material_image_url: str = Field(..., min_length=1, description="新产品/目标素材图片链接,来自已有上传接口;作为图片生成参考素材")
material_image_resource_id: str | None = Field(None, max_length=32, description="可选,拆镜模块上传接口返回的图片 UploadResource.id;创建复刻项目后用于绑定资源")
idempotency_key: str | None = Field(None, max_length=64, description="创建 ModuleGenerationProject 幂等键;为空时后端可按业务生成或不使用")
@field_validator("target_project_name", "core_content_point", "material_image_url", "idempotency_key", mode="before")
@field_validator("target_project_name", "core_content_point", "material_image_url", "material_image_resource_id", "idempotency_key", mode="before")
@classmethod
def _strip_text(cls, value: str | None) -> str | None:
if value is None: