forked from 77media/video-flow
处理页面
This commit is contained in:
parent
1aec298dd8
commit
19113f80d5
@ -1,5 +1,6 @@
|
|||||||
import { post } from './request';
|
import { post } from './request';
|
||||||
import { ApiResponse } from './common';
|
import { ApiResponse } from './common';
|
||||||
|
import { Character } from './video_flow';
|
||||||
|
|
||||||
// 创建剧集的数据类型
|
// 创建剧集的数据类型
|
||||||
export interface CreateScriptEpisodeRequest {
|
export interface CreateScriptEpisodeRequest {
|
||||||
@ -23,6 +24,25 @@ export interface CreateScriptEpisodeRequest {
|
|||||||
episode_sort?: number;
|
episode_sort?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 更新剧集的数据类型
|
||||||
|
export interface UpdateScriptEpisodeRequest {
|
||||||
|
id: number;
|
||||||
|
title?: string;
|
||||||
|
script_id?: number;
|
||||||
|
status?: number;
|
||||||
|
summary?: string;
|
||||||
|
atmosphere?: string;
|
||||||
|
scene?: string;
|
||||||
|
task_description?: string;
|
||||||
|
creator_name?: string;
|
||||||
|
cate_tags?: {
|
||||||
|
tags?: string[];
|
||||||
|
};
|
||||||
|
characters?: Character[];
|
||||||
|
episode_sort?: number;
|
||||||
|
video_url?: string;
|
||||||
|
}
|
||||||
|
|
||||||
// 创建剧集响应数据类型
|
// 创建剧集响应数据类型
|
||||||
export interface ScriptEpisode {
|
export interface ScriptEpisode {
|
||||||
id: number;
|
id: number;
|
||||||
@ -32,9 +52,16 @@ export interface ScriptEpisode {
|
|||||||
episode_sort: number;
|
episode_sort: number;
|
||||||
creator_name: string;
|
creator_name: string;
|
||||||
created_at: string;
|
created_at: string;
|
||||||
|
updated_at?: string;
|
||||||
|
video_url?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 创建剧集
|
// 创建剧集
|
||||||
export const createScriptEpisode = async (data: CreateScriptEpisodeRequest): Promise<ApiResponse<ScriptEpisode>> => {
|
export const createScriptEpisode = async (data: CreateScriptEpisodeRequest): Promise<ApiResponse<ScriptEpisode>> => {
|
||||||
return post<ApiResponse<ScriptEpisode>>('/script_episode/create', data);
|
return post<ApiResponse<ScriptEpisode>>('/script_episode/create', data);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 更新剧集
|
||||||
|
export const updateScriptEpisode = async (data: UpdateScriptEpisodeRequest): Promise<ApiResponse<ScriptEpisode>> => {
|
||||||
|
return post<ApiResponse<ScriptEpisode>>('/script_episode/update', data);
|
||||||
};
|
};
|
||||||
@ -2,6 +2,43 @@ import { post } from './request';
|
|||||||
import { ProjectTypeEnum } from './enums';
|
import { ProjectTypeEnum } from './enums';
|
||||||
import { ApiResponse } from './common';
|
import { ApiResponse } from './common';
|
||||||
|
|
||||||
|
// 场景/分镜头数据结构
|
||||||
|
export interface Scene {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
description: string;
|
||||||
|
plot: string;
|
||||||
|
dialogue: string;
|
||||||
|
narration: string;
|
||||||
|
imageUrl?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 角色数据结构
|
||||||
|
export interface Character {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
description: string;
|
||||||
|
personality: string;
|
||||||
|
appearance: string;
|
||||||
|
voice: string;
|
||||||
|
avatar?: string;
|
||||||
|
fullBodyImage?: string;
|
||||||
|
audioSample?: string;
|
||||||
|
styles?: string[];
|
||||||
|
currentStyle?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 剧本到分镜头提示词模型
|
||||||
|
export interface ScenePrompts {
|
||||||
|
scenes: Scene[]; // 分场景列表
|
||||||
|
characters?: Character[]; // 角色列表
|
||||||
|
summary?: string; // 剧情概要
|
||||||
|
scene?: string; // 场景描述
|
||||||
|
atmosphere?: string; // 氛围描述
|
||||||
|
episode_id?: number; // 剧集ID
|
||||||
|
total_shots?: string; // 总镜头数
|
||||||
|
}
|
||||||
|
|
||||||
// 剧本转分镜头请求接口
|
// 剧本转分镜头请求接口
|
||||||
export interface ScriptToSceneRequest {
|
export interface ScriptToSceneRequest {
|
||||||
script: string;
|
script: string;
|
||||||
@ -21,17 +58,8 @@ export interface VideoToSceneRequest {
|
|||||||
// 转换分镜头请求类型
|
// 转换分镜头请求类型
|
||||||
export type ConvertScenePromptRequest = ScriptToSceneRequest | VideoToSceneRequest;
|
export type ConvertScenePromptRequest = ScriptToSceneRequest | VideoToSceneRequest;
|
||||||
|
|
||||||
// 转换分镜头响应数据接口
|
|
||||||
export interface ConvertScenePromptData {
|
|
||||||
task_id: string;
|
|
||||||
status: string;
|
|
||||||
shots_count?: number; // 剧本模式返回的分镜头数量
|
|
||||||
video_url?: string; // 视频模式返回的视频链接
|
|
||||||
estimated_time: number; // 预估处理时间(秒)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 转换分镜头响应接口
|
// 转换分镜头响应接口
|
||||||
export type ConvertScenePromptResponse = ApiResponse<ConvertScenePromptData>;
|
export type ConvertScenePromptResponse = ApiResponse<ScenePrompts>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 将剧本或视频转换为分镜头提示词
|
* 将剧本或视频转换为分镜头提示词
|
||||||
|
|||||||
@ -17,7 +17,7 @@ import type { MenuProps } from 'antd';
|
|||||||
import Image from 'next/image';
|
import Image from 'next/image';
|
||||||
import dynamic from 'next/dynamic';
|
import dynamic from 'next/dynamic';
|
||||||
import { ProjectTypeEnum, ModeEnum, ResolutionEnum } from "@/api/enums";
|
import { ProjectTypeEnum, ModeEnum, ResolutionEnum } from "@/api/enums";
|
||||||
import { createScriptEpisode, CreateScriptEpisodeRequest } from "@/api/script_episode";
|
import { createScriptEpisode, CreateScriptEpisodeRequest, updateScriptEpisode, UpdateScriptEpisodeRequest } from "@/api/script_episode";
|
||||||
import { getUploadTokenWithDomain, uploadToQiniu } from "@/api/common";
|
import { getUploadTokenWithDomain, uploadToQiniu } from "@/api/common";
|
||||||
import { convertScriptToScene, convertVideoToScene } from "@/api/video_flow";
|
import { convertScriptToScene, convertVideoToScene } from "@/api/video_flow";
|
||||||
|
|
||||||
@ -148,6 +148,16 @@ export function CreateToVideo2() {
|
|||||||
}
|
}
|
||||||
convertResponse = await convertVideoToScene(videoUrl, episodeId, projectId);
|
convertResponse = await convertVideoToScene(videoUrl, episodeId, projectId);
|
||||||
}
|
}
|
||||||
|
// 更新剧集
|
||||||
|
const updateEpisodeData: UpdateScriptEpisodeRequest = {
|
||||||
|
id: episodeId,
|
||||||
|
atmosphere: convertResponse.data.atmosphere,
|
||||||
|
summary: convertResponse.data.summary,
|
||||||
|
scene: convertResponse.data.scene,
|
||||||
|
characters: convertResponse.data.characters,
|
||||||
|
};
|
||||||
|
const updateEpisodeResponse = await updateScriptEpisode(updateEpisodeData);
|
||||||
|
|
||||||
// 检查转换结果
|
// 检查转换结果
|
||||||
if (convertResponse.code === 0) {
|
if (convertResponse.code === 0) {
|
||||||
// 成功创建后跳转到work-flow页面, 并设置episodeId 和 projectType
|
// 成功创建后跳转到work-flow页面, 并设置episodeId 和 projectType
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user