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

@@ -1,3 +1,4 @@
import { imageCatalog, generationProfile } from '../../fixtures/generation'
import { flushPromises, mount, type VueWrapper } from '@vue/test-utils'
import { afterEach, describe, expect, it, vi } from 'vitest'
import { NImage, NScrollbar } from 'naive-ui'
@@ -43,40 +44,8 @@ function input(selector: string, value: string) {
item.dispatchEvent(new Event(item.tagName === 'SELECT' ? 'change' : 'input', { bubbles: true }))
}
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: 'project-1',
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('project-1')
describe('身份图与母版契约', () => {
it('详情大图 contain 完整显示,历史仍为 cover,缩略图只切换记录', async () => {
@@ -185,7 +154,7 @@ describe('身份图与母版契约', () => {
.findAllComponents(AssetImage)
.find(item => item.classes().includes('asset-image-preview'))!
expect(preview.props('src')).toBe(image.status === 'completed' ? image.imageUrl : null)
expect(wrapper.text()).toContain(`Identity image ID · ${image.id}`)
expect(preview.props('alt')).toBe(`林夏 · ${image.viewType === 'primary' ? '身份母版' : '正面'}`)
}
await history.get('[aria-label="查看身份图片 failed"]').trigger('click')
expect(wrapper.get('.asset-image-preview').text()).toContain('本次生成失败')
@@ -288,13 +257,14 @@ describe('身份图与母版契约', () => {
expect(castingStatusLabel('candidate_pending')).toBe('等待确认演员')
})
it('辅助视角传递明确参考图、成对尺寸和本次 Prompt,不传形态生图字段', async () => {
it('辅助视角传递明确参考图、目录尺寸和本次 Prompt,不传旧宽高字段', async () => {
wrapper = mount(IdentityImageDialog, {
attachTo: document.body,
props: {
open: true,
subjectId: 's1',
subjectName: '林夏',
module: 'character',
images: [identityImageFixture()],
disabled: false,
catalog: imageCatalog,
@@ -304,13 +274,14 @@ describe('身份图与母版契约', () => {
await flushPromises()
input('#identity-view', 'three-quarter')
input('#identity-reference', 'identity-image-1')
input('#identity-width', '2048')
document.querySelector<HTMLInputElement>('#identity-image-cost')!.click()
await flushPromises()
expect(document.querySelector('#identity-width')).toBeNull()
expect(document.querySelector('#identity-height')).toBeNull()
expect(button('确认生成身份图').disabled).toBe(true)
input('#identity-height', '2048')
input('#identity-image-prompt', ' 自定义身份提示词 ')
await flushPromises()
document.querySelector<HTMLInputElement>('#identity-image-cost')!.click()
await flushPromises()
button('确认生成身份图').click()
await flushPromises()
expect(wrapper.emitted('generate')).toEqual([
@@ -318,8 +289,8 @@ describe('身份图与母版契约', () => {
{
viewType: 'three-quarter',
referenceImageId: 'identity-image-1',
width: 2048,
height: 2048,
provider: 'qwen-image',
generationOptions: { size: '2048*2048' },
prompt: '自定义身份提示词'
}
]
@@ -333,6 +304,7 @@ describe('身份图与母版契约', () => {
open: true,
subjectId: 's1',
subjectName: '林夏',
module: 'character',
images: [identityImageFixture()],
disabled: false,
catalog: imageCatalog,
@@ -416,20 +388,22 @@ describe('身份图与母版契约', () => {
disabled: false,
catalog: {
defaults: { imageProvider: 'qwen-image', videoProvider: 'seedance' },
images: [{
type: 'image',
provider: 'qwen-image',
providerLabel: 'Qwen',
model: 'qwen-image-3.0-pro',
modelLabel: 'Qwen Image',
supported: true,
enabled: true,
isDefault: true,
capabilities: {},
generationOptions: [],
defaults: { size: '1536*2688' },
projectConstraints: []
}],
images: [
{
type: 'image',
provider: 'qwen-image',
providerLabel: 'Qwen',
model: 'qwen-image-3.0-pro',
modelLabel: 'Qwen Image',
supported: true,
enabled: true,
isDefault: true,
capabilities: {},
generationOptions: [],
defaults: { size: '1536*2688' },
projectConstraints: []
}
],
videos: []
},
profile: {
@@ -450,9 +424,9 @@ describe('身份图与母版契约', () => {
await flushPromises()
button('确认生成候选').click()
await flushPromises()
expect(wrapper.emitted('generate')).toEqual([[
{ provider: 'qwen-image', generationOptions: { size: '1536*2688' } }
]])
expect(wrapper.emitted('generate')).toEqual([
[{ provider: 'qwen-image', generationOptions: { size: '1536*2688' } }]
])
})
it('角色选角接口区分批量身份、候选生图与确认事务', async () => {