feat: 同步镜头首帧与视频生产工作区
This commit is contained in:
1 parent
669f4d9df0
commit
aeb3ce2986
16 files changed
+1802
-5
No files matched your search
@@ -0,0 +1,94 @@
|
||||
import { request } from '../../lib/http'
|
||||
import type { PromptBatchResult, StoryboardBatchInput } from '../storyboard/types'
|
||||
import type {
|
||||
GenerateKeyframeInput,
|
||||
GenerateKeyframesInput,
|
||||
GenerateVideosInput,
|
||||
KeyframeBatchResult,
|
||||
KeyframeReadiness,
|
||||
KeyframeSpec,
|
||||
ProjectVideoStatus,
|
||||
PromptReadiness,
|
||||
RetryVideosResult,
|
||||
ShotKeyframe,
|
||||
ShotVideo,
|
||||
VideoBatchResult,
|
||||
VideoGenerationSpec,
|
||||
VideoReadiness
|
||||
} from './types'
|
||||
|
||||
/** 项目路径统一编码,避免业务组件手工拼接 ID。 */
|
||||
function projectPath(id: string) {
|
||||
return `/projects/${encodeURIComponent(id)}`
|
||||
}
|
||||
|
||||
/** 正式镜头路径统一编码,只接受数据库 Shot ID。 */
|
||||
function shotPath(id: string) {
|
||||
return `/storyboard-shots/${encodeURIComponent(id)}`
|
||||
}
|
||||
|
||||
/** 生产链 API;生成请求不设置客户端短超时,也不自动重试。 */
|
||||
export const productionApi = {
|
||||
promptReadiness: (projectId: string, force: boolean, signal?: AbortSignal) =>
|
||||
request<PromptReadiness>(`${projectPath(projectId)}/video-prompts/readiness?force=${force}`, { signal }),
|
||||
generatePrompts: (projectId: string, input: StoryboardBatchInput) =>
|
||||
request<PromptBatchResult>(`${projectPath(projectId)}/video-prompts/generate`, {
|
||||
method: 'POST',
|
||||
body: input,
|
||||
timeoutMs: 0
|
||||
}),
|
||||
keyframeReadiness: (projectId: string, force: boolean, signal?: AbortSignal) =>
|
||||
request<KeyframeReadiness>(`${projectPath(projectId)}/keyframes/readiness?force=${force}`, { signal }),
|
||||
generateKeyframes: (projectId: string, input: GenerateKeyframesInput) =>
|
||||
request<KeyframeBatchResult>(`${projectPath(projectId)}/keyframes/generate`, {
|
||||
method: 'POST',
|
||||
body: input,
|
||||
timeoutMs: 0
|
||||
}),
|
||||
videoReadiness: (projectId: string, force: boolean, signal?: AbortSignal) =>
|
||||
request<VideoReadiness>(`${projectPath(projectId)}/videos/readiness?force=${force}`, { signal }),
|
||||
generateVideos: (projectId: string, input: GenerateVideosInput) =>
|
||||
request<VideoBatchResult>(`${projectPath(projectId)}/videos/generate`, {
|
||||
method: 'POST',
|
||||
body: input,
|
||||
timeoutMs: 0
|
||||
}),
|
||||
projectVideoStatus: (projectId: string, signal?: AbortSignal) =>
|
||||
request<ProjectVideoStatus>(`${projectPath(projectId)}/videos/status`, { signal }),
|
||||
retryVideos: (projectId: string, concurrency: number) =>
|
||||
request<RetryVideosResult>(`${projectPath(projectId)}/videos/retry-failed`, {
|
||||
method: 'POST',
|
||||
body: { provider: 'seedance', concurrency },
|
||||
timeoutMs: 0
|
||||
}),
|
||||
listKeyframes: (shotId: string, signal?: AbortSignal) =>
|
||||
request<ShotKeyframe[]>(`${shotPath(shotId)}/keyframes`, { signal }),
|
||||
keyframeSpec: (shotId: string, signal?: AbortSignal) =>
|
||||
request<KeyframeSpec>(`${shotPath(shotId)}/keyframe-spec`, { signal }),
|
||||
generateKeyframe: (shotId: string, input: GenerateKeyframeInput) =>
|
||||
request<ShotKeyframe | null>(`${shotPath(shotId)}/keyframe`, {
|
||||
method: 'POST',
|
||||
body: input,
|
||||
timeoutMs: 0
|
||||
}),
|
||||
setPrimaryKeyframe: (shotId: string, keyframeId: string) =>
|
||||
request<ShotKeyframe | null>(`${shotPath(shotId)}/keyframes/${encodeURIComponent(keyframeId)}/primary`, {
|
||||
method: 'PUT'
|
||||
}),
|
||||
videoGenerationSpec: (shotId: string, signal?: AbortSignal) =>
|
||||
request<VideoGenerationSpec>(`${shotPath(shotId)}/video-generation-spec`, { signal }),
|
||||
listVideos: (shotId: string, signal?: AbortSignal) =>
|
||||
request<ShotVideo[]>(`${shotPath(shotId)}/videos`, { signal }),
|
||||
generateVideo: (shotId: string) =>
|
||||
request<ShotVideo | null>(`${shotPath(shotId)}/videos`, {
|
||||
method: 'POST',
|
||||
body: { provider: 'seedance' },
|
||||
timeoutMs: 0
|
||||
}),
|
||||
refreshVideo: (videoId: string, signal?: AbortSignal) =>
|
||||
request<ShotVideo | null>(`/storyboard-shot-videos/${encodeURIComponent(videoId)}/status`, { signal }),
|
||||
setPrimaryVideo: (shotId: string, videoId: string) =>
|
||||
request<ShotVideo | null>(`${shotPath(shotId)}/videos/${encodeURIComponent(videoId)}/primary`, {
|
||||
method: 'PUT'
|
||||
})
|
||||
}
|
||||
Reference in new issue
Block a user