diff --git a/src/features/subject-identity/useSubjectIdentity.ts b/src/features/subject-identity/useSubjectIdentity.ts index f211de2..8bada1c 100644 --- a/src/features/subject-identity/useSubjectIdentity.ts +++ b/src/features/subject-identity/useSubjectIdentity.ts @@ -326,6 +326,36 @@ export function useSubjectIdentity() { await detail.refresh() } + /** Scene / Prop 人工确认母版时原子完成 Anchor 切换与 Identity 锁定。 */ + async function confirmStableAnchor(imageId: string) { + const image = images.value.find(item => item.id === imageId) + if ( + detailBlocked.value || + (subject.value?.module !== 'scene' && subject.value?.module !== 'prop') || + !identity.value || + !image || + !canBeAnchor(image) + ) + return + const subjectId = subject.value.id + const identityId = identity.value.id + await runOperation(projectId.value, `确认 ${subject.value.name} 身份母版`, async () => { + const result = await subjectIdentityApi.confirmStableAnchor(subjectId, imageId) + if ( + !result || + result.identityId !== identityId || + result.subjectId !== subjectId || + !result.isLocked || + result.anchor.id !== imageId || + !result.anchor.isAnchor || + result.anchor.identityId !== identityId || + !canBeAnchor(result.anchor) + ) + throw new Error('接口未确认身份母版与身份锁定,请刷新核对。') + }) + await Promise.all([detail.refresh(), catalog.refresh()]) + } + /** Character 确认选角必须原子切换 Anchor 并锁定 Identity。 */ async function confirmCasting(imageId: string) { const image = images.value.find(item => item.id === imageId) @@ -398,6 +428,7 @@ export function useSubjectIdentity() { generateImage, generateCastingCandidate, setAnchor, + confirmStableAnchor, confirmCasting } }