完成极速成品和脚本优化
This commit is contained in:
@@ -43,6 +43,7 @@ import type {
|
||||
TeamMember,
|
||||
User,
|
||||
UserPreference,
|
||||
VideoDigestHistory,
|
||||
VoiceoverInfo
|
||||
} from "./types";
|
||||
import type { PresentationFormat, VideoStructure } from "./script-setup";
|
||||
@@ -59,6 +60,51 @@ const FRIENDLY_AUTH_MISSING_MESSAGE = "登录状态异常,请刷新页面后
|
||||
|
||||
export type RememberInfo = { username: string; expireAt: number };
|
||||
|
||||
export type QuickCreateJob = {
|
||||
id: string;
|
||||
project_id: string;
|
||||
product_id: string;
|
||||
product_name: string;
|
||||
title: string;
|
||||
product_images: Array<{ asset_id: string; url: string }>;
|
||||
status: "queued" | "running" | "succeeded" | "failed" | "cancelled";
|
||||
phase: "product" | "script" | "assets" | "production" | "complete";
|
||||
phase_index: number;
|
||||
progress: number;
|
||||
message: string;
|
||||
error_message: string;
|
||||
settings: {
|
||||
aspect_ratio: string;
|
||||
resolution: string;
|
||||
total_duration: number;
|
||||
video_model_config_id: string;
|
||||
video_model_name: string;
|
||||
video_model_label: string;
|
||||
};
|
||||
result: null | {
|
||||
video_url: string;
|
||||
poster_url: string;
|
||||
duration_seconds: number;
|
||||
aspect_ratio: string;
|
||||
resolution: string;
|
||||
video_model: string;
|
||||
structure: string;
|
||||
presentation: string;
|
||||
person: string;
|
||||
scene: string;
|
||||
video_segments: Array<{
|
||||
id: string;
|
||||
sort_order: number;
|
||||
duration_seconds: number;
|
||||
video_url: string;
|
||||
poster_url: string;
|
||||
}>;
|
||||
};
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
completed_at: string | null;
|
||||
};
|
||||
|
||||
export function getRemember(): RememberInfo | null {
|
||||
try {
|
||||
const raw = localStorage.getItem(REMEMBER_KEY);
|
||||
@@ -317,6 +363,18 @@ export const api = {
|
||||
createProject(payload: { name: string; product: string; metadata?: Record<string, unknown> }) {
|
||||
return request<Project>("/api/projects/", { method: "POST", body: JSON.stringify(payload) });
|
||||
},
|
||||
startQuickCreate(formData: FormData) {
|
||||
return request<QuickCreateJob>("/api/projects/quick-create/", { method: "POST", body: formData });
|
||||
},
|
||||
quickCreateStatus(jobId: string) {
|
||||
return request<QuickCreateJob>(`/api/projects/quick-create-status/${jobId}/`);
|
||||
},
|
||||
cancelQuickCreate(jobId: string) {
|
||||
return request<QuickCreateJob>(`/api/projects/quick-create-cancel/${jobId}/`, { method: "POST" });
|
||||
},
|
||||
quickCreateHistory() {
|
||||
return request<{ count: number; results: QuickCreateJob[] }>("/api/projects/quick-create-history/");
|
||||
},
|
||||
// 整体替换 metadata —— 调用方务必先展开现有 project.metadata 再合并,别把别的 key 冲掉
|
||||
updateProject(id: string, payload: { name?: string; metadata?: Record<string, unknown> }) {
|
||||
return request<Project>(`/api/projects/${id}/`, { method: "PATCH", body: JSON.stringify(payload) });
|
||||
@@ -350,11 +408,37 @@ export const api = {
|
||||
},
|
||||
// 视频提炼页:不绑项目,整段视频交给 Gemini 出中文分镜稿。慢(约 1–2 分钟),固定 30 积分,失败退还。
|
||||
extractVideoDigest(formData: FormData) {
|
||||
return request<{ name: string; chars: number; text: string; frames: number; duration: number; input?: string; estimated_cost?: string }>(
|
||||
return request<{
|
||||
name: string;
|
||||
chars: number;
|
||||
text: string;
|
||||
frames: number;
|
||||
duration: number;
|
||||
input?: string;
|
||||
estimated_cost?: string;
|
||||
task_id?: string;
|
||||
title?: string;
|
||||
file_name?: string;
|
||||
ratio?: string;
|
||||
shots?: number;
|
||||
cover_url?: string;
|
||||
video_url?: string;
|
||||
width?: number;
|
||||
height?: number;
|
||||
}>(
|
||||
"/api/ai/video-digest/",
|
||||
{ method: "POST", body: formData }
|
||||
);
|
||||
},
|
||||
listVideoDigests() {
|
||||
return request<{ results: VideoDigestHistory[]; total: number }>("/api/ai/video-digest/");
|
||||
},
|
||||
saveVideoDigest(id: string, prompt: string) {
|
||||
return request<VideoDigestHistory>(`/api/ai/video-digest/${id}/`, {
|
||||
method: "PATCH",
|
||||
body: JSON.stringify({ prompt }),
|
||||
});
|
||||
},
|
||||
// ── 套路模板(5.1 存 / 5.2 换商品重跑)· 团队隔离 ──
|
||||
// 存模板只抽套路不抽文案:后端从这版脚本抽镜数/每镜作用/节奏/商品露出/转化写法。
|
||||
saveProjectAsTemplate(projectId: string, payload: { name: string; script_version_id?: string }) {
|
||||
|
||||
Reference in New Issue
Block a user