fix(generate): #1921 from-assets空templateId改用/clips/from-assets端点杜绝双斜杠404
CI/CD Pipeline / Check if frontend-only change (pull_request) Successful in 2s
CI/CD Pipeline / Dedup Check - skip PR tests when covered by push pipeline (pull_request) Successful in 2s
CI/CD Pipeline / PR Build Web Image (pull_request) Successful in 51s
CI/CD Pipeline / Frontend Lint (pull_request) Successful in 1m54s
PR Automation / Auto Approve on CI Green (pull_request) Successful in 2m0s
CI/CD Pipeline / Frontend Unit Tests (pull_request) Successful in 2m5s
Preview Deploy / Deploy Preview Environment (pull_request) Successful in 2m48s
CI/CD Pipeline / Validate - Style (pull_request) Successful in 3m48s
CI/CD Pipeline / Validate - Python (mypy + alembic) (pull_request) Successful in 4m29s
AI Code Review / AI Code Review (pull_request) Successful in 6m42s
CI/CD Pipeline / Validate - Security (pull_request) Successful in 10m37s
CI/CD Pipeline / CI Gate (pull_request) Successful in 1s
CI/CD Pipeline / Production Browser E2E (pull_request) Has been skipped
PR Automation / Auto Merge on CI Green + Approved (pull_request) Successful in 9m16s
ACR Cleanup / ACR Image Cleanup (pull_request_target) Successful in 18s
Preview Cleanup / Cleanup Preview Environment (pull_request) Successful in 3m34s
CI/CD Pipeline / Deploy Production (pull_request) Failing after 28h10m27s
CI/CD Pipeline / Staging E2E Tests (pull_request) Failing after 28h20m51s
CI/CD Pipeline / Retag skipped Staging Web Image (pull_request) Failing after 28h21m1s
CI/CD Pipeline / Integration Tests (pull_request) Failing after 28h21m5s
CI/CD Pipeline / Build Staging Web Image (pull_request) Failing after 28h21m7s
CI/CD Pipeline / Unit Tests (pull_request) Failing after 28h20m27s
CI/CD Pipeline / PR Build API Image (pull_request) Failing after 28h20m26s
CI/CD Pipeline / Build Staging API Image (pull_request) Failing after 28h20m29s
CI/CD Pipeline / Build Production Worker Image (pull_request) Failing after 28h9m50s
CI/CD Pipeline / Build Production Web Image (pull_request) Failing after 28h9m50s
CI/CD Pipeline / Build Production API Image (pull_request) Failing after 28h9m50s
CI/CD Pipeline / ACR Image Cleanup (pull_request) Failing after 28h20m13s
CI/CD Pipeline / Canary Release to Production (pull_request) Failing after 28h9m49s
CI/CD Pipeline / Retag skipped Staging Worker Image (pull_request) Failing after 28h20m23s
CI/CD Pipeline / PR Build Worker Image (pull_request) Failing after 28h20m23s
CI/CD Pipeline / Build Staging Worker Image (pull_request) Failing after 28h20m28s
CI/CD Pipeline / Staging API Integration Tests (pull_request) Failing after 28h20m13s
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Failing after 28h20m18s
CI/CD Pipeline / Retag skipped Staging API Image (pull_request) Failing after 28h20m23s
CI/CD Pipeline / Check push changed paths (pull_request) Failing after 28h20m32s

This commit is contained in:
2026-09-15 11:02:31 +08:00
parent 493d175e87
commit b6836e5e48
+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
}