8bdc39a1ab
CI/CD Pipeline / Check push changed paths (pull_request) Has been skipped
CI/CD Pipeline / Dedup Check - skip PR tests when covered by push pipeline (pull_request) Successful in 2s
CI/CD Pipeline / Check if frontend-only change (pull_request) Successful in 2s
CI/CD Pipeline / Build Staging API Image (pull_request) Has been skipped
CI/CD Pipeline / Build Staging Web Image (pull_request) Has been skipped
CI/CD Pipeline / Build Staging Worker Image (pull_request) Has been skipped
CI/CD Pipeline / Frontend Lint (pull_request) Failing after 1m10s
CI/CD Pipeline / Retag skipped Staging API Image (pull_request) Has been skipped
CI/CD Pipeline / Retag skipped Staging Web Image (pull_request) Has been skipped
CI/CD Pipeline / Retag skipped Staging Worker Image (pull_request) Has been skipped
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Has been skipped
CI/CD Pipeline / PR Build API Image (pull_request) Successful in 1m21s
CI/CD Pipeline / Staging E2E Tests (pull_request) Has been skipped
CI/CD Pipeline / Staging API Integration Tests (pull_request) Has been skipped
CI/CD Pipeline / ACR Image Cleanup (pull_request) Has been skipped
CI/CD Pipeline / Frontend Unit Tests (pull_request) Successful in 1m43s
CI/CD Pipeline / PR Build Web Image (pull_request) Failing after 2m14s
PR Automation / Auto Approve on CI Green (pull_request) Successful in 3m2s
Preview Deploy / Deploy Preview Environment (pull_request) Failing after 4m5s
CI/CD Pipeline / PR Build Worker Image (pull_request) Successful in 6m32s
AI Code Review / AI Code Review (pull_request) Successful in 7m14s
CI/CD Pipeline / Unit Tests (pull_request) Has been cancelled
CI/CD Pipeline / Build Production API Image (pull_request) Has been cancelled
CI/CD Pipeline / Build Production Web Image (pull_request) Has been cancelled
CI/CD Pipeline / Build Production Worker Image (pull_request) Has been cancelled
CI/CD Pipeline / Deploy Production (pull_request) Has been cancelled
CI/CD Pipeline / Validate - Style (pull_request) Has been cancelled
CI/CD Pipeline / Validate - Security (pull_request) Has been cancelled
CI/CD Pipeline / Validate - Python (mypy + alembic) (pull_request) Has been cancelled
CI/CD Pipeline / Production Browser E2E (pull_request) Has been cancelled
CI/CD Pipeline / Canary Release to Production (pull_request) Has been cancelled
CI/CD Pipeline / CI Gate (pull_request) Has been cancelled
CI/CD Pipeline / Integration Tests (pull_request) Has been cancelled
PR Automation / Auto Merge on CI Green + Approved (pull_request) Has been cancelled
- upload.ts: library_id optional, auto ensureDefaultLibrary via getOrCreateDefaultProject - 5 call sites simplified (ViralVideoPage/useVoiceUpload/useBatchCovers/Step6Cover/useVoiceMaterials) - Bug1 (P0): upload_to_oss prefix kwarg → construct storage_key per generation.py pattern - Bug2 (P0): Seedance 404 enhanced logging w/ URL/model/response body + troubleshooting hints - Bug3 (P1): TTS import from services.* → apps.worker.services.* + synthesize fallback - duplicated=true: backend returns existing asset URL in prepare, frontend uses it - CI: ci_staging_deploy.sh auto-clean stale docker-compose.override.yml Refs: #2109
59 lines
2.7 KiB
Python
59 lines
2.7 KiB
Python
from pydantic import BaseModel, Field
|
||
|
||
|
||
class UploadAssetRequest(BaseModel):
|
||
"""素材上传请求(multipart form)"""
|
||
|
||
project_id: str = Field(..., min_length=1, description="项目 ID")
|
||
library_id: str = Field(..., min_length=1, description="素材库 ID")
|
||
file_hash: str = Field(default="", max_length=64, description="文件 MD5 哈希,用于去重检测")
|
||
|
||
|
||
class DirectUploadPrepareRequest(BaseModel):
|
||
project_id: str = Field(..., min_length=1)
|
||
library_id: str = Field(..., min_length=1)
|
||
filename: str = Field(..., min_length=1, max_length=255)
|
||
content_type: str = Field(default="application/octet-stream", min_length=1, max_length=100)
|
||
file_size: int = Field(..., gt=0)
|
||
file_hash: str = Field(default="", max_length=64, description="文件 MD5 哈希,用于去重检测")
|
||
client_upload_id: str = Field(default="", max_length=64, description="客户端幂等 token(同一次上传的重试保持一致)")
|
||
|
||
|
||
class DirectUploadPrepareResponse(BaseModel):
|
||
upload_url: str
|
||
method: str
|
||
storage_key: str
|
||
expires_at: str
|
||
fields: dict[str, str]
|
||
max_size_bytes: int
|
||
duplicated: bool = False
|
||
skip_transfer: bool = False
|
||
asset_id: str = ""
|
||
# duplicated=true 时填充已存在素材的公网 URL,前端可直接用而不必再调 complete
|
||
url: str = Field(default="", description="duplicated=true 时已存在素材的公网 URL")
|
||
|
||
|
||
class DirectUploadCompleteRequest(BaseModel):
|
||
project_id: str = Field(..., min_length=1)
|
||
library_id: str = Field(..., min_length=1)
|
||
storage_key: str = Field(..., min_length=1, max_length=255)
|
||
file_hash: str = Field(default="", max_length=64, description="文件哈希,用于去重检测")
|
||
client_upload_id: str = Field(default="", max_length=64, description="客户端幂等 token(同一次上传的重试保持一致)")
|
||
file_size: int = Field(default=0, ge=0, description="文件大小(字节),用于无 hash 时的兜底去重")
|
||
|
||
|
||
class DirectUploadCompleteResponse(BaseModel):
|
||
storage_key: str
|
||
ingest_job_id: str
|
||
duplicated: bool = Field(default=False, description="是否为重复素材/重复 complete(命中幂等去重)")
|
||
asset_id: str = Field(default="", description="素材 asset_id(重复 complete 时返回已存在记录)")
|
||
url: str = Field(default="", description="Public URL of uploaded file")
|
||
|
||
|
||
class UploadAssetResponse(BaseModel):
|
||
storage_key: str
|
||
ingest_job_id: str
|
||
url: str = Field(..., description="Public URL of uploaded file")
|
||
duplicated: bool = Field(default=False, description="是否为重复素材/重复提交(命中幂等去重)")
|
||
asset_id: str = Field(default="", description="素材 asset_id(重复提交时返回已存在记录)")
|