fix(web): 上传按钮模式+卡片文字重叠+AI配音时长+smart-match结构兼容 (#1564)
CI/CD Pipeline / Dedup Check - skip PR tests when covered by push pipeline (push) Successful in 1s
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 3m44s
CI/CD Pipeline / Check push changed paths (push) Successful in 3m57s
Preview Deploy / Deploy Preview Environment (pull_request) Successful in 4m12s
CI/CD Pipeline / Validate - Migration (alembic) (push) Successful in 4m55s
CI/CD Pipeline / Validate - Type Check (mypy) (push) Successful in 5m17s
CI/CD Pipeline / PR Build Worker Image (pull_request) Successful in 1m48s
CI/CD Pipeline / PR Build API Image (pull_request) Successful in 2m13s
CI/CD Pipeline / Build Staging Web Image (push) Successful in 2m13s
CI/CD Pipeline / CI Gate (pull_request) Successful in 1m2s
CI/CD Pipeline / Retag skipped Staging API Image (push) Successful in 1m12s
CI/CD Pipeline / Retag skipped Staging Worker Image (push) Successful in 1m18s
CI/CD Pipeline / Frontend Unit Tests (push) Successful in 8m22s
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (push) Successful in 58s
CI/CD Pipeline / Validate - Code Quality (push) Successful in 9m6s
AI Code Review / AI Code Review (pull_request) Successful in 9m24s
PR Automation / Auto Approve on CI Green (pull_request) Successful in 9m33s
CI/CD Pipeline / ACR Image Cleanup (push) Successful in 2m29s
CI/CD Pipeline / Integration Tests (push) Successful in 3m19s
CI/CD Pipeline / Staging API Integration Tests (push) Successful in 4m3s
CI/CD Pipeline / Staging E2E Tests (push) Successful in 4m35s
CI/CD Pipeline / Unit Tests (push) Failing after 16m42s
CI/CD Pipeline / Production Browser E2E (push) Failing after 397h2m32s
CI/CD Pipeline / Deploy Production (push) Failing after 397h2m34s
CI/CD Pipeline / CI Gate (push) Failing after 397h2m35s
CI/CD Pipeline / Build Production Worker Image (push) Failing after 397h2m36s
CI/CD Pipeline / Build Production Web Image (push) Failing after 397h2m36s
CI/CD Pipeline / Build Production API Image (push) Failing after 397h2m36s
CI/CD Pipeline / Retag skipped Staging Web Image (push) Failing after 397h13m8s
CI/CD Pipeline / Production Browser E2E (pull_request) Failing after 397h15m15s
CI/CD Pipeline / Deploy Production (pull_request) Failing after 397h15m21s
CI/CD Pipeline / Build Staging Worker Image (push) Failing after 397h15m23s
CI/CD Pipeline / Build Production Worker Image (pull_request) Failing after 397h15m27s
CI/CD Pipeline / Build Production API Image (pull_request) Failing after 397h15m31s
CI/CD Pipeline / PR Build Web Image (pull_request) Failing after 397h15m33s
CI/CD Pipeline / Build Staging API Image (push) Failing after 397h15m25s
CI/CD Pipeline / Frontend Lint (pull_request) Failing after 397h15m35s
CI/CD Pipeline / Integration Tests (pull_request) Failing after 397h15m35s
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Failing after 397h19m5s
CI/CD Pipeline / Unit Tests (pull_request) Failing after 397h15m36s
CI/CD Pipeline / Validate - Migration (alembic) (pull_request) Failing after 397h19m7s
CI/CD Pipeline / ACR Image Cleanup (pull_request) Failing after 397h18m59s
CI/CD Pipeline / Validate - Code Quality (pull_request) Failing after 397h19m11s
CI/CD Pipeline / Staging API Integration Tests (pull_request) Failing after 397h19m1s
CI/CD Pipeline / Retag skipped Staging Worker Image (pull_request) Failing after 397h19m13s
CI/CD Pipeline / Frontend Lint (push) Failing after 397h19m19s
PR Automation / Auto Merge on CI Green + Approved (pull_request) Failing after 397h19m20s
CI/CD Pipeline / Retag skipped Staging Web Image (pull_request) Failing after 397h19m15s
CI/CD Pipeline / Build Staging Worker Image (pull_request) Failing after 397h19m21s
CI/CD Pipeline / Retag skipped Staging API Image (pull_request) Failing after 397h19m17s
CI/CD Pipeline / PR Build Worker Image (push) Failing after 397h19m21s
CI/CD Pipeline / PR Build API Image (push) Failing after 397h19m22s
CI/CD Pipeline / Build Staging Web Image (pull_request) Failing after 397h19m21s
CI/CD Pipeline / Check push changed paths (pull_request) Failing after 397h19m23s
CI/CD Pipeline / Build Staging API Image (pull_request) Failing after 397h19m21s
CI/CD Pipeline / Check if frontend-only change (push) Failing after 397h19m23s
CI/CD Pipeline / Canary Release to Production (push) Failing after 397h36m44s
CI/CD Pipeline / Canary Release to Production (pull_request) Failing after 397h49m27s
CI/CD Pipeline / Build Production Web Image (pull_request) Failing after 397h49m39s
CI/CD Pipeline / Frontend Unit Tests (pull_request) Failing after 397h49m44s
CI/CD Pipeline / Staging E2E Tests (pull_request) Failing after 397h53m13s
CI/CD Pipeline / Validate - Type Check (mypy) (pull_request) Failing after 397h53m19s
CI/CD Pipeline / PR Build Web Image (push) Failing after 397h53m31s
CI/CD Pipeline / Dedup Check - skip PR tests when covered by push pipeline (push) Successful in 1s
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 3m44s
CI/CD Pipeline / Check push changed paths (push) Successful in 3m57s
Preview Deploy / Deploy Preview Environment (pull_request) Successful in 4m12s
CI/CD Pipeline / Validate - Migration (alembic) (push) Successful in 4m55s
CI/CD Pipeline / Validate - Type Check (mypy) (push) Successful in 5m17s
CI/CD Pipeline / PR Build Worker Image (pull_request) Successful in 1m48s
CI/CD Pipeline / PR Build API Image (pull_request) Successful in 2m13s
CI/CD Pipeline / Build Staging Web Image (push) Successful in 2m13s
CI/CD Pipeline / CI Gate (pull_request) Successful in 1m2s
CI/CD Pipeline / Retag skipped Staging API Image (push) Successful in 1m12s
CI/CD Pipeline / Retag skipped Staging Worker Image (push) Successful in 1m18s
CI/CD Pipeline / Frontend Unit Tests (push) Successful in 8m22s
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (push) Successful in 58s
CI/CD Pipeline / Validate - Code Quality (push) Successful in 9m6s
AI Code Review / AI Code Review (pull_request) Successful in 9m24s
PR Automation / Auto Approve on CI Green (pull_request) Successful in 9m33s
CI/CD Pipeline / ACR Image Cleanup (push) Successful in 2m29s
CI/CD Pipeline / Integration Tests (push) Successful in 3m19s
CI/CD Pipeline / Staging API Integration Tests (push) Successful in 4m3s
CI/CD Pipeline / Staging E2E Tests (push) Successful in 4m35s
CI/CD Pipeline / Unit Tests (push) Failing after 16m42s
CI/CD Pipeline / Production Browser E2E (push) Failing after 397h2m32s
CI/CD Pipeline / Deploy Production (push) Failing after 397h2m34s
CI/CD Pipeline / CI Gate (push) Failing after 397h2m35s
CI/CD Pipeline / Build Production Worker Image (push) Failing after 397h2m36s
CI/CD Pipeline / Build Production Web Image (push) Failing after 397h2m36s
CI/CD Pipeline / Build Production API Image (push) Failing after 397h2m36s
CI/CD Pipeline / Retag skipped Staging Web Image (push) Failing after 397h13m8s
CI/CD Pipeline / Production Browser E2E (pull_request) Failing after 397h15m15s
CI/CD Pipeline / Deploy Production (pull_request) Failing after 397h15m21s
CI/CD Pipeline / Build Staging Worker Image (push) Failing after 397h15m23s
CI/CD Pipeline / Build Production Worker Image (pull_request) Failing after 397h15m27s
CI/CD Pipeline / Build Production API Image (pull_request) Failing after 397h15m31s
CI/CD Pipeline / PR Build Web Image (pull_request) Failing after 397h15m33s
CI/CD Pipeline / Build Staging API Image (push) Failing after 397h15m25s
CI/CD Pipeline / Frontend Lint (pull_request) Failing after 397h15m35s
CI/CD Pipeline / Integration Tests (pull_request) Failing after 397h15m35s
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Failing after 397h19m5s
CI/CD Pipeline / Unit Tests (pull_request) Failing after 397h15m36s
CI/CD Pipeline / Validate - Migration (alembic) (pull_request) Failing after 397h19m7s
CI/CD Pipeline / ACR Image Cleanup (pull_request) Failing after 397h18m59s
CI/CD Pipeline / Validate - Code Quality (pull_request) Failing after 397h19m11s
CI/CD Pipeline / Staging API Integration Tests (pull_request) Failing after 397h19m1s
CI/CD Pipeline / Retag skipped Staging Worker Image (pull_request) Failing after 397h19m13s
CI/CD Pipeline / Frontend Lint (push) Failing after 397h19m19s
PR Automation / Auto Merge on CI Green + Approved (pull_request) Failing after 397h19m20s
CI/CD Pipeline / Retag skipped Staging Web Image (pull_request) Failing after 397h19m15s
CI/CD Pipeline / Build Staging Worker Image (pull_request) Failing after 397h19m21s
CI/CD Pipeline / Retag skipped Staging API Image (pull_request) Failing after 397h19m17s
CI/CD Pipeline / PR Build Worker Image (push) Failing after 397h19m21s
CI/CD Pipeline / PR Build API Image (push) Failing after 397h19m22s
CI/CD Pipeline / Build Staging Web Image (pull_request) Failing after 397h19m21s
CI/CD Pipeline / Check push changed paths (pull_request) Failing after 397h19m23s
CI/CD Pipeline / Build Staging API Image (pull_request) Failing after 397h19m21s
CI/CD Pipeline / Check if frontend-only change (push) Failing after 397h19m23s
CI/CD Pipeline / Canary Release to Production (push) Failing after 397h36m44s
CI/CD Pipeline / Canary Release to Production (pull_request) Failing after 397h49m27s
CI/CD Pipeline / Build Production Web Image (pull_request) Failing after 397h49m39s
CI/CD Pipeline / Frontend Unit Tests (pull_request) Failing after 397h49m44s
CI/CD Pipeline / Staging E2E Tests (pull_request) Failing after 397h53m13s
CI/CD Pipeline / Validate - Type Check (mypy) (pull_request) Failing after 397h53m19s
CI/CD Pipeline / PR Build Web Image (push) Failing after 397h53m31s
Co-authored-by: xiaoxia <dev@xiaoxiajianji.com> Co-committed-by: xiaoxia <dev@xiaoxiajianji.com>
This commit was merged in pull request #1564.
This commit is contained in:
@@ -52,12 +52,37 @@ export const getAssetsByKind = async (
|
||||
/**
|
||||
* 智能匹配素材(后端 AI 选素材)
|
||||
* 调用后端 smart-match 端点,由后端根据素材库内容智能选择素材
|
||||
*
|
||||
* 后端返回 items 元素兼容两种结构(过渡期):
|
||||
* - 扁平结构:AssetItem 本身(id 在顶层)
|
||||
* - 包装结构:{ asset: AssetItem, score, breakdown }(id 需从 .asset 取)
|
||||
* 这里统一归一化为 AssetItem[],调用方无需关心包装层。
|
||||
*/
|
||||
export const smartMatchAssets = async (libraryId: string): Promise<{ items: AssetItem[] }> => {
|
||||
export interface SmartMatchResult {
|
||||
items: AssetItem[]
|
||||
}
|
||||
|
||||
interface SmartMatchWrappedItem {
|
||||
asset?: AssetItem
|
||||
id?: string
|
||||
score?: number
|
||||
breakdown?: unknown
|
||||
}
|
||||
|
||||
export const smartMatchAssets = async (libraryId: string): Promise<SmartMatchResult> => {
|
||||
const response = await apiClient.post("/assets/smart-match", {
|
||||
library_id: libraryId,
|
||||
})
|
||||
return response.data
|
||||
const rawItems: SmartMatchWrappedItem[] = response.data?.items ?? []
|
||||
const items = rawItems
|
||||
.map((it) =>
|
||||
// 包装结构 { asset: {...} } 优先解包;否则视其本身为扁平 AssetItem
|
||||
it?.asset && typeof it.asset === "object" && "id" in it.asset
|
||||
? it.asset
|
||||
: (it as unknown as AssetItem),
|
||||
)
|
||||
.filter((it): it is AssetItem => !!it && typeof it.id === "string" && it.id.length > 0)
|
||||
return { items }
|
||||
}
|
||||
|
||||
/** 更新素材(名称、metadata 等) */
|
||||
|
||||
Reference in New Issue
Block a user