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

@@ -4,6 +4,11 @@ import { describe, expect, it } from 'vitest'
import GenerationOptionFields from '../../../src/features/generation-config/components/GenerationOptionFields.vue'
import type { GenerationOptionSchema } from '../../../src/features/generation-config/types'
/**
* 挂载实际模型参数组件以核对下拉枚举与当前值。
* @param schemas 后端参数目录
* @returns 挂载后的组件
*/
function mountFields(schemas: GenerationOptionSchema[]) {
return mount(GenerationOptionFields, {
props: { schemas, modelValue: { size: '2K', durationSeconds: 4, seed: 1 } }
@@ -11,20 +16,24 @@ function mountFields(schemas: GenerationOptionSchema[]) {
}
describe('生成模型参数字段', () => {
it('图片尺寸使用下拉框并保留标准尺寸与当前值', () => {
it('图片尺寸只保留当前 Provider 枚举、默认值与当前值', () => {
const wrapper = mountFields([
{ key: 'size', label: '图片尺寸', type: 'size', required: true, providerDefault: 'auto' }
{
key: 'size',
label: '图片尺寸',
type: 'size',
required: true,
providerDefault: 'auto',
options: [{ label: '目录支持尺寸', value: '2048*2048' }]
}
])
const select = wrapper.getComponent(NSelect)
expect(select.props('clearable')).toBe(false)
expect(select.props('options')).toEqual(
expect.arrayContaining([
expect.objectContaining({ value: '1K' }),
expect.objectContaining({ value: '1.5K' }),
expect.objectContaining({ value: '2K' }),
expect.objectContaining({ value: 'auto' })
])
)
expect(select.props('options')).toEqual([
{ label: '目录支持尺寸', value: '2048*2048' },
{ label: 'auto', value: 'auto' },
{ label: '2K', value: '2K' }
])
expect(wrapper.findComponent(NInputNumber).exists()).toBe(false)
})