feat(short-drama-agent-front): 接入素材预览审核并完善创作流程

This commit is contained in:
GJ committed 2026-11-02 10:16:10 +08:00
1 parent f8b0fbb8ca
commit dc8bb17a23
66 files changed
+2864 -632

No files matched your search

+14 -6
View File
@@ -13,6 +13,8 @@ import GenerateImageDialog from '@/features/subject-images/components/GenerateIm
/** 当前测试使用真实目录契约构造项目模型配置。 */
const creativeProfile = generationProfile('gallery-test')
/** 生成提交由测试替身接收,绝不调用真实模型。 */
const submitGeneration = vi.fn<() => Promise<{ accepted: boolean }>>(async () => ({ accepted: true }))
let wrapper: VueWrapper | undefined
const projectId = 'capability-test'
/** 从实际挂载的确认弹窗查找操作按钮。 */
@@ -20,6 +22,7 @@ function find(label: string) {
return [...document.querySelectorAll('button')].find(item => item.textContent?.trim() === label)!
}
afterEach(() => {
submitGeneration.mockClear()
wrapper?.unmount()
wrapper = undefined
document.body.innerHTML = ''
@@ -180,13 +183,20 @@ describe('形态正式提示词与批量配置', () => {
await flushPromises()
expect(wrapper.emitted('generate')).toEqual([['form-db-1', false]])
})
it('缺少正式和原始提示词仍可确认生图,由后端补齐而非前端编造', async () => {
it('未取得有效预览时不允许直接生图,不代为补齐资料', async () => {
const form = formFixture()
form.appearancePrompt = null
form.generationPrompt = null
wrapper = mount(GenerateImageDialog, {
attachTo: document.body,
props: { open: true, disabled: false, form, catalog: imageCatalog, profile: creativeProfile }
props: {
submitGeneration,
open: true,
disabled: false,
form,
catalog: imageCatalog,
profile: creativeProfile
}
})
await flushPromises()
document.querySelector<HTMLElement>('#confirm-image-cost')!.click()
@@ -194,11 +204,9 @@ describe('形态正式提示词与批量配置', () => {
const submit = [...document.querySelectorAll('button')].find(
item => item.textContent?.trim() === '确认生成图片'
)!
expect(submit.disabled).toBe(false)
expect(submit.disabled).toBe(true)
submit.click()
await flushPromises()
expect(wrapper.emitted('generate')).toEqual([
['form-db-1', { setPrimary: false, provider: 'qwen-image', generationOptions: { size: '2048*2048' } }]
])
expect(submitGeneration).not.toHaveBeenCalled()
})
})