fix(generate): #1921 from-assets空templateId双斜杠404修复(P0前端) (#1925)
CI/CD Pipeline / Dedup Check - skip PR tests when covered by push pipeline (push) Successful in 1s
CI/CD Pipeline / Check push changed paths (push) Successful in 16s
CI/CD Pipeline / Build Staging Web Image (push) Successful in 27s
CI/CD Pipeline / Build Staging API Image (push) Successful in 28s
CI/CD Pipeline / Build Staging Worker Image (push) Successful in 30s
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (push) Successful in 1m1s
CI/CD Pipeline / Frontend Unit Tests (push) Failing after 2m49s
CI/CD Pipeline / ACR Image Cleanup (push) Successful in 1m56s
CI/CD Pipeline / Integration Tests (push) Successful in 4m0s
CI/CD Pipeline / Validate - Style (push) Successful in 4m23s
CI/CD Pipeline / Staging API Integration Tests (push) Successful in 3m7s
CI/CD Pipeline / Staging E2E Tests (push) Failing after 3m9s
CI/CD Pipeline / Validate - Python (mypy + alembic) (push) Successful in 6m48s
CI/CD Pipeline / Validate - Security (push) Successful in 9m39s
CI/CD Pipeline / Unit Tests (push) Successful in 9m40s
CI/CD Pipeline / Production Browser E2E (push) Has been skipped
CI/CD Pipeline / Deploy Production (push) Failing after 27h59m57s
CI/CD Pipeline / Build Production Web Image (push) Failing after 28h0m1s
CI/CD Pipeline / Retag skipped Staging Web Image (push) Failing after 28h8m54s
CI/CD Pipeline / PR Build Worker Image (push) Failing after 28h9m45s
CI/CD Pipeline / PR Build Web Image (push) Failing after 28h9m7s
CI/CD Pipeline / PR Build API Image (push) Failing after 28h9m7s
CI/CD Pipeline / Build Production Worker Image (push) Failing after 27h59m23s
CI/CD Pipeline / Build Production API Image (push) Failing after 27h59m24s
CI/CD Pipeline / CI Gate (push) Failing after 27h59m23s
CI/CD Pipeline / Canary Release to Production (push) Failing after 27h59m19s
CI/CD Pipeline / Retag skipped Staging Worker Image (push) Failing after 28h8m16s
CI/CD Pipeline / Retag skipped Staging API Image (push) Failing after 28h8m17s
CI/CD Pipeline / Check if frontend-only change (push) Failing after 28h9m8s
CI/CD Pipeline / Frontend Lint (push) Failing after 28h9m4s

Co-authored-by: xiaoxia <dev@xiaoxiajianji.com>
Co-committed-by: xiaoxia <dev@xiaoxiajianji.com>
This commit was merged in pull request #1925.
This commit is contained in:
2026-09-15 11:13:58 +08:00
committed by auto-approve-bot
parent 493d175e87
commit a25aa7baed
+15 -12
View File
@@ -85,9 +85,13 @@ export async function batchDeleteEditPlanClips(
return response.data
}
/** 从素材批量创建片段(追加到时间线末尾) */
/**
* 从素材批量创建片段(追加到时间线末尾)。
* #1921 修复:templateId 为空时调用新端点 POST /clips/from-assets,避免拼出双斜杠
* `/templates//editor/clips/from-assets` 导致 404;有 templateId 时保持原路径向后兼容。
*/
export async function createClipsFromAssets(
templateId: string,
templateId: string | undefined | null,
assetIds: string[],
clipType = "main",
requiredClipsCount?: number,
@@ -100,16 +104,15 @@ export async function createClipsFromAssets(
if (requiredClipsCount !== undefined) {
body.required_clips_count = requiredClipsCount
}
// 新端点(#1921):templateId 为空时,body 不传 template_id,由后端兜底创建默认模板
const hasTid = !!templateId
const url = hasTid ? `/templates/${templateId}/editor/clips/from-assets` : "/clips/from-assets"
// from-assets 后端会调用 MediaKit 智能选片(最长 60s),单独延长超时
const response = await apiClient.post<ClipsFromAssetsResponse>(
`/templates/${templateId}/editor/clips/from-assets`,
body,
{
timeout: 60000,
signal: opts?.signal,
// _silentErrorToast 由 api/client.ts 响应拦截器读取(抑制全局错误 toast,#1777)
...(opts?.silentErrorToast ? ({ _silentErrorToast: true } as Record<string, unknown>) : {}),
},
)
const response = await apiClient.post<ClipsFromAssetsResponse>(url, body, {
timeout: 60000,
signal: opts?.signal,
// _silentErrorToast 由 api/client.ts 响应拦截器读取(抑制全局错误 toast,#1777)
...(opts?.silentErrorToast ? ({ _silentErrorToast: true } as Record<string, unknown>) : {}),
})
return response.data
}