feat: 按质量结果管理主首帧候选

This commit is contained in:
GouJ committed 2026-09-23 11:35:53 +08:00
1 parent a72d96506a
commit 4298438219
6 files changed
+243 -88

No files matched your search

@@ -4,7 +4,7 @@ import QualityResult from '@/features/production/components/QualityResult.vue'
import { expandSections } from '@/testing/naive'
import ShotProductionAssets from '@/features/production/components/ShotProductionAssets.vue'
import { primaryKeyframe } from '@/features/production/model'
import { qualityKey, qualitySession, sessionVideoValidation } from '@/features/production/quality'
import { qualityKey, qualitySession, sessionKeyframePassed, sessionVideoValidation } from '@/features/production/quality'
import { keyframeFixture, videoFixture } from '@/features/production/testing/fixtures'
import { storyboardApi } from '@/features/storyboard/api'
import { hasRunningWorkflow } from '@/features/workflows/selectors'
@@ -110,13 +110,83 @@ describe('精简公开资产回归', () => {
})
try {
await flushPromises()
expect(wrapper.text()).toContain('模型输入变体')
await wrapper.findAll('button').find(item => item.text().includes('管理候选'))!.trigger('click')
await flushPromises()
expect(document.body.textContent).toContain('模型输入变体')
expect(wrapper.findAll('button').some(button => button.text() === '设为主首帧')).toBe(false)
} finally {
wrapper.unmount()
}
})
it('主页面只展示主首帧,候选通过质量检查后才允许晋升', async () => {
const projectId = 'keyframe-promotion-contract'
const primary = keyframeFixture()
const candidate = keyframeFixture({ id: 'keyframe-2', isPrimary: false })
vi.stubGlobal(
'fetch',
vi.fn<typeof fetch>().mockImplementation(
async url =>
new Response(
JSON.stringify({
data: String(url).endsWith('/keyframes') ? [primary, candidate] : []
})
)
)
)
const wrapper = mount(ShotProductionAssets, {
attachTo: document.body,
props: { projectId, shot, disabled: false }
})
try {
await flushPromises()
expect(wrapper.findAll('.keyframe-card')).toHaveLength(1)
expect(wrapper.find('.primary-keyframe-mark').attributes('aria-label')).toBe('当前主首帧')
expect(wrapper.findAll('button').some(item => item.text().includes('设为主首帧'))).toBe(false)
await wrapper.findAll('button').find(item => item.text().includes('管理候选'))!.trigger('click')
await flushPromises()
expect(document.body.textContent).toContain('首帧候选管理')
expect([...document.querySelectorAll('button')].some(item => item.textContent?.includes('设为主首帧'))).toBe(
false
)
const session = qualitySession(
qualityKey(projectId, { kind: 'keyframe', shotId: shot.shotId, assetId: candidate.id, title: '' })
)
session.receipt = {
kind: 'keyframe',
result: {
shotId: shot.shotId,
keyframeId: candidate.id,
validationTaskId: 'validation-2',
imageUrl: candidate.imageUrl!,
isPrimary: false,
passed: false,
summary: '人物身份不一致',
subjects: [],
subjectCountConsistent: true,
unauthorizedText: { detected: false, texts: [] },
issues: []
}
}
await flushPromises()
expect(sessionKeyframePassed(projectId, shot.shotId, candidate.id)).toBe(false)
expect([...document.querySelectorAll('button')].some(item => item.textContent?.includes('设为主首帧'))).toBe(
false
)
session.receipt.result.passed = true
await flushPromises()
expect(sessionKeyframePassed(projectId, shot.shotId, candidate.id)).toBe(true)
expect([...document.querySelectorAll('button')].some(item => item.textContent?.includes('设为主首帧'))).toBe(
true
)
} finally {
wrapper.unmount()
}
})
it('提示词返回使用 shotId,保留正文、状态和更新时间', async () => {
const result = {
shotId: 'shot/db',