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

+71
View File
@@ -0,0 +1,71 @@
import { request } from '../../lib/http'
import type {
DirectionGeneration,
EpisodeDirections,
EpisodeVisualStates,
PromptBatchResult,
ShotPromptResult,
ShotReferences,
StoryboardBatchInput,
StoryboardBatchResult,
VisualStateBatchInput,
VisualStateGeneration
} from './types'
import type { ShotGenerationSpec } from './generation-spec.types'
/** 项目路径编码集中处理,所有 storyboard 接口以 /api 为前缀。 */
function projectPath(id: string) {
return `/projects/${encodeURIComponent(id)}`
}
/** 正式 Shot ID 必须来自数据库 GET,不使用 checkpoint 中的编号替代。 */
function shotPath(id: string) {
return `/storyboard-shots/${encodeURIComponent(id)}`
}
/** Storyboard 路由契约;单集入口虽名为 generate-test,但 persist=true 才适用于工作台。 */
export const storyboardApi = {
directions: (id: string, episodeNo: number, signal?: AbortSignal) =>
request<EpisodeDirections>(`${projectPath(id)}/storyboard-directions?episodeNo=${episodeNo}`, { signal }),
visualStates: (id: string, episodeNo: number, signal?: AbortSignal) =>
request<EpisodeVisualStates>(`${projectPath(id)}/storyboard-visual-states?episodeNo=${episodeNo}`, { signal }),
generateDirection: (id: string, episodeNo: number) =>
request<DirectionGeneration>(`${projectPath(id)}/storyboard-directions/generate-test`, {
method: 'POST',
body: { episodeNo, persist: true },
timeoutMs: 0
}),
generateDirections: (id: string, input: StoryboardBatchInput) =>
request<StoryboardBatchResult>(`${projectPath(id)}/storyboard-directions/generate`, {
method: 'POST',
body: input,
timeoutMs: 0
}),
generateVisualState: (id: string, episodeNo: number, maxRepairAttempts: number) =>
request<VisualStateGeneration>(`${projectPath(id)}/storyboard-visual-states/generate-test`, {
method: 'POST',
body: { episodeNo, persist: true, maxRepairAttempts },
timeoutMs: 0
}),
generateVisualStates: (id: string, input: VisualStateBatchInput) =>
request<StoryboardBatchResult>(`${projectPath(id)}/storyboard-visual-states/generate`, {
method: 'POST',
body: input,
timeoutMs: 0
}),
references: (id: string, signal?: AbortSignal) => request<ShotReferences>(`${shotPath(id)}/references`, { signal }),
generationSpec: (id: string, signal?: AbortSignal) =>
request<ShotGenerationSpec>(`${shotPath(id)}/generation-spec`, { signal }),
generatePrompt: (id: string, force: boolean) =>
request<ShotPromptResult | null>(`${shotPath(id)}/video-prompt`, {
method: 'POST',
body: { force },
timeoutMs: 0
}),
generatePrompts: (id: string, input: StoryboardBatchInput) =>
request<PromptBatchResult>(`${projectPath(id)}/video-prompts/generate`, {
method: 'POST',
body: input,
timeoutMs: 0
})
}