forked from 77media/video-flow
更新获取相似角色的接口路径,修改为调用新的搜索和推荐接口。同时,移除不必要的调试代码,优化角色编辑用例的代码结构,提升可读性。
This commit is contained in:
parent
b6bb65eddb
commit
60c7d11101
@ -902,7 +902,7 @@ export const getSimilarCharacters = async (request: {
|
||||
/** 总数量 */
|
||||
total_count: number;
|
||||
}>> => {
|
||||
return post("/character/get_similar_characters", request);
|
||||
return post("/character/search_and_recommend", request);
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@ -346,7 +346,6 @@ export const useShotService = (): UseShotService => {
|
||||
|
||||
// 上传到七牛云
|
||||
const imageUrl = await uploadToQiniu(file, token);
|
||||
console.log('imageUrl', imageUrl);
|
||||
// 调用用例中的识别角色方法
|
||||
if (vidoEditUseCase) {
|
||||
try {
|
||||
|
||||
@ -88,13 +88,6 @@ export class RoleEditUseCase {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 解析项目角色列表接口返回的数据
|
||||
* @description 将接口返回的项目角色列表数据转换为RoleEntity数组
|
||||
* @param {RoleResponse[]} projectRoleData - 项目角色列表数据
|
||||
* @returns {RoleEntity[]} 角色实体数组
|
||||
* @throws {Error} 如果数据格式不正确则抛出异常
|
||||
*/
|
||||
/**
|
||||
* 解析项目角色列表接口返回的数据
|
||||
* @description 将接口返回的项目角色列表数据转换为RoleEntity数组
|
||||
|
||||
@ -8,18 +8,18 @@ import { VideoCarouselLayout } from '@/components/video-carousel-layout';
|
||||
import { VideoGridLayout } from '@/components/video-grid-layout';
|
||||
import { motion, AnimatePresence } from "framer-motion";
|
||||
import { LiquidButton } from "@/components/ui/liquid-glass-button";
|
||||
import {
|
||||
createScriptProject,
|
||||
import {
|
||||
createScriptProject,
|
||||
CreateScriptProjectRequest
|
||||
} from '@/api/script_project';
|
||||
import {
|
||||
ProjectTypeEnum,
|
||||
ModeEnum,
|
||||
import {
|
||||
ProjectTypeEnum,
|
||||
ModeEnum,
|
||||
ResolutionEnum
|
||||
} from '@/app/model/enums';
|
||||
import {
|
||||
getResourcesList,
|
||||
Resource
|
||||
import {
|
||||
getResourcesList,
|
||||
Resource
|
||||
} from '@/api/resources';
|
||||
|
||||
export function HomePage2() {
|
||||
@ -74,39 +74,41 @@ export function HomePage2() {
|
||||
|
||||
// 处理创建项目
|
||||
const handleCreateProject = async () => {
|
||||
if (isCreating) return;
|
||||
|
||||
try {
|
||||
setIsCreating(true);
|
||||
router.push(`/create`);
|
||||
return;
|
||||
|
||||
// 使用默认值
|
||||
const projectType = ProjectTypeEnum.SCRIPT_TO_VIDEO;
|
||||
|
||||
// 构建项目数据并调用API
|
||||
const projectData: CreateScriptProjectRequest = {
|
||||
title: "script default", // 默认剧本名称
|
||||
project_type: projectType,
|
||||
mode: ModeEnum.MANUAL === 'manual' ? 1 : 2, // 1 表示手动模式,2 表示自动模式
|
||||
resolution: 1080 // 1080p 分辨率
|
||||
};
|
||||
|
||||
const projectResponse = await createScriptProject(projectData);
|
||||
|
||||
if (projectResponse.code === 0 && projectResponse.data.id) {
|
||||
const projectId = projectResponse.data.id;
|
||||
setCreatedProjectId(projectId);
|
||||
// projectId 作为参数传递给 create 页面
|
||||
router.push(`/create?projectId=${projectId}`);
|
||||
} else {
|
||||
alert(`创建项目失败: ${projectResponse.message}`);
|
||||
}
|
||||
} catch (error) {
|
||||
alert("创建项目时发生错误,请稍后重试");
|
||||
} finally {
|
||||
setIsCreating(false);
|
||||
}
|
||||
// console.log('isCreating', isCreating);
|
||||
router.push(`/create`);
|
||||
// if (isCreating) return;
|
||||
|
||||
// try {
|
||||
// setIsCreating(true);
|
||||
// router.push(`/create`);
|
||||
// return;
|
||||
|
||||
// // 使用默认值
|
||||
// const projectType = ProjectTypeEnum.SCRIPT_TO_VIDEO;
|
||||
|
||||
// // 构建项目数据并调用API
|
||||
// const projectData: CreateScriptProjectRequest = {
|
||||
// title: "script default", // 默认剧本名称
|
||||
// project_type: projectType,
|
||||
// mode: ModeEnum.MANUAL === 'manual' ? 1 : 2, // 1 表示手动模式,2 表示自动模式
|
||||
// resolution: 1080 // 1080p 分辨率
|
||||
// };
|
||||
|
||||
// const projectResponse = await createScriptProject(projectData);
|
||||
|
||||
// if (projectResponse.code === 0 && projectResponse.data.id) {
|
||||
// const projectId = projectResponse.data.id;
|
||||
// setCreatedProjectId(projectId);
|
||||
// // projectId 作为参数传递给 create 页面
|
||||
// router.push(`/create?projectId=${projectId}`);
|
||||
// } else {
|
||||
// alert(`创建项目失败: ${projectResponse.message}`);
|
||||
// }
|
||||
// } catch (error) {
|
||||
// alert("创建项目时发生错误,请稍后重试");
|
||||
// } finally {
|
||||
// setIsCreating(false);
|
||||
// }
|
||||
};
|
||||
|
||||
// 处理工具切换
|
||||
@ -127,11 +129,11 @@ export function HomePage2() {
|
||||
}}
|
||||
>
|
||||
<div className="relative flex items-center justify-around gap-4 w-[128px] h-[3rem] p-2">
|
||||
<div
|
||||
<div
|
||||
className={`cursor-pointer relative z-10 transition-opacity duration-300 ${activeTool === "stretch" ? "opacity-100" : "opacity-50"}`}>
|
||||
<AlignHorizontalSpaceAround className="w-4 h-4 text-white" />
|
||||
</div>
|
||||
<div
|
||||
<div
|
||||
className={`cursor-pointer relative z-10 transition-opacity duration-300 ${activeTool === "table" ? "opacity-100" : "opacity-50"}`}>
|
||||
<Table className="w-4 h-4 text-white" />
|
||||
</div>
|
||||
@ -159,7 +161,7 @@ export function HomePage2() {
|
||||
</div>
|
||||
|
||||
{/* 屏风式视频布局 */}
|
||||
<div
|
||||
<div
|
||||
className={`absolute w-full h-[calc(100vh - 4rem)] transition-all duration-500
|
||||
${activeTool === "stretch" ? "opacity-100 translate-x-0" : "opacity-0 translate-x-[-100%] pointer-events-none"}
|
||||
`}
|
||||
@ -174,12 +176,12 @@ export function HomePage2() {
|
||||
</div>
|
||||
|
||||
{/* 网格式视频布局 */}
|
||||
<div
|
||||
<div
|
||||
className={`absolute top-[8rem] w-full transition-all duration-500 max-h-[calc(100vh-8rem)] overflow-y-auto hide-scrollbar
|
||||
${activeTool === "table" ? "opacity-100 translate-x-0" : "opacity-0 translate-x-[100%] pointer-events-none"}
|
||||
`}
|
||||
>
|
||||
<VideoGridLayout
|
||||
<VideoGridLayout
|
||||
videos={videos}
|
||||
onEdit={handleEdit}
|
||||
onDelete={handleDelete}
|
||||
@ -200,10 +202,10 @@ export function HomePage2() {
|
||||
)}
|
||||
{isCreating ? "Action..." : "Action"}
|
||||
</div>
|
||||
</LiquidButton>
|
||||
</LiquidButton>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user