fix: 适配身份图片异步生成回执
This commit is contained in:
1 parent
50bcb0dd8b
commit
6e6af5e9bb
1 file changed
+13
-8
@@ -277,12 +277,16 @@ export function useSubjectIdentity() {
|
|||||||
return
|
return
|
||||||
const id = subject.value.id
|
const id = subject.value.id
|
||||||
const identityId = identity.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)
|
const image = await subjectIdentityApi.generateImage(id, input)
|
||||||
if (!image || image.identityId !== identityId || image.status !== 'completed' || !image.imageUrl)
|
if (!image || image.identityId !== identityId || !['pending', 'generating'].includes(image.status)) {
|
||||||
throw new Error(image?.error || '后端未返回已完成的身份图片,请先刷新核对,不要立即重复生图。')
|
throw new Error(image?.error || '后端未返回有效的身份图片生成任务,请刷新核对。')
|
||||||
|
}
|
||||||
})
|
})
|
||||||
await detail.refresh()
|
if (ok) {
|
||||||
|
await detail.refresh()
|
||||||
|
operation.value.notice = `${subject.value.name} 身份参考图已提交生成,可稍后刷新查看结果。`
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 单角色候选图固定为独立 primary,不复用旧 Anchor,生成成功后仍需人工确认选角。 */
|
/** 单角色候选图固定为独立 primary,不复用旧 Anchor,生成成功后仍需人工确认选角。 */
|
||||||
@@ -290,14 +294,15 @@ export function useSubjectIdentity() {
|
|||||||
if (!canGenerateCandidate.value || !subject.value || !identity.value) return
|
if (!canGenerateCandidate.value || !subject.value || !identity.value) return
|
||||||
const id = subject.value.id
|
const id = subject.value.id
|
||||||
const identityId = identity.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)
|
const image = await subjectIdentityApi.generateCastingCandidate(id, input)
|
||||||
if (!image || image.identityId !== identityId || image.status !== 'completed' || !image.imageUrl)
|
if (!image || image.identityId !== identityId || !['pending', 'generating'].includes(image.status)) {
|
||||||
throw new Error(image?.error || '后端未返回已完成的选角候选,请刷新核对。')
|
throw new Error(image?.error || '后端未返回有效的选角候选生成任务,请刷新核对。')
|
||||||
|
}
|
||||||
})
|
})
|
||||||
if (ok) {
|
if (ok) {
|
||||||
await Promise.all([detail.refresh(), castingQuery.refresh(), catalog.refresh()])
|
await Promise.all([detail.refresh(), castingQuery.refresh(), catalog.refresh()])
|
||||||
operation.value.notice = `${subject.value.name} 选角候选已生成,请在下方候选图中确认正式演员。`
|
operation.value.notice = `${subject.value.name} 选角候选已提交生成,可稍后刷新查看结果。`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user