fix(short-drama-agent-front): 完善素材准入与选角审核读取

This commit is contained in:
GJ committed 2026-11-04 19:09:46 +08:00
1 parent 75e86f7486
commit 3503926d62
13 files changed
+355 -42

No files matched your search

+51 -6
View File
@@ -1313,13 +1313,34 @@ describe('视觉风格与主体身份工作区', () => {
expect(fetcher.mock.calls.every(([, init]) => init?.method === 'GET')).toBe(true)
})
it('Character 确认选角原子切换 Anchor 并锁定 Identity,不调用普通母版接口', async () => {
it('Character 读取已保存审核后确认选角,刷新 Anchor、基础形态和项目准入', async () => {
let locked = false
let selected = false
const candidate = identityImageFixture({ id: 'casting-1', isAnchor: false })
const fingerprint = 'a'.repeat(64)
const generationSource = 'b'.repeat(64)
const validation = {
...approvedCharacter(candidate.id),
imageUrl: candidate.imageUrl,
subjectFormId: 'form-db-1',
providerInputFingerprint: fingerprint
}
const fetcher = vi.fn<typeof fetch>().mockImplementation(async (url, init) => {
const path = String(url)
if (path.endsWith('/subject-forms')) return jsonResponse([formFixture()])
if (path.endsWith('/subject-forms')) {
const form = formFixture()
if (locked) {
form.subject.identity = { id: candidate.identityId, isLocked: true, anchorImageId: candidate.id }
form.images = [
imageFixture({
imageUrl: candidate.imageUrl,
source: 'identity-anchor',
identityAnchorImageId: candidate.id
})
]
}
return jsonResponse([form])
}
if (path.endsWith('/visual-style')) return jsonResponse(styleFixture())
if (path.endsWith('/character-casting/readiness'))
return jsonResponse({
@@ -1345,8 +1366,24 @@ describe('视觉风格与主体身份工作区', () => {
]
})
if (path.endsWith('/identity/images')) return jsonResponse([{ ...candidate, isAnchor: selected }])
if (init?.method === 'POST' && path.endsWith('/validate'))
return jsonResponse(approvedCharacter(candidate.id))
if (path.endsWith('/identity/images/casting-1'))
return jsonResponse({
...candidate,
rawJson: JSON.stringify({
sourceFingerprint: generationSource,
providerInputFingerprint: fingerprint,
providerInputSnapshot: { fingerprint },
qualityValidation: {
imageId: candidate.id,
subjectFormId: 'form-db-1',
sourceCurrent: true,
generationSourceFingerprint: generationSource,
providerInputFingerprint: fingerprint,
passed: true,
validation
}
})
})
if (init?.method === 'PUT' && path.endsWith('/casting')) {
locked = true
selected = true
@@ -1360,12 +1397,14 @@ describe('视觉风格与主体身份工作区', () => {
return jsonResponse(identityFixture({ isLocked: locked }))
})
stubFetch(fetcher)
await mountAssets('identity')
const projectData = await mountAssets('identity')
expect(wrapper!.text()).toContain('待确认选角')
expect(wrapper!.find('.identity-anchor-grid').exists()).toBe(true)
expect(button('确认选角并锁定').disabled).toBe(true)
wrapper!.findComponent(IdentityGallery).vm.$emit('validate', candidate.id)
button('查看已保存审核').click()
await flushPromises()
expect(wrapper!.text()).toContain('画面交付要求')
expect(fetcher.mock.calls.every(([, init]) => init?.method === 'GET')).toBe(true)
button('确认选角并锁定').click()
await flushPromises()
button('确认演员选择').click()
@@ -1373,6 +1412,12 @@ describe('视觉风格与主体身份工作区', () => {
const put = fetcher.mock.calls.find(([, init]) => init?.method === 'PUT')!
expect(put[0]).toBe('/api/subjects/subject-db-1/identity/images/casting-1/casting')
expect(fetcher.mock.calls.some(([url]) => String(url).endsWith('/anchor'))).toBe(false)
const confirmationIndex = fetcher.mock.calls.indexOf(put)
expect(
fetcher.mock.calls.slice(confirmationIndex + 1).some(([url]) => String(url).endsWith('/subject-forms'))
).toBe(true)
expect(fetcher.mock.calls.some(([, init]) => init?.method === 'POST')).toBe(false)
expect(projectData.refreshStageReadiness).toHaveBeenCalled()
expect(wrapper!.text()).toContain('主体身份已完成')
expect(wrapper!.get('.identity-gallery').text()).toContain('已确认并锁定')
})