fix(viral-video): fix 6 E2E bugs — fusion_level alias, concat silent segments, ingest lookup, duplicated URL, TTS voice/format, Seedance first-frame ratio
CI/CD Pipeline / Dedup Check - skip PR tests when covered by push pipeline (pull_request) Successful in 1s
CI/CD Pipeline / Check push changed paths (pull_request) Has been skipped
CI/CD Pipeline / Check if frontend-only change (pull_request) Successful in 1s
CI/CD Pipeline / Frontend Lint (pull_request) Has been skipped
CI/CD Pipeline / Frontend Unit Tests (pull_request) Has been skipped
CI/CD Pipeline / PR Build Web Image (pull_request) Has been skipped
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 / 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 / Staging E2E Tests (pull_request) Has been skipped
CI/CD Pipeline / ACR Image Cleanup (pull_request) Has been skipped
CI/CD Pipeline / Staging API Integration Tests (pull_request) Has been skipped
CI/CD Pipeline / PR Build API Image (pull_request) Successful in 59s
Preview Deploy / Deploy Preview Environment (pull_request) Successful in 2m0s
PR Automation / Auto Approve on CI Green (pull_request) Successful in 3m5s
CI/CD Pipeline / PR Build Worker Image (pull_request) Successful in 4m28s
CI/CD Pipeline / Integration Tests (pull_request) Successful in 6m10s
CI/CD Pipeline / Validate - Python (mypy + alembic) (pull_request) Successful in 6m37s
AI Code Review / AI Code Review (pull_request) Successful in 6m48s
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 / 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 / Validate - Style (pull_request) Has been cancelled
CI/CD Pipeline / Validate - Security (pull_request) Has been cancelled
PR Automation / Auto Merge on CI Green + Approved (pull_request) Has been cancelled

Bug1 (P0): schema accepts 'full_ai' as alias for 'ai_full' (Pydantic field_validator normalizes)
Bug2 (P0): concat_video_files probes each segment audio stream; Seedance gen_audio=False
       segments now marked has_audio=False so concat filter uses aevalsrc silence instead
       of failing with ffmpeg exit 234
Bug3 (P1): find_by_storage_key now queries (storage_key OR file_url) to cover historical
       data where the legacy file_url column held assets/<project>/<date>/... paths
Bug4 (P1): duplicated-hit response no longer accesses non-existent domain Asset.file_url;
       new helper _get_existing_asset_url uses storage_key (fallback file_url) through
       storage_service.get_url()
Bug5 (P1): _step_tts passes job.persona_id as voice_id (default longxiaochun_v3) and
       forces format='mp3' so downstream ffmpeg -map 1:a:0 works regardless of provider
Bug6 (P1): call_video_generation omits ratio param in first-frame (image_url) mode;
       ai_client.video_generation ratio becomes Optional[str] and is omitted from payload
       when None, fixing 400 InvalidParameter from Seedance
This commit is contained in:
xiaoxia
2026-10-01 04:00:12 +08:00
parent 41fe2a96a6
commit dfdcee6b58
7 changed files with 79 additions and 15 deletions
+18 -1
View File
@@ -191,6 +191,23 @@ def _find_duplicate_asset(
return None
def _get_existing_asset_url(existing: Any, storage_service: Any) -> str:
"""安全获取已存在素材的公网 URL,兼容 domain Asset(无 file_url 字段)和 ORM model。"""
# Domain Asset 只有 storage_key 字段;ORM model 有 file_url 但存的也是 storage_key
key = ""
for attr in ("storage_key", "file_url"):
v = getattr(existing, attr, None)
if v:
key = v
break
if not key:
return ""
try:
return storage_service.get_url(key) or ""
except Exception:
return ""
def _create_pending_asset(
asset_repository,
project_id,
@@ -390,7 +407,7 @@ async def prepare_direct_upload(
duplicated=True,
skip_transfer=True,
asset_id=existing.id,
url=existing.file_url or storage_service.get_url(existing.storage_key) or "",
url=_get_existing_asset_url(existing, storage_service),
)
file_id = uuid4().hex[:8]
+4 -1
View File
@@ -8,7 +8,7 @@ from pydantic import BaseModel, Field, field_validator
# ── 枚举常量 ─────────────────────────────────────────────────────────────
VALID_FUSION_LEVELS = ("ai_full", "ai_polish", "user_primary")
VALID_FUSION_LEVELS = ("ai_full", "full_ai", "ai_polish", "user_primary")
VALID_STYLE_STRENGTHS = ("light", "medium", "strict")
VALID_STAGES = (
"image_analysis",
@@ -50,6 +50,9 @@ class CreateViralVideoRequest(BaseModel):
@field_validator("fusion_level")
@classmethod
def _validate_fusion_level(cls, v: str) -> str:
# 兼容前端历史写法 full_ai(等价 ai_full)
if v == "full_ai":
return "ai_full"
if v not in VALID_FUSION_LEVELS:
raise ValueError(f"fusion_level 必须是 {VALID_FUSION_LEVELS} 之一")
return v