video-flow-b/api/DTO/movieEdit.ts
2025-09-16 16:48:36 +08:00

702 lines
14 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* 视频流程项目相关的TypeScript类型定义
* 包含角色、场景、服装、音乐等完整的数据结构
*/
/**
* 角色性别枚举
*/
export enum Gender {
MALE = 'male',
FEMALE = 'female'
}
/**
* 角色种族枚举
*/
export enum Race {
WESTERN = 'Western',
ASIAN = 'Asian',
AFRICAN = 'African',
LATINO = 'Latino',
MIDDLE_EASTERN = 'Middle Eastern',
MIXED = 'Mixed'
}
/**
* 角色类型枚举
*/
export enum RoleType {
PROTAGONIST = 'Protagonist',
ANTAGONIST = 'Antagonist',
SUPPORTING = 'Supporting',
BACKGROUND = 'Background'
}
/**
* 项目状态枚举
*/
export enum ProjectStatus {
COMPLETED = 'COMPLETED',
IN_PROGRESS = 'IN_PROGRESS',
PENDING = 'PENDING',
FAILED = 'FAILED'
}
/**
* 项目步骤枚举
*/
export enum ProjectStep {
INIT = 'INIT',
SKETCH = 'SKETCH',
CHARACTER = 'CHARACTER',
SHOT_SKETCH = 'SHOT_SKETCH',
VIDEO = 'VIDEO',
FINAL = 'FINAL'
}
/**
* 项目模式枚举
*/
export enum ProjectMode {
AUTOMATIC = 'automatic',
MANUAL = 'manual',
HYBRID = 'hybrid'
}
/**
* 分辨率枚举
*/
export enum Resolution {
P720 = '720p',
P1080 = '1080p',
P4K = '4K'
}
/**
* 语言枚举
*/
export enum Language {
EN = 'en',
ZH = 'zh',
JA = 'ja',
KO = 'ko'
}
/**
* 草图提示JSON结构接口
*/
export interface SketchPromptJson {
/** 草图名称 */
sketch_name: string;
/** 草图描述 */
sketch_description: string;
/** 核心氛围 */
core_atmosphere: string;
}
/**
* 草图数据项
*/
export interface SketchData {
/** 草图名称 */
sketch_name: string;
/** 图片ID */
image_id: string;
/** 提示词 */
prompt: string;
/** 提示词JSON */
prompt_json: SketchPromptJson;
/** 图片路径 */
image_path: string;
}
/**
* 草图响应数据接口
*/
export interface SketchResponse {
/** 总数 */
total_count: number;
/** 草图数据列表 */
data: SketchData[];
/** 任务状态 */
task_status: string;
}
/**
* 角色响应数据接口
*/
export interface CharacterResponse {
/** 角色图片路径 */
image_path: string;
/** 角色名称 */
character_name: string;
/** 角色描述 */
character_description: string;
}
/**
* 角色数据接口
*/
export interface CharacterData {
/** 角色数据列表 */
data: CharacterResponse[];
/** 总数 */
total_count: number;
/** 任务状态 */
task_status: string;
}
/**
* 镜头草图提示JSON结构接口
*/
export interface ShotSketchPromptJson {
/** 镜头类型 */
shot_type: string;
/** 帧描述 */
frame_description: string;
/** 关键动作 */
key_action: string;
/** 氛围 */
atmosphere: string;
/** 摄影蓝图构图 */
cinematography_blueprint_composition: string;
/** 摄影蓝图镜头运动 */
cinematography_blueprint_camera_motion: string;
/** 对话表演台词 */
dialogue_performance_line?: any;
/** 对话表演语言 */
dialogue_performance_language?: any;
/** 对话表演表达 */
dialogue_performance_delivery?: any;
/** 对话表演说话者 */
dialogue_performance_speaker?: any;
}
/**
* 镜头草图数据项
*/
export interface ShotSketchData {
/** 图片ID */
image_id: string;
/** 描述 */
description: string;
/** 提示词JSON */
prompt_json: ShotSketchPromptJson;
/** 图片URL */
url: string;
}
/**
* 镜头草图响应数据接口
*/
export interface ShotSketchResponse {
/** 镜头草图数据列表 */
data: ShotSketchData[];
/** 总数 */
total_count: number;
/** 任务状态 */
task_status: string;
}
/**
* 主要角色列表项
*/
export interface MasterCharacterListItem {
/** 角色ID */
id: string;
/** 角色名称 */
name: string;
/** 角色描述 */
description: string;
}
/**
* 主要服装列表项
*/
export interface MasterWardrobeListItem {
/** 所属角色 */
belongs_to: string;
/** 服装描述 */
description: string;
}
/**
* 主要场景列表项
*/
export interface MasterSceneListItem {
/** 场景名称 */
name: string;
/** 场景描述 */
description: string;
}
/**
* 视频提示JSON结构接口
*/
export interface VideoPromptJson {
/** 导演指令 */
directors_directive: string;
/** 叙事提示 */
narrative_prompt: string;
/** 对话语言 */
dialogue_language: string;
/** 整体项目风格 */
overall_project_style: string;
/** 主要角色列表 */
master_character_list: MasterCharacterListItem[];
/** 主要服装列表 */
master_wardrobe_list: MasterWardrobeListItem[];
/** 主要场景列表 */
master_scene_list: MasterSceneListItem[];
/** 核心氛围 */
core_atmosphere: string;
}
/**
* 视频数据项
*/
export interface VideoData {
/** 视频ID */
video_id: string;
/** 描述 */
description: string;
/** 提示词JSON */
prompt_json: VideoPromptJson;
/** 视频名称前缀 */
video_name_prefix: string;
/** 视频URL列表 */
urls: string[];
/** 视频状态 */
video_status: number;
}
/**
* 视频响应数据接口
*/
export interface VideoResponse {
/** 视频数据列表 */
data: VideoData[];
/** 总数 */
total_count: number;
/** 全局ID */
guid: string;
/** 项目ID */
project_id: string;
/** 任务状态 */
task_status: string;
}
/**
* 音乐数据接口
*/
export interface MusicData {
[key: string]: any;
}
/**
* 最终视频接口
*/
export interface FinalVideo {
/** 最终视频URL */
video: string;
}
/**
* 多语言视频接口
*/
export interface MultilingualVideo {
[key: string]: any;
}
/**
* 项目内容数据接口
*/
export interface ProjectContentData {
/** 草图数据 */
sketch: SketchResponse;
/** 角色数据 */
character: CharacterData;
/** 镜头草图数据 */
shot_sketch: ShotSketchResponse;
/** 视频数据 */
video: VideoResponse;
/** 音乐数据 */
music: MusicData;
/** 粗剪视频 */
final_simple_video: FinalVideo;
/** 最终视频 */
final_video: FinalVideo;
/** 多语言视频 */
multilingual_video: MultilingualVideo;
}
/**
* 视频流程项目 - 完整的接口返回值类型
*/
export interface VideoFlowProjectResponse {
/** 项目名称 */
name: string;
/** 项目ID */
project_id: string;
/** 项目模式 */
mode: string;
/** 分辨率 */
resolution: string;
/** 语言 */
language: string;
/** 原始文本 */
original_text: string;
/** 生成的脚本 */
generated_script: string;
/** 项目状态 */
status: string;
/** 项目标题 */
title: string;
/** 项目类型 */
genre: string;
/** 项目标签 */
tags: string[];
/** 项目步骤 */
step: string;
/** 最后消息 */
last_message: string;
/** 项目内容 */
data: ProjectContentData;
/** 最终简单视频 */
final_simple_video: string;
/** 最终视频 */
final_video: string;
}
/**
* 新角色列表项接口
*/
export interface NewCharacterItem {
/** 角色名称 */
character_name: string;
/** 角色描述 */
character_description: string;
/** 角色类型 */
role: string;
/** 图片路径 */
image_path: string;
/** 语音ID */
voice_id: string;
/** 语音URL */
voice_url: string;
/** 语音描述 */
voice_desc: string;
/** 简介 */
brief: string;
/** 性别 */
gender: string;
/** 体型年龄 */
physique_age: string;
/** 关键视觉锚点 */
key_visual_anchors: string;
/** 发型 */
hairstyle: string;
/** 默认表情 */
default_demeanor: string;
/** 种族 */
race: string;
}
/**
* 新角色列表响应接口
*/
export interface NewCharacterListResponse {
/** 角色列表 */
data: NewCharacterItem[];
}
/**
* 项目角色列表请求参数
*/
export interface CharacterListByProjectRequest {
/** 项目ID */
project_id: string;
/** 每个角色最多提取的高亮关键词数量 */
max_keywords?: number;
}
/**
* 项目角色列表项(含高亮关键词)
*/
export interface CharacterListByProjectItem {
/** 角色名称 */
character_name: string;
/** 角色自然语言描述 */
character_description: string;
/** 角色类型/作用 */
role?: string;
/** 角色图片URL */
image_path?: string;
/** 角色语音ID */
voice_id?: string;
/** 角色语音音频URL */
voice_url?: string;
/** 角色语音描述 */
voice_desc?: string;
/** 角色简要说明/摘要 */
brief?: string;
/** 性别 */
gender?: string;
/** 体格与年龄描述 */
physique_age?: string;
/** 关键视觉锚点 */
key_visual_anchors?: string;
/** 发型描述 */
hairstyle?: string;
/** 默认行为/性格 */
default_demeanor?: string;
/** 种族/人种 */
race?: string;
/** 从角色描述提取的高亮关键词/短语 */
highlights: string[];
}
/**
* 项目角色列表响应
*/
export interface CharacterListByProjectWithHighlightResponse {
/** 项目ID */
project_id: string;
/** 角色列表 */
characters: CharacterListByProjectItem[];
}
/**
* 角色更新和重新生成请求参数
*/
export interface CharacterUpdateAndRegenerateRequest {
/** 项目ID */
project_id: string;
/** 角色名称 */
character_name: string;
/** 新的角色描述 */
character_description: string;
/** 返回的高亮关键词数量上限 */
max_keywords?: number;
}
/**
* 角色更新和重新生成响应
*/
export interface CharacterUpdateAndRegenerateResponse {
/** 角色名称 */
character_name: string;
/** 角色描述(已更新) */
character_description: string;
/** 重新生成产物的图片地址 */
image_url?: string;
/** 从角色描述提取的高亮关键词/短语 */
highlights: string[];
}
/**
* 角色描述生成请求接口
*/
export interface CharacterGenerateDescriptionRequest {
/** 前端提供的原始文字描述 */
original_text: string;
/** 优化类型 */
optimization_type?: string;
/** 风格偏好 */
style_preference?: string;
}
/**
* 角色描述生成响应接口
*/
export interface CharacterGenerateDescriptionResponse {
/** 原始文本 */
original_text: string;
/** 优化后的角色描述 */
optimized_description: string;
/** 提取的关键词 */
keywords: string[];
/** 优化类型 */
optimization_type: string;
/** 风格偏好 */
style_preference: string;
}/**
* 边界框坐标信息
* @description 描述检测到的人物在图片中的位置和尺寸
*/
export interface BoundingBox {
/** X坐标像素 */
x: number;
/** Y坐标像素 */
y: number;
/** 宽度(像素) */
width: number;
/** 高度(像素) */
height: number;
}
/**
* 匹配的人物信息
* @description 从图片中识别出的与已知角色匹配的人物信息
*/
export interface MatchedPerson {
/** 人物名 */
person_id: string;
/**x坐标 小数百分比形式 */
x: number;
/**y坐标 小数百分比形式 */
y: number;
/**宽度 小数百分比形式 */
width: number;
/**高度 小数百分比形式 */
height: number;
}
/**
* 角色识别响应结果
* @description API返回的角色识别完整响应
*/
export interface RecognitionResult {
/** 响应状态码 */
code: number;
/** 响应消息 */
message: string;
/** 识别结果数据 */
data: MatchedPerson[];
}
/**
* 使用的角色信息
* @description 在识别过程中使用的已知角色信息
*/
export interface CharacterUsed {
/** 角色名称 */
character_name: string;
/** 角色C-ID */
c_id: string;
/** 角色描述 */
character_description: string;
/** 角色图片路径 */
image_path: string;
/** 角色头像 */
avatar: string;
}
/**
* 角色识别API响应类型
* @description 完整的角色识别API响应结构
*/
export interface RoleRecognitionResponse {
/** 项目ID */
project_id: string;
/** 视频ID */
video_id: string;
/** 目标图片URL */
target_image_url: string;
/** 已知人物数量 */
known_persons_count: number;
/** 识别结果 */
recognition_result: RecognitionResult;
/** 使用的角色列表 */
characters_used: CharacterUsed[];
}
export interface RoleResponse {
data: {
/** 角色描述 */
character_description: string;
/** 角色名称 */
character_name: string;
/** 高亮关键词 */
highlights: string[];
/** 角色图片地址 */
image_path: string;
/** 角色图片地址 */
image_url: string;
}[];
/**缓存 */
character_draft: string;
}
export interface RealRoleResponse {
system_characters: [];
project_characters: RoleResponse[];
}
export interface Role {
name: string;
url: string;
status: number;
type: string;
}
interface Scene {
url: string;
script: string;
status: number;
type: string;
}
interface ShotSketch {
url: string;
script: string;
status: number;
type: string;
}
export interface ShotVideo {
video_id: string;
urls: string[];
video_status: number;
type: string;
}
// 执行loading文字映射
export const LOADING_TEXT_MAP = {
getInfo: 'Getting information...',
initializing: 'initializing project...',
script: 'Generating script...',
getSketchStatus: 'Getting sketch status...',
sketch: (count: number, total: number) => `Generating sketch ${count}/${total}...`,
character: 'Getting character status...',
newCharacter: (count: number, total: number) => `Drawing character ${count}/${total}...`,
getShotSketchStatus: 'Getting shot sketch status...',
shotSketch: (count: number, total: number) => `Generating shot sketch ${count}/${total}...`,
getVideoStatus: 'Getting video status...',
video: (count: number, total: number) => `Generating video ${count}/${total}...`,
audio: 'Generating background audio...',
postProduction: (step: string) => `Post-production: ${step}...`,
final: 'Generating final product...',
complete: 'Task completed',
toManyFailed: 'Too many failed storyboards, Please click the scissors button to go to the intelligent editing platform.',
editingError: 'Editing failed. Please click the scissors button to go to the intelligent editing platform.'
} as const;
export type Status = 'IN_PROGRESS' | 'COMPLETED' | 'FAILED';
export type Stage = 'init' | 'script' | 'character' | 'scene' | 'shot_sketch' | 'video' | 'final_video';
// 添加 TaskObject 接口
export interface TaskObject {
title: string; // 标题
tags?: any[]; // 主题
currentStage: Stage; // 当前阶段
status: Status; // 状态
roles: {
data: Role[];
total_count: number;
}; // 角色
scenes: {
data: Scene[];
total_count: number;
}; // 场景
videos: {
data: ShotVideo[];
total_count: number;
}; // 视频
final: {
url: string;
note: string;
}; // 剪辑视频
}