feat(short-drama-agent-front): 完善分镜审核与制作准备流程

This commit is contained in:
GJ committed 2026-10-19 21:59:22 +08:00
1 parent c4b43b9725
commit 1da56e0d46
72 files changed
+2801 -528

No files matched your search

+51 -1
View File
@@ -8,6 +8,9 @@ import { getOperation } from '@/features/workflows/operations'
import { formFixture } from '@/features/subject-images/testing/fixtures'
import { directionsResult } from '@/features/storyboard/testing/fixtures'
import { checkPipeline, useAdvancedProduction } from '@/features/production/useAdvancedProduction'
import { productionApi } from '@/features/production/api'
import { generationConfigApi } from '@/features/generation-config/api'
import { projectSettingsOpenKey } from '@/features/generation-config/context'
import { useProduction } from '@/features/production/useProduction'
import { getProductionSession } from '@/features/production/model'
import AdvancedProduction from '@/features/production/components/AdvancedProduction.vue'
@@ -146,10 +149,12 @@ function server() {
}
else if (path.endsWith('/checkpoints')) data = context.checkpoints.value
else if (path.endsWith('/subject-forms')) data = [form]
else if (path.endsWith('/production/entry-readiness')) data = { ready: true, derivedAssets: { shotCount: 1 } }
else if (path.includes('/storyboard-visual-states')) data = { ...directionsResult('capability-test', Number(new URL(String(url), 'http://localhost').searchParams.get('episodeNo') || 1)), shotCount: 1, visualStateCount: 1, staleCount: 0 }
else if (path.endsWith('/production/plan')) data = plan
else if (path.endsWith('/production/status')) data = status
else if (path.includes('/readiness')) data = readiness
else if (path.includes('/storyboard-directions')) data = directionsResult('capability-test')
else if (path.includes('/storyboard-directions')) data = { ...directionsResult('capability-test'), shotCount: 1, directionCount: 1 }
else if (path.endsWith('/videos/status'))
data = {
total: 1,
@@ -205,6 +210,51 @@ async function advanced() {
}
describe('高级串联生产的安全边界', () => {
it('缺少配置时在计划位置提供已有配置入口,不创建配置或允许启动', async () => {
const { context, posts } = server()
vi.spyOn(generationConfigApi, 'profile').mockResolvedValue(null)
const openSettings = vi.fn<() => void>()
wrapper = mount(AdvancedProduction, {
attachTo: document.body,
global: { provide: { [projectContextKey as symbol]: context, [projectSettingsOpenKey as symbol]: openSettings } }
})
await flushPromises()
await expandSections()
button('检查串联生产条件').click()
await flushPromises()
const configure = wrapper.findAll('button').find(item => item.text() === '前往项目配置')
expect(configure?.exists()).toBe(true)
await configure!.trigger('click')
expect(openSettings).toHaveBeenCalledTimes(1)
expect(button('启动串联生产').disabled).toBe(true)
expect(posts()).toHaveLength(0)
})
it('配置在预检期间缺失时显示明确阻断,不读取空阶段或允许启动', async () => {
const { service, posts } = await advanced()
vi.spyOn(productionApi, 'plan').mockResolvedValue({ projectId: 'capability-test', canStart: false, canAutoRun: false, hasManualBlockers: true, manualBlocked: 1, configuration: { status: 'blocked', code: 'CREATIVE_PROFILE_REQUIRED', reason: '项目尚未配置 Creative Profile,请先保存项目生成配置' }, entryReadiness: { ready: true }, providers: null, generationConfig: null, completed: false, stage: 'configuration_required', characterIdentity: null, stableIdentityAnchors: null, subjectImages: null, keyframes: null, videoPrompts: null, videos: null, details: null })
await service.preflight()
expect(service.check.value).toBeNull()
expect(service.error.value).toContain('请先保存项目生成配置')
expect(service.error.value).not.toContain('TypeError')
expect(service.configurationRequired.value).toBe(true)
expect(posts()).toHaveLength(0)
})
it('尚无配置时不请求阶段计划,保存配置后重新预检恢复正常流程', async () => {
const { service, fetcher, posts } = await advanced()
const original = fetcher.getMockImplementation()!
let missing = true
fetcher.mockImplementation((url, init) => missing && String(url).endsWith('/creative-profile')
? Promise.resolve(new Response('{"data":null}')) : original(url, init))
await service.preflight()
expect(service.configurationRequired.value).toBe(true)
expect(service.check.value).toBeNull()
expect(fetcher.mock.calls.some(([url]) => String(url).endsWith('/production/plan'))).toBe(false)
missing = false
await service.preflight()
expect(service.configurationRequired.value).toBe(false)
expect(service.check.value?.issues).toEqual([])
expect(posts()).toHaveLength(0)
})
it('挂载不查询或生成,通过预检仍需显式启动,再次预检后提交安全范围与项目模型参数', async () => {
const { service, fetcher, posts } = await advanced()
expect(fetcher).not.toHaveBeenCalled()