diff --git a/src/features/subject-identity/useSubjectIdentity.ts b/src/features/subject-identity/useSubjectIdentity.ts index e16fcef..f211de2 100644 --- a/src/features/subject-identity/useSubjectIdentity.ts +++ b/src/features/subject-identity/useSubjectIdentity.ts @@ -277,12 +277,16 @@ export function useSubjectIdentity() { return const id = subject.value.id const identityId = identity.value.id - await runOperation(projectId.value, `生成 ${subject.value.name} 身份参考图`, async () => { + const ok = await runOperation(projectId.value, `提交 ${subject.value.name} 身份参考图生成`, async () => { const image = await subjectIdentityApi.generateImage(id, input) - if (!image || image.identityId !== identityId || image.status !== 'completed' || !image.imageUrl) - throw new Error(image?.error || '后端未返回已完成的身份图片,请先刷新核对,不要立即重复生图。') + if (!image || image.identityId !== identityId || !['pending', 'generating'].includes(image.status)) { + throw new Error(image?.error || '后端未返回有效的身份图片生成任务,请刷新核对。') + } }) - await detail.refresh() + if (ok) { + await detail.refresh() + operation.value.notice = `${subject.value.name} 身份参考图已提交生成,可稍后刷新查看结果。` + } } /** 单角色候选图固定为独立 primary,不复用旧 Anchor,生成成功后仍需人工确认选角。 */ @@ -290,14 +294,15 @@ export function useSubjectIdentity() { if (!canGenerateCandidate.value || !subject.value || !identity.value) return const id = subject.value.id const identityId = identity.value.id - const ok = await runOperation(projectId.value, `生成 ${subject.value.name} 选角候选`, async () => { + const ok = await runOperation(projectId.value, `提交 ${subject.value.name} 选角候选生成`, async () => { const image = await subjectIdentityApi.generateCastingCandidate(id, input) - if (!image || image.identityId !== identityId || image.status !== 'completed' || !image.imageUrl) - throw new Error(image?.error || '后端未返回已完成的选角候选,请刷新核对。') + if (!image || image.identityId !== identityId || !['pending', 'generating'].includes(image.status)) { + throw new Error(image?.error || '后端未返回有效的选角候选生成任务,请刷新核对。') + } }) if (ok) { await Promise.all([detail.refresh(), castingQuery.refresh(), catalog.refresh()]) - operation.value.notice = `${subject.value.name} 选角候选已生成,请在下方候选图中确认正式演员。` + operation.value.notice = `${subject.value.name} 选角候选已提交生成,可稍后刷新查看结果。` } }