28d3c1d33c
CI/CD Pipeline / Dedup Check - skip PR tests when covered by push pipeline (pull_request) Successful in 3s
CI/CD Pipeline / Check if frontend-only change (pull_request) Successful in 4s
Preview Deploy / Deploy Preview Environment (pull_request) Successful in 2m15s
CI/CD Pipeline / PR Build API Image (pull_request) Successful in 15s
CI/CD Pipeline / Integration Tests (pull_request) Successful in 1m11s
CI/CD Pipeline / PR Build Worker Image (pull_request) Successful in 15s
PR Automation / Auto Approve on CI Green (pull_request) Successful in 2m44s
CI/CD Pipeline / Validate - Python (mypy + alembic) (pull_request) Successful in 3m43s
AI Code Review / AI Code Review (pull_request) Failing after 5m51s
CI/CD Pipeline / Validate - Style (pull_request) Has been cancelled
CI/CD Pipeline / Validate - Security (pull_request) Has been cancelled
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
PR Automation / Auto Merge on CI Green + Approved (pull_request) Has been cancelled
CI/CD Pipeline / ACR Image Cleanup (pull_request) Failing after 303h54m26s
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Failing after 303h57m14s
CI/CD Pipeline / Staging API Integration Tests (pull_request) Failing after 303h54m26s
CI/CD Pipeline / Retag skipped Staging Worker Image (pull_request) Failing after 303h57m32s
CI/CD Pipeline / Retag skipped Staging API Image (pull_request) Failing after 303h57m32s
CI/CD Pipeline / Staging E2E Tests (pull_request) Failing after 303h54m26s
CI/CD Pipeline / Frontend Unit Tests (pull_request) Failing after 303h57m48s
CI/CD Pipeline / Frontend Lint (pull_request) Failing after 303h57m48s
CI/CD Pipeline / Build Staging Web Image (pull_request) Failing after 303h59m50s
CI/CD Pipeline / Build Staging API Image (pull_request) Failing after 303h59m51s
CI/CD Pipeline / Retag skipped Staging Web Image (pull_request) Failing after 303h57m32s
CI/CD Pipeline / Check push changed paths (pull_request) Failing after 304h0m51s
CI/CD Pipeline / PR Build Web Image (pull_request) Failing after 304h31m57s
CI/CD Pipeline / Build Staging Worker Image (pull_request) Failing after 304h34m15s
- check_duplicate() 新增 scope/user_id/duration_sec 参数
scope='user' 跨项目全局查重,时长 ±15% 预过滤
- check_batch_duplicate() 同步新增 scope 参数
- compute_duplicate_rate() 重写为新公式:
duplicate_rate = (frame_match_rate * 0.4 + temporal_coverage_rate * 0.6) * 100
返回 dict: {duplicate_rate, visual_similarity, match_count}
- check_duplicate_task() 改用 scope='user' + 时长预过滤,
计算并写入 duplicate_rate/match_count/visual_similarity
- dedup_helpers.py 同步适配新 dict 返回值和 scope 参数
- GeneratedVideo 新增 match_count/visual_similarity 字段
- Migration 064: generated_videos 表新增两列
- Repository: 新增 list_by_user() 方法
- 56 个相关单测全部通过
75 lines
2.2 KiB
Python
Executable File
75 lines
2.2 KiB
Python
Executable File
from __future__ import annotations
|
|
|
|
from dataclasses import dataclass, field
|
|
from datetime import datetime, timezone
|
|
from typing import Any
|
|
from uuid import uuid4
|
|
|
|
|
|
@dataclass(slots=True)
|
|
class GeneratedVideo:
|
|
id: str
|
|
project_id: str
|
|
generation_task_id: str
|
|
name: str
|
|
file_url: str
|
|
file_size: int
|
|
duration: float
|
|
width: int
|
|
height: int
|
|
fps: float
|
|
user_id: str = ""
|
|
thumbnail_url: str | None = None
|
|
status: str = "completed"
|
|
review_status: str = "pending_review"
|
|
generation_params: dict[str, Any] = field(default_factory=dict)
|
|
video_fingerprint: dict[str, Any] | None = None
|
|
is_duplicate: bool = False
|
|
duplicate_of: str | None = None
|
|
duplicate_rate: float | None = None
|
|
match_count: int = 0
|
|
visual_similarity: float = 0.0
|
|
generated_at: datetime = field(default_factory=lambda: datetime.now(timezone.utc))
|
|
created_at: datetime = field(default_factory=lambda: datetime.now(timezone.utc))
|
|
|
|
@classmethod
|
|
def create(
|
|
cls,
|
|
project_id: str,
|
|
generation_task_id: str,
|
|
name: str,
|
|
file_url: str,
|
|
*,
|
|
user_id: str = "",
|
|
file_size: int = 0,
|
|
duration: float = 0.0,
|
|
width: int = 0,
|
|
height: int = 0,
|
|
fps: float = 0.0,
|
|
thumbnail_url: str | None = None,
|
|
generation_params: dict[str, Any] | None = None,
|
|
) -> "GeneratedVideo":
|
|
if not project_id.strip():
|
|
raise ValueError("project_id cannot be empty")
|
|
if not generation_task_id.strip():
|
|
raise ValueError("generation_task_id cannot be empty")
|
|
if not name.strip():
|
|
raise ValueError("name cannot be empty")
|
|
if not file_url.strip():
|
|
raise ValueError("file_url cannot be empty")
|
|
return cls(
|
|
id=uuid4().hex,
|
|
project_id=project_id.strip(),
|
|
user_id=user_id.strip(),
|
|
generation_task_id=generation_task_id.strip(),
|
|
name=name.strip(),
|
|
file_url=file_url.strip(),
|
|
file_size=file_size,
|
|
duration=duration,
|
|
width=width,
|
|
height=height,
|
|
fps=fps,
|
|
thumbnail_url=thumbnail_url,
|
|
generation_params=generation_params or {},
|
|
)
|