feat(short-drama-agent-front): 完善镜头定位与项目配置

This commit is contained in:
GJ committed 2026-10-08 19:45:26 +08:00
1 parent 470b52e26d
commit 5b134207b8
66 files changed
+2042 -984

No files matched your search

+15 -20
View File
@@ -1,3 +1,4 @@
import { imageCatalog, generationProfile } from '../../fixtures/generation'
import { defineComponent } from 'vue'
import { flushPromises, mount, type VueWrapper } from '@vue/test-utils'
import { afterEach, describe, expect, it, vi } from 'vitest'
@@ -10,22 +11,8 @@ import { useSubjectImages } from '@/features/subject-images/useSubjectImages'
import FormPromptDialog from '@/features/subject-images/components/FormPromptDialog.vue'
import GenerateImageDialog from '@/features/subject-images/components/GenerateImageDialog.vue'
const imageCatalog = {
defaults: { imageProvider: 'qwen-image', videoProvider: 'seedance' },
images: [{
type: 'image' as const, provider: 'qwen-image', providerLabel: 'Qwen', model: 'qwen-image-3.0-pro',
modelLabel: 'Qwen Image', supported: true as const, enabled: true, isDefault: true, capabilities: {},
generationOptions: [{ key: 'size', label: '图片尺寸', type: 'size' as const, required: true,
options: [{ label: '1:1 · 2048×2048', value: '2048*2048' }] }],
defaults: { size: '2048*2048' }, projectConstraints: []
}],
videos: []
}
const creativeProfile = {
projectId: 'gallery-test', aspectRatio: '1:1' as const, imageProvider: 'qwen-image',
imageModel: 'qwen-image-3.0-pro', imageOptions: { size: '2048*2048' },
videoProvider: 'seedance', videoModel: 'seedance', videoOptions: {}
}
/** 当前测试使用真实目录契约构造项目模型配置。 */
const creativeProfile = generationProfile('gallery-test')
let wrapper: VueWrapper | undefined
const projectId = 'capability-test'
/** 从实际挂载的确认弹窗查找操作按钮。 */
@@ -115,7 +102,7 @@ describe('形态正式提示词与批量配置', () => {
new Response(JSON.stringify({ data: { id: 'form-db-1', subjectId: 'subject-db-1', generationPrompt: '' } }))
)
await service.generatePrompt('form-db-1', false)
expect(getOperation(projectId).error).toContain('未确认正式提示词已保存')
expect(getOperation(projectId).error).toContain('提示词保存结果未确认')
})
it('批量提示词保留部分失败回执,不覆盖图片回执且不传图片上限', async () => {
const { service, posts } = await setup()
@@ -178,7 +165,10 @@ describe('形态正式提示词与批量配置', () => {
})
it('正式提示词确认必须勾选,未确认不发送事件', async () => {
const form = formFixture()
wrapper = mount(FormPromptDialog, { attachTo: document.body, props: { open: true, disabled: false, form, catalog: imageCatalog, profile: creativeProfile } })
wrapper = mount(FormPromptDialog, {
attachTo: document.body,
props: { open: true, disabled: false, form, catalog: imageCatalog, profile: creativeProfile }
})
await flushPromises()
find('生成正式提示词').click()
await flushPromises()
@@ -194,7 +184,10 @@ describe('形态正式提示词与批量配置', () => {
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 } })
wrapper = mount(GenerateImageDialog, {
attachTo: document.body,
props: { open: true, disabled: false, form, catalog: imageCatalog, profile: creativeProfile }
})
await flushPromises()
document.querySelector<HTMLElement>('#confirm-image-cost')!.click()
await flushPromises()
@@ -204,6 +197,8 @@ describe('形态正式提示词与批量配置', () => {
expect(submit.disabled).toBe(false)
submit.click()
await flushPromises()
expect(wrapper.emitted('generate')).toEqual([['form-db-1', { setPrimary: false }]])
expect(wrapper.emitted('generate')).toEqual([
['form-db-1', { setPrimary: false, provider: 'qwen-image', generationOptions: { size: '2048*2048' } }]
])
})
})