feat(#1714): 前端 prepare 短路(后端 skip_transfer 命中时跳过 OSS 直传) (#1729)
CI/CD Pipeline / Dedup Check - skip PR tests when covered by push pipeline (push) Successful in 3s
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 3s
CI/CD Pipeline / Check push changed paths (push) Successful in 9s
CI/CD Pipeline / PR Build Web Image (pull_request) Successful in 26s
CI/CD Pipeline / PR Build API Image (pull_request) Successful in 30s
CI/CD Pipeline / PR Build Worker Image (pull_request) Successful in 28s
CI/CD Pipeline / Build Staging API Image (push) Successful in 41s
CI/CD Pipeline / Build Staging Web Image (push) Successful in 39s
CI/CD Pipeline / Build Staging Worker Image (push) Successful in 38s
CI/CD Pipeline / Production Browser E2E (pull_request) Has been skipped
CI/CD Pipeline / CI Gate (pull_request) Successful in 4s
CI/CD Pipeline / Validate - Python (mypy + alembic) (push) Successful in 1m54s
Preview Deploy / Deploy Preview Environment (pull_request) Successful in 2m16s
CI/CD Pipeline / Integration Tests (push) Successful in 2m28s
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (push) Successful in 1m16s
CI/CD Pipeline / Validate - Style (push) Successful in 2m51s
PR Automation / Auto Approve on CI Green (pull_request) Successful in 3m10s
CI/CD Pipeline / Staging E2E Tests (push) Failing after 1m31s
CI/CD Pipeline / ACR Image Cleanup (push) Successful in 1m32s
CI/CD Pipeline / Validate - Security (push) Successful in 5m18s
CI/CD Pipeline / Frontend Unit Tests (push) Successful in 5m41s
AI Code Review / AI Code Review (pull_request) Successful in 6m20s
CI/CD Pipeline / Staging API Integration Tests (push) Successful in 3m32s
CI/CD Pipeline / Unit Tests (push) Successful in 8m24s
CI/CD Pipeline / Production Browser E2E (push) Has been skipped
CI/CD Pipeline / Canary Release to Production (push) Failing after 243h31m40s
CI/CD Pipeline / CI Gate (push) Failing after 243h31m45s
CI/CD Pipeline / Build Production Worker Image (push) Failing after 243h31m45s
PR Automation / Auto Merge on CI Green + Approved (pull_request) Failing after 243h37m0s
CI/CD Pipeline / Build Production Web Image (push) Failing after 243h31m45s
CI/CD Pipeline / Canary Release to Production (pull_request) Failing after 243h38m36s
CI/CD Pipeline / Build Production API Image (push) Failing after 243h31m45s
CI/CD Pipeline / Deploy Production (pull_request) Failing after 243h38m46s
CI/CD Pipeline / Staging API Integration Tests (pull_request) Failing after 243h38m47s
CI/CD Pipeline / Retag skipped Staging Worker Image (push) Failing after 243h38m49s
CI/CD Pipeline / Staging E2E Tests (pull_request) Failing after 243h38m48s
CI/CD Pipeline / Retag skipped Staging API Image (push) Failing after 243h38m51s
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Failing after 243h38m52s
CI/CD Pipeline / Build Production Web Image (pull_request) Failing after 243h38m55s
CI/CD Pipeline / Build Production API Image (pull_request) Failing after 243h38m57s
CI/CD Pipeline / Retag skipped Staging Worker Image (pull_request) Failing after 243h39m39s
CI/CD Pipeline / Retag skipped Staging API Image (pull_request) Failing after 243h39m40s
CI/CD Pipeline / Frontend Unit Tests (pull_request) Failing after 243h40m7s
CI/CD Pipeline / Unit Tests (pull_request) Failing after 243h40m9s
CI/CD Pipeline / Frontend Lint (pull_request) Failing after 243h40m8s
CI/CD Pipeline / Validate - Python (mypy + alembic) (pull_request) Failing after 243h40m9s
CI/CD Pipeline / Validate - Style (pull_request) Failing after 243h40m11s
CI/CD Pipeline / Frontend Lint (push) Failing after 243h40m11s
CI/CD Pipeline / Build Staging Worker Image (pull_request) Failing after 243h40m12s
CI/CD Pipeline / Build Staging API Image (pull_request) Failing after 243h40m13s
CI/CD Pipeline / PR Build Worker Image (push) Failing after 243h40m13s
CI/CD Pipeline / PR Build API Image (push) Failing after 243h40m14s
CI/CD Pipeline / Check push changed paths (pull_request) Failing after 243h40m15s
CI/CD Pipeline / Check if frontend-only change (push) Failing after 243h40m17s
CI/CD Pipeline / Deploy Production (push) Failing after 244h6m15s
CI/CD Pipeline / ACR Image Cleanup (pull_request) Failing after 244h13m21s
CI/CD Pipeline / Retag skipped Staging Web Image (push) Failing after 244h13m25s
CI/CD Pipeline / Build Production Worker Image (pull_request) Failing after 244h13m28s
CI/CD Pipeline / Retag skipped Staging Web Image (pull_request) Failing after 244h14m14s
CI/CD Pipeline / Integration Tests (pull_request) Failing after 244h14m43s
CI/CD Pipeline / Validate - Security (pull_request) Failing after 244h14m45s
CI/CD Pipeline / Build Staging Web Image (pull_request) Failing after 244h14m47s
CI/CD Pipeline / PR Build Web Image (push) Failing after 244h14m49s

Co-authored-by: xiaoxia <dev@xiaoxiajianji.com>
Co-committed-by: xiaoxia <dev@xiaoxiajianji.com>
This commit was merged in pull request #1729.
This commit is contained in:
2026-09-06 11:43:59 +08:00
committed by auto-approve-bot
parent 06b0bacce1
commit ff60fdf956
5 changed files with 170 additions and 0 deletions
+11
View File
@@ -139,6 +139,17 @@ export interface DirectUploadPrepareResult {
* 旧后端不返回该字段,前端降级为无预建卡片的原有行为。
*/
asset_id?: string
/**
* 后端 file_hash 命中素材库已有相同文件时为 true,前端应跳过 transfer + complete 阶段
* 直接按「去重命中」处理(不调 transfer、不调 complete、立即刷新素材列表)。
* 旧后端不返回该字段,前端降级为走老流程。
*/
duplicated?: boolean
/**
* 与 duplicated 语义一致:true 表示跳过传输,前端据此短路。
* 两个字段是同一语义的别名(后端可能只返回其一),前端任意为 true 即视为命中去重。
*/
skip_transfer?: boolean
}
/** 直传完成确认返回 */
+10
View File
@@ -179,6 +179,16 @@ export const uploadAssetDirect = async (data: {
fileHash,
clientUploadId,
})
// prepare 阶段后端 file_hash 命中素材库已有相同文件:跳过 transfer + complete
if (handle.prepared.skip_transfer || handle.prepared.duplicated) {
return {
storage_key: handle.prepared.storage_key,
ingest_job_id: "",
url: "",
duplicated: true,
asset_id: handle.prepared.asset_id,
}
}
await handle.transfer(data.onProgress)
return handle.complete()
}