更新获取相似角色的接口路径,修改为调用新的搜索和推荐接口。同时,移除不必要的调试代码,优化角色编辑用例的代码结构,提升可读性。

This commit is contained in:
海龙 2025-08-12 22:04:54 +08:00
parent b6bb65eddb
commit 60c7d11101
4 changed files with 52 additions and 58 deletions

View File

@ -902,7 +902,7 @@ export const getSimilarCharacters = async (request: {
/** 总数量 */ /** 总数量 */
total_count: number; total_count: number;
}>> => { }>> => {
return post("/character/get_similar_characters", request); return post("/character/search_and_recommend", request);
}; };
/** /**

View File

@ -346,7 +346,6 @@ export const useShotService = (): UseShotService => {
// 上传到七牛云 // 上传到七牛云
const imageUrl = await uploadToQiniu(file, token); const imageUrl = await uploadToQiniu(file, token);
console.log('imageUrl', imageUrl);
// 调用用例中的识别角色方法 // 调用用例中的识别角色方法
if (vidoEditUseCase) { if (vidoEditUseCase) {
try { try {

View File

@ -88,13 +88,6 @@ export class RoleEditUseCase {
}); });
} }
/**
*
* @description RoleEntity数组
* @param {RoleResponse[]} projectRoleData -
* @returns {RoleEntity[]}
* @throws {Error}
*/
/** /**
* *
* @description RoleEntity数组 * @description RoleEntity数组

View File

@ -8,18 +8,18 @@ import { VideoCarouselLayout } from '@/components/video-carousel-layout';
import { VideoGridLayout } from '@/components/video-grid-layout'; import { VideoGridLayout } from '@/components/video-grid-layout';
import { motion, AnimatePresence } from "framer-motion"; import { motion, AnimatePresence } from "framer-motion";
import { LiquidButton } from "@/components/ui/liquid-glass-button"; import { LiquidButton } from "@/components/ui/liquid-glass-button";
import { import {
createScriptProject, createScriptProject,
CreateScriptProjectRequest CreateScriptProjectRequest
} from '@/api/script_project'; } from '@/api/script_project';
import { import {
ProjectTypeEnum, ProjectTypeEnum,
ModeEnum, ModeEnum,
ResolutionEnum ResolutionEnum
} from '@/app/model/enums'; } from '@/app/model/enums';
import { import {
getResourcesList, getResourcesList,
Resource Resource
} from '@/api/resources'; } from '@/api/resources';
export function HomePage2() { export function HomePage2() {
@ -74,39 +74,41 @@ export function HomePage2() {
// 处理创建项目 // 处理创建项目
const handleCreateProject = async () => { const handleCreateProject = async () => {
if (isCreating) return; // console.log('isCreating', isCreating);
router.push(`/create`);
try { // if (isCreating) return;
setIsCreating(true);
router.push(`/create`); // try {
return; // setIsCreating(true);
// router.push(`/create`);
// 使用默认值 // return;
const projectType = ProjectTypeEnum.SCRIPT_TO_VIDEO;
// // 使用默认值
// 构建项目数据并调用API // const projectType = ProjectTypeEnum.SCRIPT_TO_VIDEO;
const projectData: CreateScriptProjectRequest = {
title: "script default", // 默认剧本名称 // // 构建项目数据并调用API
project_type: projectType, // const projectData: CreateScriptProjectRequest = {
mode: ModeEnum.MANUAL === 'manual' ? 1 : 2, // 1 表示手动模式2 表示自动模式 // title: "script default", // 默认剧本名称
resolution: 1080 // 1080p 分辨率 // 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 projectResponse = await createScriptProject(projectData);
const projectId = projectResponse.data.id;
setCreatedProjectId(projectId); // if (projectResponse.code === 0 && projectResponse.data.id) {
// projectId 作为参数传递给 create 页面 // const projectId = projectResponse.data.id;
router.push(`/create?projectId=${projectId}`); // setCreatedProjectId(projectId);
} else { // // projectId 作为参数传递给 create 页面
alert(`创建项目失败: ${projectResponse.message}`); // router.push(`/create?projectId=${projectId}`);
} // } else {
} catch (error) { // alert(`创建项目失败: ${projectResponse.message}`);
alert("创建项目时发生错误,请稍后重试"); // }
} finally { // } catch (error) {
setIsCreating(false); // 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 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"}`}> className={`cursor-pointer relative z-10 transition-opacity duration-300 ${activeTool === "stretch" ? "opacity-100" : "opacity-50"}`}>
<AlignHorizontalSpaceAround className="w-4 h-4 text-white" /> <AlignHorizontalSpaceAround className="w-4 h-4 text-white" />
</div> </div>
<div <div
className={`cursor-pointer relative z-10 transition-opacity duration-300 ${activeTool === "table" ? "opacity-100" : "opacity-50"}`}> className={`cursor-pointer relative z-10 transition-opacity duration-300 ${activeTool === "table" ? "opacity-100" : "opacity-50"}`}>
<Table className="w-4 h-4 text-white" /> <Table className="w-4 h-4 text-white" />
</div> </div>
@ -159,7 +161,7 @@ export function HomePage2() {
</div> </div>
{/* 屏风式视频布局 */} {/* 屏风式视频布局 */}
<div <div
className={`absolute w-full h-[calc(100vh - 4rem)] transition-all duration-500 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"} ${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 <div
className={`absolute top-[8rem] w-full transition-all duration-500 max-h-[calc(100vh-8rem)] overflow-y-auto hide-scrollbar 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"} ${activeTool === "table" ? "opacity-100 translate-x-0" : "opacity-0 translate-x-[100%] pointer-events-none"}
`} `}
> >
<VideoGridLayout <VideoGridLayout
videos={videos} videos={videos}
onEdit={handleEdit} onEdit={handleEdit}
onDelete={handleDelete} onDelete={handleDelete}
@ -200,10 +202,10 @@ export function HomePage2() {
)} )}
{isCreating ? "Action..." : "Action"} {isCreating ? "Action..." : "Action"}
</div> </div>
</LiquidButton> </LiquidButton>
</div> </div>
</div> </div>
</div> </div>
); );
} }