小更改

This commit is contained in:
海龙 2025-08-13 14:06:00 +08:00
parent c5a4b6d731
commit 5c0554f2f7
8 changed files with 691 additions and 667 deletions

616
api/DTO/movieEdit.ts Normal file
View File

@ -0,0 +1,616 @@
/**
* 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[];
}
/**
*
*/
export interface CharacterResponse {
/** 角色图片路径 */
image_path: string;
/** 角色名称 */
character_name: string;
/** 角色描述 */
character_description: string;
}
/**
*
*/
export interface CharacterData {
/** 角色数据列表 */
data: CharacterResponse[];
/** 总数 */
total_count: number;
}
/**
* 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;
}
/**
*
*/
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[];
}
/**
*
*/
export interface VideoResponse {
/** 视频数据列表 */
data: VideoData[];
/** 总数 */
total_count: number;
/** 全局ID */
guid: string;
/** 项目ID */
project_id: 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_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;
}
/**
*
*/
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 AI识别图片中人物后的详细结果
*/
export interface RecognitionResultData {
/** 目标图片URL */
target_image_url: string;
/** 检测到的总人数 */
total_persons_detected: number;
/** 匹配的人物列表 */
matched_persons: MatchedPerson[];
}
/**
*
* @description API返回的角色识别完整响应
*/
export interface RecognitionResult {
/** 响应状态码 */
code: number;
/** 响应消息 */
message: string;
/** 识别结果数据 */
data: RecognitionResultData;
}
/**
* 使
* @description 使
*/
export interface CharacterUsed {
/** 角色名称 */
character_name: string;
/** 角色C-ID */
c_id: 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 {
/** 角色描述 */
character_description: string;
/** 角色名称 */
character_name: string;
/** 高亮关键词 */
highlights: string[];
/** 角色图片地址 */
image_path: string;
/**缓存 */
character_draft: string;
}

View File

@ -1,518 +0,0 @@
/**
* 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[];
}
/**
*
*/
export interface CharacterResponse {
/** 角色图片路径 */
image_path: string;
/** 角色名称 */
character_name: string;
/** 角色描述 */
character_description: string;
}
/**
*
*/
export interface CharacterData {
/** 角色数据列表 */
data: CharacterResponse[];
/** 总数 */
total_count: number;
}
/**
* 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;
}
/**
*
*/
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[];
}
/**
*
*/
export interface VideoResponse {
/** 视频数据列表 */
data: VideoData[];
/** 总数 */
total_count: number;
/** 全局ID */
guid: string;
/** 项目ID */
project_id: 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_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;
}
// 为了向后兼容,保留原有的接口名称
export interface Character extends CharacterResponse {}
export interface Sketch extends SketchResponse {}
export interface Shot_sketch extends ShotSketchResponse {}
export interface Video extends VideoResponse {}
export interface Music extends MusicData {}
export interface Final_video extends FinalVideo {}
export interface Multilingual_video extends MultilingualVideo {}
export interface RootObject extends VideoFlowProjectResponse {}
/**
*
*/
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;
}

View File

@ -15,9 +15,9 @@ import {
ScriptSlice,
} from "@/app/service/domain/valueObject";
import { task_item, VideoSegmentEntityAdapter } from "@/app/service/adapter/oldErrAdapter";
import { VideoFlowProjectResponse, NewCharacterItem, NewCharacterListResponse, CharacterListByProjectWithHighlightResponse, CharacterUpdateAndRegenerateRequest, CharacterUpdateAndRegenerateResponse } from "./allMovieType";
import { RoleResponse } from "@/app/service/usecase/RoleEditUseCase";
import { RoleRecognitionResponse } from "@/app/service/usecase/ShotEditUsecase";
import { VideoFlowProjectResponse, NewCharacterItem, NewCharacterListResponse, CharacterListByProjectWithHighlightResponse, CharacterUpdateAndRegenerateRequest, CharacterUpdateAndRegenerateResponse } from "./DTO/movieEdit";
import { RoleResponse } from "./DTO/movieEdit";
import { RoleRecognitionResponse } from "./DTO/movieEdit";
/**
*
@ -1064,4 +1064,17 @@ export const analyzeImageDescription = async (request: {
}>>("/character/analyze_image_description", request);
};
/**
*
* @description
* @param request -
* @returns Promise<ApiResponse<any>>
*/
export const checkShotVideoStatus = async (request: {
/** 项目ID */
project_id: string;
}): Promise<ApiResponse<any>> => {
return post<ApiResponse<any>>("/check_shot_video_status", request);
};

View File

@ -2,7 +2,7 @@ import { useState, useCallback, useMemo } from 'react';
import { RoleEntity, AITextEntity } from '../domain/Entities';
import { RoleEditUseCase } from '../usecase/RoleEditUseCase';
import { getUploadToken, uploadToQiniu } from '@/api/common';
import { analyzeImageDescription } from '@/api/video_flow';
import { analyzeImageDescription, checkShotVideoStatus } from '@/api/video_flow';
/**
* Hook返回值接口
@ -38,6 +38,8 @@ interface UseRoleService {
uploadImageAndUpdateRole: (file: File) => Promise<void>;
/** 保存重新生成的角色到角色库 */
saveRoleToLibrary: () => Promise<void>;
/** 保存数据 */
saveData: () => Promise<void>;
}
/**
@ -419,6 +421,33 @@ export const useRoleServiceHook = (): UseRoleService => {
}
}, [selectedRole, roleEditUseCase, projectId]);
/**
*
* @description
* @throws {Error} ID或API调用失败时抛出错误
* @returns {Promise<void>} Promise
*/
const saveData = useCallback(async () => {
if (!projectId) {
throw new Error('缺少项目ID无法保存数据');
}
try {
const result = await checkShotVideoStatus({
project_id: projectId
});
if (!result.successful) {
throw new Error(`保存数据失败: ${result.message}`);
}
console.log('数据保存成功');
} catch (error) {
console.error('保存数据失败:', error);
throw error;
}
}, [projectId]);
return {
// 响应式数据
roleList,
@ -436,6 +465,7 @@ export const useRoleServiceHook = (): UseRoleService => {
fetchUserRoleLibrary,
replaceRoleWithLibrary,
uploadImageAndUpdateRole,
saveRoleToLibrary
saveRoleToLibrary,
saveData
};
};

View File

@ -175,7 +175,7 @@ export const useRoleShotServiceHook = (projectId: string,selectRole?:RoleEntity)
// 循环调用接口,为每个选中的分镜单独调用
shotSelectionList.forEach(async (shot) => {
try {
(selectedRole as any).shot = shot.videoUrl;
(selectedRole as any).shot = shot;
// 调用应用角色到分镜接口(不等待完成)
applyRoleToShots({
project_id: projectId,

View File

@ -1,9 +1,11 @@
import { useState, useCallback, useEffect } from "react";
import {
MatchedPerson,
RoleRecognitionResponse,
VideoSegmentEditUseCase,
} from "../usecase/ShotEditUsecase";
import {
MatchedPerson,
RoleRecognitionResponse
} from "@/api/DTO/movieEdit";
import { VideoSegmentEntity } from "../domain/Entities";
import { LensType, SimpleCharacter } from "../domain/valueObject";
import { getUploadToken, uploadToQiniu } from "@/api/common";

View File

@ -1,4 +1,4 @@
import { NewCharacterItem, CharacterListByProjectItem, CharacterListByProjectWithHighlightResponse, CharacterUpdateAndRegenerateRequest, CharacterUpdateAndRegenerateResponse } from '@/api/allMovieType';
import { NewCharacterItem, CharacterListByProjectItem, CharacterListByProjectWithHighlightResponse, CharacterUpdateAndRegenerateRequest, CharacterUpdateAndRegenerateResponse, RoleResponse } from "@/api/DTO/movieEdit";
import { RoleEntity } from '../domain/Entities';
import {
applyRoleToShots,
@ -13,21 +13,9 @@ import {
generateCharacterDescription,
saveRegeneratedCharacter,
getSimilarCharacters,
checkShotVideoStatus,
} from '@/api/video_flow';
export interface RoleResponse {
/** 角色描述 */
character_description: string;
/** 角色名称 */
character_name: string;
/** 高亮关键词 */
highlights: string[];
/** 角色图片地址 */
image_path: string;
/**缓存 */
character_draft: string;
}
/**
*
*
@ -424,6 +412,25 @@ export class RoleEditUseCase {
}
}
/**
* @description
* @param projectId ID
* @returns Promise<any>
*/
async checkShotVideoStatus(projectId: string): Promise<any> {
try {
// 这里需要调用后端API来检查镜头视频状态
// 由于这是一个新的功能需要根据实际的后端API接口来实现
// 目前返回一个模拟的状态信息
// TODO: 替换为真实的API调用
const response = await checkShotVideoStatus({ project_id: projectId });
return response.data;
} catch (error) {
console.error('检查镜头视频状态失败:', error);
throw new Error('检查镜头视频状态失败');
}
}
}

View File

@ -1,4 +1,4 @@
import { VideoFlowProjectResponse } from "@/api/allMovieType";
import { VideoFlowProjectResponse } from "@/api/DTO/movieEdit";
import { task_item, VideoSegmentEntityAdapter } from "../adapter/oldErrAdapter";
import { VideoSegmentEntity } from "../domain/Entities";
import { LensType } from "../domain/valueObject";
@ -351,130 +351,4 @@ export class VideoSegmentEditUseCase {
/**
*
* @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 AI识别图片中人物后的详细结果
*/
export interface RecognitionResultData {
/** 目标图片URL */
target_image_url: string;
/** 检测到的总人数 */
total_persons_detected: number;
/** 匹配的人物列表 */
matched_persons: MatchedPerson[];
}
/**
*
* @description API返回的角色识别完整响应
*/
export interface RecognitionResult {
/** 响应状态码 */
code: number;
/** 响应消息 */
message: string;
/** 识别结果数据 */
data: RecognitionResultData;
}
/**
* 使
* @description 使
*/
export interface CharacterUsed {
/** 角色名称 */
character_name: string;
/** 角色C-ID */
c_id: 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 const roleRecognitionResponse:RoleRecognitionResponse = {
// "project_id": "d0df7120-e27b-4f84-875c-e532f1bd318c",
// "video_id": "984f3347-c81c-4af8-9145-49ead82becde",
// "target_image_url": "https://cdn.qikongjian.com/videos/1754970412744_kqxplx.png",
// "known_persons_count": 1,
// "recognition_result": {
// "code": 200,
// "message": "识别完成",
// "data":
// {
// "target_image_url": "https://cdn.qikongjian.com/videos/1754970412744_kqxplx.png",
// "total_persons_detected": 1,
// "matched_persons": [
// {
// "person_id": "CH-01",
// "bbox": {
// "x": 269,
// "y": 23,
// "width": 585,
// "height": 685
// },
// "confidence": 0.36905956268310547
// }
// ]
// }
// },
// "characters_used": [
// {
// "character_name": "CH-01",
// "c_id": "无C-ID",
// "image_path": "无image_path",
// "avatar": "https://cdn.huiying.video/template/Whisk_9afb196368.jpg"
// }
// ]
// }