diff --git a/apps/web/playwright-report/index.html b/apps/web/playwright-report/index.html new file mode 100644 index 000000000..f98f3962d --- /dev/null +++ b/apps/web/playwright-report/index.html @@ -0,0 +1,68 @@ + + + + + + + + + Playwright Test Report + + + + +
+ + + \ No newline at end of file diff --git a/apps/web/src/pages/voice-materials/hooks/useVoiceMaterials/actions/useVoiceUpload.ts b/apps/web/src/pages/voice-materials/hooks/useVoiceMaterials/actions/useVoiceUpload.ts index af0e4f910..a22e5bdd8 100755 --- a/apps/web/src/pages/voice-materials/hooks/useVoiceMaterials/actions/useVoiceUpload.ts +++ b/apps/web/src/pages/voice-materials/hooks/useVoiceMaterials/actions/useVoiceUpload.ts @@ -55,10 +55,15 @@ export function useVoiceUpload({ voiceLibrary, createLibMutation }: UseVoiceUplo }) // 去重命中(同库已存在相同 file_hash 素材): - // 后端返回 duplicated=true 且 ingest_job_id 为空;跳过轮询和打标签,直接走 onSuccess - if (complete.duplicated === true || !complete.ingest_job_id) { + // 后端返回 duplicated=true,ingest_job_id 为空;跳过轮询和打标签, + // mutationFn 正常 return 即 resolve,useMutation 自动触发 onSuccess 刷新列表。 + // 已存在素材复用上次标签,无需重新打标。 + if (complete.duplicated === true) { return } + if (!complete.ingest_job_id) { + throw new Error("上传完成但未返回处理任务 ID,请重试") + } const { ingest_job_id } = complete // 3. 轮询 ingest job 状态(complete 后先立即查一次,未完成再每 5s 轮询) diff --git a/apps/web/src/pages/voices/hooks/useVoiceUpload.ts b/apps/web/src/pages/voices/hooks/useVoiceUpload.ts index 2014bc1fb..eb25d6fa5 100644 --- a/apps/web/src/pages/voices/hooks/useVoiceUpload.ts +++ b/apps/web/src/pages/voices/hooks/useVoiceUpload.ts @@ -39,12 +39,16 @@ export function useVoiceUpload({ showToast }: UseVoiceUploadProps) { }) /* 去重命中(同库已存在相同 file_hash 素材): - * 后端返回 duplicated=true 且 ingest_job_id 为空, - * 不轮询、直接按上传成功处理(onSuccess 分支 toast + 刷新列表) + * 后端返回 duplicated=true,ingest_job_id 为空, + * 不轮询、直接按上传成功处理(onSuccess 分支 toast + 刷新列表)。 + * 注意:mutationFn 正常 return 即视为 resolve,useMutation 会自动调 onSuccess。 */ - if (complete.duplicated === true || !complete.ingest_job_id) { + if (complete.duplicated === true) { return } + if (!complete.ingest_job_id) { + throw new Error("上传完成但未返回处理任务 ID,请重试") + } const { ingest_job_id } = complete /* 轮询 ingest job 状态,等待 Worker 处理完成;