feat(assets): 素材余量角标 + Step2 过滤已用尽素材 (#1548)
CI/CD Pipeline / Check if frontend-only change (pull_request) Successful in 4m26s
CI/CD Pipeline / Check push changed paths (push) Successful in 4m27s
CI/CD Pipeline / Validate - Migration (alembic) (push) Successful in 5m34s
CI/CD Pipeline / Validate - Type Check (mypy) (push) Successful in 5m58s
CI/CD Pipeline / Validate - Type Check (mypy) (pull_request) Successful in 6m5s
CI/CD Pipeline / Validate - Migration (alembic) (pull_request) Successful in 6m9s
CI/CD Pipeline / Frontend Unit Tests (push) Successful in 7m19s
CI/CD Pipeline / PR Build API Image (pull_request) Successful in 1m42s
CI/CD Pipeline / PR Build Worker Image (pull_request) Successful in 1m40s
Preview Deploy / Deploy Preview Environment (pull_request) Successful in 3m33s
CI/CD Pipeline / Build Staging Web Image (push) Successful in 2m4s
CI/CD Pipeline / Retag skipped Staging API Image (push) Successful in 45s
CI/CD Pipeline / Retag skipped Staging Worker Image (push) Successful in 46s
PR Automation / Auto Approve on CI Green (pull_request) Successful in 4m59s
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (push) Successful in 58s
CI/CD Pipeline / Validate - Code Quality (pull_request) Successful in 10m9s
CI/CD Pipeline / Validate - Code Quality (push) Successful in 10m22s
AI Code Review / AI Code Review (pull_request) Successful in 8m12s
CI/CD Pipeline / ACR Image Cleanup (push) Successful in 2m55s
CI/CD Pipeline / Staging API Integration Tests (push) Successful in 4m35s
CI/CD Pipeline / Staging E2E Tests (push) Successful in 5m1s
CI/CD Pipeline / Integration Tests (pull_request) Successful in 5m17s
CI/CD Pipeline / Integration Tests (push) Successful in 5m10s
CI/CD Pipeline / Unit Tests (push) Successful in 16m2s
CI/CD Pipeline / Unit Tests (pull_request) Successful in 11m29s
CI/CD Pipeline / CI Gate (pull_request) Successful in 23s
CI/CD Pipeline / Production Browser E2E (pull_request) Failing after 421h42m5s
CI/CD Pipeline / Canary Release to Production (pull_request) Failing after 421h42m5s
CI/CD Pipeline / Build Production Worker Image (pull_request) Failing after 421h42m6s
CI/CD Pipeline / Build Production Web Image (pull_request) Failing after 421h42m7s
CI/CD Pipeline / Production Browser E2E (push) Failing after 421h43m31s
CI/CD Pipeline / Build Production API Image (pull_request) Failing after 421h42m7s
CI/CD Pipeline / Deploy Production (push) Failing after 421h43m31s
CI/CD Pipeline / Build Production Worker Image (push) Failing after 421h43m32s
CI/CD Pipeline / Build Production Web Image (push) Failing after 421h43m32s
CI/CD Pipeline / Build Production API Image (push) Failing after 421h43m32s
CI/CD Pipeline / Retag skipped Staging Web Image (push) Failing after 421h51m31s
CI/CD Pipeline / Staging API Integration Tests (pull_request) Failing after 421h52m12s
CI/CD Pipeline / PR Build Web Image (pull_request) Failing after 421h53m18s
CI/CD Pipeline / ACR Image Cleanup (pull_request) Failing after 421h53m20s
CI/CD Pipeline / Retag skipped Staging Web Image (pull_request) Failing after 421h53m26s
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Failing after 421h53m22s
CI/CD Pipeline / Retag skipped Staging API Image (pull_request) Failing after 421h53m28s
CI/CD Pipeline / Build Staging Worker Image (push) Failing after 421h53m34s
CI/CD Pipeline / Frontend Unit Tests (pull_request) Failing after 421h53m30s
CI/CD Pipeline / Build Staging Worker Image (pull_request) Failing after 421h54m51s
CI/CD Pipeline / Frontend Lint (pull_request) Failing after 421h53m32s
PR Automation / Auto Merge on CI Green + Approved (pull_request) Failing after 421h55m8s
CI/CD Pipeline / Check push changed paths (pull_request) Failing after 421h57m24s
CI/CD Pipeline / Build Staging API Image (push) Failing after 421h53m38s
CI/CD Pipeline / PR Build Worker Image (push) Failing after 421h59m29s
CI/CD Pipeline / Build Staging Web Image (pull_request) Failing after 421h54m53s
CI/CD Pipeline / PR Build API Image (push) Failing after 421h59m33s
CI/CD Pipeline / Build Staging API Image (pull_request) Failing after 421h54m55s
CI/CD Pipeline / Frontend Lint (push) Failing after 421h59m35s
CI/CD Pipeline / Check if frontend-only change (push) Failing after 421h59m36s
CI/CD Pipeline / Deploy Production (pull_request) Failing after 422h16m11s
CI/CD Pipeline / Canary Release to Production (push) Failing after 422h17m36s
CI/CD Pipeline / CI Gate (push) Failing after 422h17m37s
CI/CD Pipeline / Staging E2E Tests (pull_request) Failing after 422h26m19s
CI/CD Pipeline / Retag skipped Staging Worker Image (pull_request) Failing after 422h27m29s
CI/CD Pipeline / PR Build Web Image (push) Failing after 422h33m36s

Co-authored-by: xiaoxia <dev@xiaoxiajianji.com>
Co-committed-by: xiaoxia <dev@xiaoxiajianji.com>
This commit was merged in pull request #1548.
This commit is contained in:
2026-08-30 01:26:00 +08:00
committed by auto-approve-bot
parent 6422472ef3
commit 652bbfe12b
13 changed files with 333 additions and 110 deletions
+4
View File
@@ -20,6 +20,10 @@ export type {
// 素材诊断
export { getAssetDiagnosis } from "./diagnosis"
// 素材余量/可用性判断
export { isAssetUsable } from "./usage"
export type { AssetUsageLike } from "./usage"
// 素材库
export {
getAssetLibraries,
+4
View File
@@ -40,6 +40,10 @@ export interface AssetItem {
thumbnail_url?: string
/** 时长(秒),视频/音频素材由后端从 metadata 提取到顶层 */
duration?: number
/** 已切片段占用时长占比(0~1,后端片段重复率控制机制返回;字段缺失视为未统计) */
used_ratio?: number | null
/** 是否已彻底用尽(无新区间且历史区间复用次数均达上限);false 的素材不参与生成选片 */
usable?: boolean | null
status?: string
classification_status?: AssetClassificationStatus | null
quality_score?: number | null
+18
View File
@@ -0,0 +1,18 @@
/**
* 素材余量/可用性判断
* 后端片段重复率控制机制(任意两条成片画面重复率 ≤15%)上线后,
* 素材列表会附加 usable / used_ratio 字段。字段未上线前一律按可用处理。
*/
/** 仅依赖素材余量相关字段的最小结构,api 层与 pages 层 AssetItem 均可传入 */
export interface AssetUsageLike {
usable?: boolean | null
used_ratio?: number | null
}
/**
* 素材是否仍可参与生成选片。
* usable === false 表示已彻底用尽(无新区间且复用次数全部达上限);
* 字段缺失(undefined/null)时降级为可用,保证后端字段上线前零影响。
*/
export const isAssetUsable = (asset: AssetUsageLike): boolean => asset.usable !== false