feat(short-drama-agent-front): 优化分镜界面并新增弹窗手势

This commit is contained in:
GJ committed 2026-11-18 18:50:15 +08:00
1 parent b15a6011ce
commit d68f03471c
59 files changed
+2694 -857

No files matched your search

@@ -56,8 +56,8 @@ describe('联合审核单次批准和业务状态', () => {
const w = await open(status)
expect(w.text()).toContain('未知')
expect(w.text()).toContain('空间参考')
expect(w.text()).toContain('s1')
expect(w.text()).toContain('s2')
expect(w.text()).toContain('审核范围第 1 镜')
expect(w.text()).toContain('审核范围第 2 镜')
expect(auth).not.toHaveBeenCalled()
expect(execute).not.toHaveBeenCalled()
expect((w.vm as unknown as { canExecute: boolean }).canExecute).toBeFalsy()
@@ -32,6 +32,7 @@ describe('连续性审核真实组件流程', () => {
props: { open: true, projectId: 'mock-project', shots: continuityShots, disabled: false },
global: {
stubs: {
teleport: true,
AppDrawer: { template: '<div><slot/><slot name="footer"/></div>' },
AssetImage: true,
LayoutSupplementPanel: true
@@ -42,6 +43,9 @@ describe('连续性审核真实组件流程', () => {
expect(mock.calls.every(item => item.method === 'GET')).toBe(true)
await click('免费读取当前证据')
expect(wrapper.text()).toContain('证据不足')
expect(wrapper.text()).not.toContain('开门、关门属于即时状态')
await wrapper.get('button[aria-label="人工观察说明"]').trigger('click')
await flushPromises()
expect(wrapper.text()).toContain('开门、关门属于即时状态')
const inputs = wrapper.findAllComponents(NInput)
inputs.find(item => item.props('placeholder') === '固定地标一')!.vm.$emit('update:value', '窗')
@@ -122,6 +126,14 @@ describe('连续性审核真实组件流程', () => {
await flushPromises()
await click('免费预览结构约束')
expect(wrapper.text()).toContain('需要确认布局并重新确认母版')
await wrapper
.findAll('.n-collapse-item__header-main')
.find(item => item.text() === '本次完整布局约束')!
.trigger('click')
await flushPromises()
expect(wrapper.text()).toContain('固定连接位置')
expect(wrapper.text()).not.toContain(fingerprint)
expect(wrapper.text()).not.toContain('"layoutConfirmation"')
inputs
.find(item => item.props('placeholder') === '待审结构约束,例如固定连接位置与活动方向')!
.vm.$emit('update:value', '修改后的门轴')
@@ -0,0 +1,57 @@
import { flushPromises, mount } from '@vue/test-utils'
import { describe, expect, it, vi } from 'vitest'
import KeyframeDialog from '@/features/production/components/KeyframeDialog.vue'
import { billingCatalog, billingProfile, imageAuthorizationsFixture } from '../../fixtures/billing'
describe('首帧生成首屏只展示当前需要的信息', () => {
it('普通有效授权不常驻未知费用提示;出现真实阻断后重新打开才展示人工许可', async () => {
const list = imageAuthorizationsFixture(),
generate = vi.fn<() => Promise<{ accepted: boolean }>>(async () => ({ accepted: true }))
const fetcher = vi.fn<typeof fetch>(async url => {
const path = String(url)
if (path.endsWith('/generation-models')) return Response.json({ data: billingCatalog })
if (path.endsWith('/creative-profile')) return Response.json({ data: billingProfile })
if (path.endsWith('/resolve'))
return Response.json({
data: {
provider: 'openai-image',
model: 'gpt-image-2.5-flare',
options: { size: '1024x1024', quality: 'auto', count: 1 }
}
})
if (path.endsWith('/image-authorizations')) return Response.json({ data: list })
throw new Error('未模拟:' + path)
})
vi.stubGlobal('fetch', fetcher)
const wrapper = mount(KeyframeDialog, {
props: {
projectId: 'clean-density-project',
shotId: 'density-shot',
shotTitle: '当前镜头',
disabled: false,
open: true,
submitGeneration: generate
},
global: { stubs: { teleport: true } }
})
try {
await flushPromises()
expect(wrapper.find('[aria-label="本次人工追加许可"]').exists()).toBe(false)
expect(wrapper.text()).not.toContain('原请求在途或费用待核对')
expect(wrapper.text()).toContain('预览实际生成输入')
list.billingBlocked = true
await wrapper.setProps({ open: false })
await flushPromises()
await wrapper.setProps({ open: true })
await flushPromises()
expect(wrapper.find('[aria-label="本次人工追加许可"]').exists()).toBe(true)
expect(wrapper.text()).toContain('有限许可不会核清旧费用')
expect(generate).not.toHaveBeenCalled()
expect(
fetcher.mock.calls.some(([url]) => /\/keyframe$|\/generate|\/primary|\/vision/.test(String(url)))
).toBe(false)
} finally {
wrapper.unmount()
}
})
})
@@ -2,6 +2,7 @@ import { flushPromises, mount } from '@vue/test-utils'
import { describe, expect, it, vi } from 'vitest'
import KeyframeInputDetails from '@/features/production/components/KeyframeInputDetails.vue'
import { historicalReferenceUrl, type HistoricalKeyframeReference } from '@/features/production/keyframe-input'
import { expandSection } from '@/testing/naive'
/** 两种职责对应同一张实际参考图。 */
const reference: HistoricalKeyframeReference = {
@@ -66,6 +67,8 @@ describe('历史首帧输入', () => {
expect(fetcher).not.toHaveBeenCalled()
await wrapper.get('.n-collapse-item__header-main').trigger('click')
await flushPromises()
expect(wrapper.text()).not.toContain('当次描述 one')
await expandSection('本次实际使用的画面描述', wrapper.element)
expect(wrapper.text()).toContain('当次描述 one')
expect(wrapper.text()).toContain('原图已变化')
expect(wrapper.text()).toContain('@CH01')
@@ -73,6 +76,8 @@ describe('历史首帧输入', () => {
expect(wrapper.find('img').exists()).toBe(false)
await wrapper.setProps({ keyframeId: 'two' })
await flushPromises()
expect(wrapper.text()).not.toContain('当次描述 two')
await expandSection('本次实际使用的画面描述', wrapper.element)
expect(wrapper.text()).toContain('当次描述 two')
expect(wrapper.text()).not.toContain('当次描述 one')
expect(wrapper.text()).toContain('原图不可用')
+5 -1
View File
@@ -14,6 +14,7 @@ import {
validOptionalSize
} from '@/features/production/model'
import { keyframeFixture, videoFixture } from '@/features/production/testing/fixtures'
import { expandSection } from '@/testing/naive'
let wrapper: VueWrapper | undefined
afterEach(() => {
@@ -59,7 +60,8 @@ describe('镜头生产数据契约', () => {
expect(source).toMatch(
/\.video-input-grid\s*\{[^}]*max-width:\s*calc\(var\(--video-input-count\) \* 220px \+ \(var\(--video-input-count\) - 1\) \* 12px\)/
)
expect(source).toMatch(/\.keyframe-card \.asset-image\s*\{[^}]*aspect-square/)
const keyframeCard = readFileSync('src/features/production/components/KeyframeCard.vue', 'utf8')
expect(keyframeCard).toMatch(/\.keyframe-card \.asset-image\s*\{[^}]*aspect-square/)
const videoCard = readFileSync('src/features/production/components/VideoCard.vue', 'utf8')
expect(videoCard).toContain('class="block aspect-square w-full bg-[#080808] object-contain"')
expect(source).toMatch(/\.video-input-card\s*\{[^}]*bg-\(--app-control\)/)
@@ -359,6 +361,8 @@ describe('镜头生产数据契约', () => {
})
expect(document.body.textContent).toContain('1 张参考图')
expect(document.body.textContent).toContain('未进入模型的参考图')
expect(document.body.textContent).not.toContain('最终首帧 Prompt')
await expandSection('本次实际使用的画面描述')
expect(document.body.textContent).toContain('最终首帧 Prompt')
expect(wrapper.emitted('generate')).toBeUndefined()
})
@@ -272,6 +272,14 @@ it('抽屉使用真实表单,打开只读历史,免费预检逐项展示全
expect(wrapper.text()).toContain('@SC1')
expect(wrapper.text()).toContain('@SC2')
expect(wrapper.text()).not.toContain('登记本次费用批准')
await wrapper
.findAll('.n-collapse-item__header-main')
.find(item => item.text() === '原图片生成记录')!
.trigger('click')
await flushPromises()
expect(wrapper.text()).toContain('历史描述')
expect(wrapper.text()).not.toContain(hash)
expect(wrapper.find('pre').exists()).toBe(false)
} finally {
wrapper.unmount()
}
@@ -7,9 +7,27 @@ import KeyframeValidationHistory from '@/features/production/components/Keyframe
import { additionalImageFixture } from '../../fixtures/image-additional'
import { AssetImage } from '@/components/ui'
import { keyframeFixture } from '@/features/production/testing/fixtures'
import { keyframeDisplayNames } from '@/features/production/model'
import { imagePreviewFixture } from '../../fixtures/image-preview'
describe('V8-10免费输入与独立门禁', () => {
it('图片名称按原创建时间编号,倒序与主图切换仍使用相同名称', () => {
const old = keyframeFixture({ id: 'old', createdAt: '2026-11-01T00:00:00Z', isPrimary: false }),
recent = keyframeFixture({ id: 'recent', createdAt: '2026-11-02T00:00:00Z', isPrimary: true })
const names = keyframeDisplayNames([recent, old], '午后收整工具', 1)
expect(names.get('old')).toBe('午后收整工具 · 图片 01')
expect(names.get('recent')).toBe('午后收整工具 · 图片 02')
expect(
keyframeDisplayNames(
[
{ ...old, isPrimary: true },
{ ...recent, isPrimary: false }
],
'午后收整工具',
1
)
).toEqual(names)
})
it('旧图片按需查看原费用与来源,切换项目/候选后不混入其它记录或未执行计划', async () => {
const fetcher = vi.fn<typeof fetch>(async url => {
const path = String(url)
@@ -17,11 +35,12 @@ describe('V8-10免费输入与独立门禁', () => {
const projectId = path.includes('/second-project/') ? 'second-project' : 'original-project',
list = additionalImageFixture(projectId)
list.requests[0]!.input.targetId = 'history-shot'
list.requests[0]!.input.model = '原图片实际型号'
list.requests[0]!.input.candidateId = projectId === 'second-project' ? 'second-image' : 'old-image'
list.requests.push({
...structuredClone(list.requests[0]!),
id: 'another-candidate-request',
input: { ...list.requests[0]!.input, candidateId: 'unrelated-image' }
input: { ...list.requests[0]!.input, candidateId: 'unrelated-image', model: '其它图片的型号' }
})
return Response.json({ data: list })
}
@@ -59,6 +78,9 @@ describe('V8-10免费输入与独立门禁', () => {
.trigger('click')
await flushPromises()
expect(wrapper.text()).toContain('原预留 USD 0.5')
expect(wrapper.text()).toContain('原图片实际型号')
expect(wrapper.text()).not.toContain('其它图片的型号')
expect(wrapper.findAll('[aria-label="原图片生成记录"]')).toHaveLength(1)
expect(wrapper.text()).toContain('实际账单 未知')
expect(wrapper.text()).toContain('历史审核未通过,当前来源已变化')
expect(wrapper.text()).not.toContain('another-candidate-request')
@@ -104,7 +126,9 @@ describe('V8-10免费输入与独立门禁', () => {
id: 'old-image',
shotId: 'quality-shot',
isPrimary: true,
imageUrl: '/mock.png'
imageUrl: '/mock.png',
model: '仅供详情核对的原型号',
error: '这份很长的历史错误只应在详情中展示'
}),
projectId: 'quality-project',
shotId: 'quality-shot',
@@ -113,11 +137,21 @@ describe('V8-10免费输入与独立门禁', () => {
blocked: true,
validationPassed: true,
confirming: false,
readonly: true
}
readonly: true,
displayName: '午后收整工具 · 图片 01'
},
global: { stubs: { teleport: true } }
})
try {
await flushPromises()
expect(wrapper.get('.keyframe-card-name').text()).toBe('午后收整工具 · 图片 01')
expect(wrapper.text()).not.toContain('这份很长的历史错误')
expect(wrapper.text()).not.toContain('仅供详情核对的原型号')
expect(wrapper.text()).toContain('审核来源过期')
await wrapper.get('button[aria-label="查看首帧详情"]').trigger('click')
await flushPromises()
expect(wrapper.text()).toContain('这份很长的历史错误只应在详情中展示')
expect(wrapper.text()).toContain('仅供详情核对的原型号')
expect(wrapper.text()).toContain(
machine === 'failed' ? '历史审核未通过,当前来源已变化' : '历史审核通过,当前来源已变化'
)
@@ -55,10 +55,11 @@ describe('按任务读取执行历史的页面流程', () => {
expect(wrapper.text()).toContain('执行完成,质量请查看当前结论')
expect(wrapper.text()).toContain('本次新提交步骤:物理关系;复用已有步骤:通用画面')
await expand('通用画面')
expect(wrapper.text()).toContain('原调用计量,不重复计入本次')
await expand('高级详情')
expect(wrapper.text()).toContain('输入词元:100')
expect(wrapper.text()).toContain('复用来源执行:old-run')
expect(wrapper.text()).toContain('本步骤复用原调用,不重复计入本次费用')
await expand('步骤记录')
expect(wrapper.text()).toContain('原调用复用')
expect(wrapper.text()).not.toContain('输入词元')
expect(wrapper.text()).not.toContain('old-run')
expect(wrapper.text()).not.toContain('合计词元:0')
await wrapper
.findAll('button')