fix: 为镜头提示词缺少首帧提供操作指引
This commit is contained in:
1 parent
0ce9ae00e7
commit
de26dd0c19
8 files changed
+149
-19
No files matched your search
@@ -7,10 +7,19 @@ import App from '@/App.vue'
|
||||
import ProjectLayout from '@/features/projects/ProjectLayout.vue'
|
||||
import { isProjectComplete } from '@/features/projects/access'
|
||||
import { projectsApi } from '@/features/projects/api'
|
||||
import { getOperation } from '@/features/workflows/operations'
|
||||
import type { ProjectDetail, ProjectStatus } from '@/features/projects/types'
|
||||
import { readAllStyles } from '@/testing/styles'
|
||||
|
||||
const downstream = ['breakdown', 'visual-style', 'subject-identity', 'subject-images', 'assets', 'storyboard', 'production']
|
||||
const downstream = [
|
||||
'breakdown',
|
||||
'visual-style',
|
||||
'subject-identity',
|
||||
'subject-images',
|
||||
'assets',
|
||||
'storyboard',
|
||||
'production'
|
||||
]
|
||||
let wrapper: VueWrapper | undefined
|
||||
afterEach(() => {
|
||||
wrapper?.unmount()
|
||||
@@ -66,14 +75,21 @@ async function openProject(initialPath: string) {
|
||||
}
|
||||
|
||||
describe('剧本完成前的下游访问限制', () => {
|
||||
it('项目工作区停留期间不重复读取项目详情和工作流记录', async () => {
|
||||
it('进入图库暂停父级轮询,返回其他工作区恢复定时更新', async () => {
|
||||
vi.useFakeTimers()
|
||||
const detail = vi.spyOn(projectsApi, 'detail').mockResolvedValue(project('manual-project', 'completed'))
|
||||
const detail = vi.spyOn(projectsApi, 'detail').mockResolvedValue(project('manual-gallery', 'completed'))
|
||||
const checkpoints = vi.spyOn(projectsApi, 'checkpoints').mockResolvedValue([])
|
||||
await openProject('/projects/manual-project/production')
|
||||
const { router } = await openProject('/projects/manual-gallery/production')
|
||||
await router.push('/projects/manual-gallery/subject-images')
|
||||
await flushPromises()
|
||||
await vi.advanceTimersByTimeAsync(30_000)
|
||||
expect(detail).toHaveBeenCalledTimes(1)
|
||||
expect(checkpoints).toHaveBeenCalledTimes(1)
|
||||
await router.push('/projects/manual-gallery/production')
|
||||
await flushPromises()
|
||||
await vi.advanceTimersByTimeAsync(6000)
|
||||
expect(detail).toHaveBeenCalledTimes(2)
|
||||
expect(checkpoints).toHaveBeenCalledTimes(2)
|
||||
})
|
||||
|
||||
it('图库直接链接只读取一次项目,未完成时可手动刷新解锁', async () => {
|
||||
@@ -84,7 +100,7 @@ describe('剧本完成前的下游访问限制', () => {
|
||||
await openProject('/projects/manual-gate/subject-images')
|
||||
await vi.advanceTimersByTimeAsync(30_000)
|
||||
expect(detail).toHaveBeenCalledTimes(1)
|
||||
expect(wrapper!.get('.project-access-gate').text()).toContain('请手动刷新项目状态')
|
||||
expect(wrapper!.get('.project-access-gate').text()).not.toContain('状态会自动更新')
|
||||
status = 'completed'
|
||||
const refresh = wrapper!.findAll('button').find(button => button.text() === '刷新项目状态')!
|
||||
await refresh.trigger('click')
|
||||
@@ -116,21 +132,24 @@ describe('剧本完成前的下游访问限制', () => {
|
||||
}
|
||||
)
|
||||
|
||||
it('未完成项目停留期间不自动解锁,仅在手动刷新后进入下游页面', async () => {
|
||||
it('轮询完成状态自动解锁;重新变为待审核时撤下下游面板', async () => {
|
||||
vi.useFakeTimers()
|
||||
let status: ProjectStatus = 'generating'
|
||||
vi.spyOn(projectsApi, 'detail').mockImplementation(async id => project(id, status))
|
||||
vi.spyOn(projectsApi, 'checkpoints').mockResolvedValue([])
|
||||
const { mounted } = await openProject('/projects/manual-refresh/production')
|
||||
const { mounted } = await openProject('/projects/polling/production')
|
||||
expect(mounted).not.toHaveBeenCalled()
|
||||
status = 'completed'
|
||||
await vi.advanceTimersByTimeAsync(6000)
|
||||
await flushPromises()
|
||||
expect(wrapper!.find('.workspace-probe').exists()).toBe(false)
|
||||
await wrapper!.get('.project-access-gate button:nth-of-type(2)').trigger('click')
|
||||
await flushPromises()
|
||||
expect(wrapper!.get('.workspace-probe').text()).toBe('production')
|
||||
expect(wrapper!.findAll('.n-menu a')).toHaveLength(9)
|
||||
status = 'need_review'
|
||||
await vi.advanceTimersByTimeAsync(6000)
|
||||
await flushPromises()
|
||||
expect(wrapper!.find('.workspace-probe').exists()).toBe(false)
|
||||
expect(wrapper!.get('.project-access-gate').text()).toContain('请先完成剧本创作')
|
||||
expect(wrapper!.findAll('.n-menu a')).toHaveLength(3)
|
||||
expect(mounted).toHaveBeenCalledExactlyOnceWith('production')
|
||||
})
|
||||
|
||||
@@ -158,7 +177,7 @@ describe('剧本完成前的下游访问限制', () => {
|
||||
expect(wrapper!.findAll('.n-menu a')).toHaveLength(2)
|
||||
})
|
||||
|
||||
it('读取失败保持锁定;错误区重试成功后解锁且不恢复项目标题栏', async () => {
|
||||
it('读取失败保持锁定;错误区重试成功后解锁,页头不恢复标签与刷新按钮', async () => {
|
||||
const detail = vi
|
||||
.spyOn(projectsApi, 'detail')
|
||||
.mockRejectedValueOnce(new Error('项目读取失败'))
|
||||
@@ -167,7 +186,8 @@ describe('剧本完成前的下游访问限制', () => {
|
||||
const { mounted } = await openProject('/projects/retry/storyboard')
|
||||
expect(mounted).not.toHaveBeenCalled()
|
||||
expect(wrapper!.findAll('.n-menu a')).toHaveLength(3)
|
||||
expect(wrapper!.find('.project-header').exists()).toBe(false)
|
||||
expect(wrapper!.find('.project-header .n-button').exists()).toBe(false)
|
||||
expect(wrapper!.find('.project-header .n-tag').exists()).toBe(false)
|
||||
await wrapper!.get('.project-notices button').trigger('click')
|
||||
await flushPromises()
|
||||
expect(detail).toHaveBeenCalledTimes(2)
|
||||
@@ -181,6 +201,33 @@ describe('剧本完成前的下游访问限制', () => {
|
||||
expect(isProjectComplete({ id: 'p', status: 'completed' }, 'p')).toBe(true)
|
||||
})
|
||||
|
||||
it('镜头提示词缺少主首帧时给出下一步,并定位到对应镜头的首帧生成', async () => {
|
||||
const projectId = 'guided-keyframe'
|
||||
vi.spyOn(projectsApi, 'detail').mockResolvedValue(project(projectId, 'completed'))
|
||||
vi.spyOn(projectsApi, 'checkpoints').mockResolvedValue([])
|
||||
const { router } = await openProject(`/projects/${projectId}/storyboard`)
|
||||
Object.assign(getOperation(projectId), {
|
||||
pending: false,
|
||||
label: '读取/生成镜头 3 提示词',
|
||||
error: '服务器内部错误 Shot 缺少可用于视频 0 秒起点校验的 Primary Keyframe: shot-db-2-3',
|
||||
notice: '',
|
||||
recovery: { target: 'keyframe', shotId: 'shot-db-2-3', episodeNo: 2 }
|
||||
})
|
||||
await flushPromises()
|
||||
|
||||
expect(wrapper!.get('.operation-guide').text()).toContain('缺少镜头主首帧')
|
||||
expect(wrapper!.get('.operation-guide').text()).toContain('先生成并确认主首帧')
|
||||
await wrapper!.get('.operation-guide button').trigger('click')
|
||||
await flushPromises()
|
||||
|
||||
expect(router.currentRoute.value.path).toBe(`/projects/${projectId}/production`)
|
||||
expect(router.currentRoute.value.query).toEqual({
|
||||
episodeNo: '2',
|
||||
shotId: 'shot-db-2-3',
|
||||
action: 'keyframe'
|
||||
})
|
||||
})
|
||||
|
||||
it('配置复选框居中对齐,输入表面随面板背景分层而非增加边框', () => {
|
||||
// 保护布局契约;实际像素对齐仍需浏览器视觉验收。
|
||||
const css = readAllStyles()
|
||||
|
||||
@@ -1409,6 +1409,33 @@ describe('工作台页面交互', () => {
|
||||
expect(wrapper.text()).toContain('<script>模型内容</script>')
|
||||
expect(wrapper.find('script').exists()).toBe(false)
|
||||
})
|
||||
|
||||
it('提示词生成缺少主首帧时保存当前剧集和镜头作为恢复位置', async () => {
|
||||
vi.stubGlobal(
|
||||
'fetch',
|
||||
vi.fn<typeof fetch>().mockResolvedValue(
|
||||
new Response(
|
||||
JSON.stringify({
|
||||
message:
|
||||
'服务器内部错误 Shot 缺少可用于视频 0 秒起点校验的 Primary Keyframe: shot-db-1-1'
|
||||
}),
|
||||
{ status: 500 }
|
||||
)
|
||||
)
|
||||
)
|
||||
wrapper = mount(ShotTools, {
|
||||
attachTo: document.body,
|
||||
props: { projectId: fixture.id, episodeNo: 1, shot: designedShot(), disabled: false }
|
||||
})
|
||||
|
||||
await confirmGeneration('读取/生成提示词')
|
||||
|
||||
expect(getOperation(fixture.id).recovery).toEqual({
|
||||
target: 'keyframe',
|
||||
shotId: 'shot-db-1-1',
|
||||
episodeNo: 1
|
||||
})
|
||||
})
|
||||
it('项目筛选无结果时可清除条件并返回真实列表', async () => {
|
||||
vi.stubGlobal(
|
||||
'fetch',
|
||||
|
||||
Reference in new issue
Block a user