auto-save 2026-05-13 20:29 (~9)

This commit is contained in:
2026-05-13 20:29:23 +08:00
parent 989cc912ec
commit e79c33dabd
9 changed files with 315 additions and 120 deletions

View File

@@ -69,16 +69,19 @@ export interface StoryboardScene {
reference_ids?: string[]
}
export interface GeneratedVideoDraft {
export interface GeneratedVideo {
id: string
provider_id?: string
frame_idx: number
label: string
prompt: string
provider: "Quick Prompt" | "Seedance" | "Kling" | "Veo 3"
poster_url: string
model: string
status: "queued" | "in_progress" | "completed" | "failed"
url?: string
poster_url?: string
duration: number
progress: number
error?: string
created_at: number
status: "ready" | "queued" | "failed"
}
// 把 ImageRef 解析成可显示的 src URL
@@ -139,9 +142,16 @@ export interface Job {
frames: KeyFrame[]
transcript: TranscriptSegment[]
storyboard_images?: StoryboardImage[]
generated_videos?: GeneratedVideo[]
error?: string
}
export function apiAssetUrl(path?: string | null): string {
if (!path) return ""
if (/^https?:\/\//i.test(path)) return path
return `${API_BASE}${path.startsWith("/") ? "" : "/"}${path}`
}
export async function createJob(tkUrl: string): Promise<Job> {
const res = await fetch(`${API_BASE}/jobs`, {
method: "POST",
@@ -341,6 +351,32 @@ export async function updateStoryboard(
return res.json()
}
export async function generateStoryboardVideo(
jobId: string,
frameIdx: number,
body: {
prompt: string
duration?: number
subject_image?: ImageRef | null
scene_image?: ImageRef | null
product_image?: ImageRef | null
action_image?: ImageRef | null
model?: string
size?: string
},
): Promise<Job> {
const res = await fetch(`${API_BASE}/jobs/${jobId}/frames/${frameIdx}/storyboard/video`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(body),
})
if (!res.ok) {
const txt = await res.text().catch(() => "")
throw new Error(`generateStoryboardVideo ${res.status} ${txt.slice(0, 300)}`)
}
return res.json()
}
export async function deleteCutout(jobId: string, frameIdx: number, elementId: string, cutoutId: string): Promise<Job> {
const res = await fetch(`${API_BASE}/jobs/${jobId}/frames/${frameIdx}/elements/${elementId}/cutouts/${cutoutId}`, {
method: "DELETE",