feat(short-drama-agent-front): 支持母版复用并优化生成交互

This commit is contained in:
GJ committed 2026-10-12 15:22:03 +08:00
1 parent 49fb9c7a27
commit ee5e49957a
28 files changed
+634 -326

No files matched your search

@@ -113,7 +113,7 @@ describe('身份图与母版契约', () => {
expect(wrapper.emitted('regenerate')).toBeUndefined()
})
it('候选未确认时不填补母版空状态,无图片时不提供管理入口', async () => {
it('单张候选直接显示且保持未确认,无图片时不提供管理入口', async () => {
wrapper = mount(IdentityGallery, {
attachTo: document.body,
props: {
@@ -124,14 +124,13 @@ describe('身份图与母版契约', () => {
images: [identityImageFixture({ id: 'candidate', isAnchor: false })]
}
})
expect(wrapper.text()).toContain('尚未确认身份母版')
expect(wrapper.find('.identity-anchor-grid').exists()).toBe(false)
button('管理候选(1)').click()
await flushPromises()
expect(wrapper.text()).toContain('母版候选 · 未确认')
expect(wrapper.find('.identity-anchor-grid').exists()).toBe(true)
expect(wrapper.findAll('button').some(item => item.text().includes('管理候选'))).toBe(false)
expect(document.querySelector('[aria-label="身份图片 candidate"]')).not.toBeNull()
expect(wrapper.emitted('anchor')).toBeUndefined()
await wrapper.setProps({ images: [] })
expect(wrapper.text()).toContain('尚无身份母版')
expect(wrapper.text()).toContain('尚无身份图片')
expect(wrapper.find('.identity-anchor-grid').exists()).toBe(false)
expect(wrapper.findAll('button').some(item => item.text().includes('管理候选'))).toBe(false)
})
@@ -225,7 +224,7 @@ describe('身份图与母版契约', () => {
]
}
})
button('管理候选(1)').click()
expect(wrapper.findAll('button').some(item => item.text().includes('管理候选'))).toBe(false)
await flushPromises()
expect(document.querySelector('[aria-label="身份图片 failed-front"]')!.textContent).not.toContain(
'图片模型超时'
@@ -363,7 +362,7 @@ describe('身份图与母版契约', () => {
viewType: 'three-quarter',
referenceImageId: 'identity-image-1',
provider: 'qwen-image',
generationOptions: { size: '2048*2048' },
generationOptions: { size: '2048*2048', promptExtendMode: 'direct' },
prompt: '自定义身份提示词'
}
]
@@ -391,7 +390,7 @@ describe('身份图与母版契约', () => {
await wrapper.setProps({ images: [] })
expect(button('确认生成身份图').disabled).toBe(true)
await wrapper.setProps({ subjectId: 's2', subjectName: '陆川' })
expect(selectControl(wrapper!, 'id', 'identity-reference').props('value')).toBe('')
expect(document.querySelector('#identity-reference')).toBeNull()
expect(document.querySelector('#identity-image-cost')!.getAttribute('aria-checked')).toBe('false')
})
@@ -426,7 +425,7 @@ describe('身份图与母版契约', () => {
images: [identityImageFixture({ viewType: 'front', isAnchor: false })]
}
})
button('管理候选(1)').click()
expect(wrapper.findAll('button').some(item => item.text().includes('管理候选'))).toBe(false)
await flushPromises()
const card = wrapper.findAllComponents(IdentityImageCard)[0]!
expect(card.findAllComponents(NButton).some(item => item.text() === '确认选角并锁定')).toBe(false)
@@ -464,7 +463,7 @@ describe('身份图与母版契约', () => {
images: ['first', 'second'].map(id => identityImageFixture({ id, isAnchor: false }))
}
})
button('管理候选(2)').click()
button('管理候选(1)').click()
await flushPromises()
const cards = wrapper.findAllComponents(IdentityImageCard)
const first = cards.find(item => item.props('image').id === 'first')!