feat: 接入分镜导演设计与即时视觉状态工作台

增加单集和批量生成、修复诊断、正式镜头检查、参考图、生成规格与视频提示词。
补齐接口契约、竞态保护和确认交互测试,保持现有两条工作流。
This commit is contained in:
GouJ committed 2026-08-28 14:14:25 +08:00
1 parent 2ee6f049f6
commit bae69c3c62
22 files changed
+2211 -11

No files matched your search

+152
View File
@@ -0,0 +1,152 @@
import type { Checkpoint } from '../../workflows/types'
import type { EpisodeShots } from '../../breakdown/types'
import type { DesignedShot, EpisodeDirections, EpisodeVisualStates, ShotDirection, ShotVisualState } from '../types'
/** 仅供自动测试导入的确定性 fixture,不在应用入口引用。 */
export const direction: ShotDirection = {
shotSize: 'medium',
cameraAngle: 'eye-level',
cameraMovement: 'static',
composition: '人物居左',
cameraPosition: '门口',
lensIntent: 'normal',
depthOfField: 'shallow',
visualIntent: '观察来信'
}
export const visualState: ShotVisualState = {
timeOfDay: '夜晚',
weather: '小雨',
atmosphere: '安静',
environmentTransientState: '雨水沿门框滴落',
continuityNote: '信封始终在右手',
subjects: [
{
subjectId: 'subject-db',
subjectFormId: 'form-db',
subjectRef: '@CH0001',
formName: '日常',
expression: '疑惑',
pose: '站立',
gaze: '信封',
position: '左侧',
transientState: '衣角湿润'
}
]
}
/** 一个有效的两 Beat 镜头快照,两个 Beat 都从 Shot 1 开始编号。 */
export function episodeShots(episodeNo = 1): EpisodeShots {
return {
episodeNo,
episodePlan: {
episodeNo,
episodeTitle: '来信',
storyGoal: '',
centralConflict: '',
emotionalArc: '',
pacing: '',
endingHook: '',
beats: []
},
beatShots: [1, 2].map(beatNo => ({
beatNo,
shots: [
{
shotNo: 1,
title: `第${episodeNo}集镜头${beatNo}`,
description: '门口收到一封信',
visualFocus: '信封',
subjectRefs: ['@CH0001'],
durationSeconds: 5
}
]
}))
}
}
/** 同时具备后端两个生成服务各自所需的嵌套与顶层字段。 */
export function storyboardCheckpoint(): Checkpoint {
const shots = [episodeShots(), episodeShots(2)]
return {
checkpointId: 'storyboard-ready',
workflowName: 'breakdown',
createdAt: '2026-08-28T00:00:00Z',
state: {
breakdownResult: { storyboardEpisodeShots: shots },
storyboardEpisodeShots: shots,
subjectCandidates: [
{
profileId: 'profile-domain',
name: '林知夏',
ref: '@CH0001',
description: '',
module: 'character',
appearance_prompt: ''
}
],
subjectForms: [
{
formId: 'form-domain',
profileId: 'profile-domain',
type: 'character',
name: '日常',
isDefault: true,
description: '',
appearancePrompt: ''
}
]
}
}
}
/** 使用正式数据库 ID,与 checkpoint 中的 shotNo 明确区分。 */
export function directionsResult(projectId: string, episodeNo = 1, complete = true): EpisodeDirections {
return {
projectId,
episodeNo,
shotCount: 2,
directionCount: complete ? 2 : 0,
coverage: complete ? 1 : 0,
beats: [1, 2].map(beatNo => ({
beatNo,
shots: [
{ shotId: `shot-db-${episodeNo}-${beatNo}`, shotNo: 1, direction: complete ? { ...direction } : null }
]
}))
}
}
/** VisualState GET 使用扁平环境字段,不能用领域输出代替。 */
export function visualStatesResult(projectId: string, episodeNo = 1, complete = false): EpisodeVisualStates {
return {
projectId,
episodeNo,
shotCount: 2,
visualStateCount: complete ? 2 : 0,
coverage: complete ? 1 : 0,
beats: [1, 2].map(beatNo => ({
beatNo,
shots: [
{
shotId: `shot-db-${episodeNo}-${beatNo}`,
shotNo: 1,
visualState: complete ? structuredClone(visualState) : null
}
]
}))
}
}
/** 镜头工具组件的正式数据输入。 */
export function designedShot(id = 'shot-db-1-1'): DesignedShot {
return {
shotId: id,
shotNo: 1,
beatNo: 1,
title: '来信',
description: '',
visualFocus: '',
direction: { ...direction },
visualState: structuredClone(visualState)
}
}