feat(short-drama-agent-front): 优化身份管理与镜头素材布局

This commit is contained in:
GJ committed 2026-10-11 21:41:56 +08:00
1 parent dd0bd79a35
commit 3d2c198e52
14 files changed
+1060 -629

No files matched your search

+22 -11
View File
@@ -350,7 +350,7 @@ describe('视觉风格与主体身份工作区', () => {
)
})
it('生成进度与失败提示位于两栏上方,切换主体后不会保留其它主体的状态,完成后隐藏', async () => {
it('生成进度保留全栏提示,失败详情按需在浮层显示,切换后不串主体状态', async () => {
/** 两个主体分别处于生成中与失败状态,所有查询均使用隔离的测试响应。 */
const first = formFixture()
const second = { ...formFixture(), id: 'second-form', subjectId: 'second-subject', images: [] }
@@ -398,9 +398,16 @@ describe('视觉风格与主体身份工作区', () => {
.find(item => item.text().includes('第二个主体'))!
.trigger('click')
await flushPromises()
expect(wrapper!.get('.identity-generation-feedback').text()).toContain('模型暂时不可用')
expect(wrapper!.get('.identity-generation-feedback').text()).not.toContain('林知夏 的身份图片正在生成')
expect(wrapper!.findAll('.identity-generation-feedback')).toHaveLength(1)
expect(wrapper!.find('.identity-generation-feedback').exists()).toBe(false)
expect(wrapper!.find('.identity-image-failure').exists()).toBe(false)
button('管理候选(1)').click()
await flushPromises()
expect(document.querySelector('.identity-candidate-grid')?.textContent).not.toContain('模型暂时不可用')
expect(document.querySelector('.identity-image-failure')).toBeNull()
button('生成失败,查看失败原因').click()
await flushPromises()
expect(document.querySelector('.identity-image-failure')?.textContent).toContain('模型暂时不可用')
expect(document.querySelectorAll('.identity-image-failure')).toHaveLength(1)
vi.mocked(subjectIdentityApi.listImages).mockResolvedValue([
identityImageFixture({ identityId: `identity-${second.subjectId}`, status: 'completed' })
])
@@ -411,6 +418,7 @@ describe('视觉风格与主体身份工作区', () => {
.trigger('click')
await flushPromises()
expect(wrapper!.find('.identity-generation-feedback').exists()).toBe(false)
expect(document.querySelector('.identity-image-failure')).toBeNull()
})
it('主体目录与详情分别显示骨架,查询失败结束占位并可重试恢复', async () => {
@@ -448,7 +456,7 @@ describe('视觉风格与主体身份工作区', () => {
expect(wrapper!.get('.subject-identity-skeleton').attributes('aria-busy')).toBe('true')
expect(wrapper!.get('.subject-identity-skeleton').text()).toBe('')
expect(wrapper!.find('#identity-description').exists()).toBe(false)
expect(wrapper!.text()).not.toContain('尚无身份参考图')
expect(wrapper!.text()).not.toContain('尚无身份母版')
rejectCatalog(new Error('主体目录读取失败'))
await flushPromises()
expect(wrapper!.find('.subject-identity-skeleton').exists()).toBe(false)
@@ -467,7 +475,7 @@ describe('视觉风格与主体身份工作区', () => {
button('刷新身份').click()
await flushPromises()
expect(wrapper!.get<HTMLInputElement>('#identity-description').element.value).toBe('')
expect(wrapper!.text()).toContain('尚无身份参考图')
expect(wrapper!.text()).toContain('尚无身份母版')
})
it('已有身份刷新保留草稿与图库,图片操作归属图库并遵守未保存限制', async () => {
@@ -1071,6 +1079,8 @@ describe('视觉风格与主体身份工作区', () => {
})
stubFetch(fetcher)
await mountAssets('identity')
button('管理候选(1)').click()
await flushPromises()
button('设为身份母版').click()
await flushPromises()
expect(fetcher.mock.calls.some(([, init]) => init?.method === 'PUT')).toBe(false)
@@ -1079,14 +1089,13 @@ describe('视觉风格与主体身份工作区', () => {
expect(fetcher.mock.calls.find(([, init]) => init?.method === 'PUT')?.[0]).toBe(
'/api/subjects/subject-db-1/identity/images/candidate/stable-anchor'
)
expect(wrapper!.text()).toContain('当前身份母版')
expect(wrapper!.text()).toContain('身份母版')
expect(getOperation(fixture.id)).toMatchObject({
noticeType: 'success',
notice: '林知夏 的身份母版已确认并锁定。'
})
const anchorImage = wrapper!
.findAllComponents(NImage)
.find(image => image.props('alt')?.endsWith('当前身份母版'))!
// 仅检查正文母版预览,目录缩略图使用相同身份标识但不提供原图预览。
const anchorImage = wrapper!.get('.identity-anchor-grid').getComponent(NImage)
expect(anchorImage.props()).toMatchObject({ objectFit: 'cover', previewDisabled: false })
})
@@ -1202,6 +1211,8 @@ describe('视觉风格与主体身份工作区', () => {
stubFetch(fetcher)
await mountAssets('identity')
expect(wrapper!.text()).toContain('等待确认演员')
button('管理候选并确认').click()
await flushPromises()
button('确认选角并锁定').click()
await flushPromises()
button('确认演员选择').click()
@@ -1210,7 +1221,7 @@ describe('视觉风格与主体身份工作区', () => {
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)
expect(wrapper!.text()).toContain('主体身份已完成')
expect(wrapper!.text()).toContain('演员身份已确认并锁定')
expect(wrapper!.get('.identity-gallery').text()).toContain('已确认并锁定')
})
it('切换主体会取消旧查询,迟到的身份结果不覆盖当前主体', async () => {