From 4f31df7fe718df57b52fe24d4b6ac4a0e7f724e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8C=97=E6=9E=B3?= <7854742+wang_rumeng@user.noreply.gitee.com> Date: Wed, 13 Aug 2025 17:45:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E8=A7=92=E8=89=B2=E5=93=8D?= =?UTF-8?q?=E5=BA=94=E6=8E=A5=E5=8F=A3=EF=BC=8C=E8=B0=83=E6=95=B4=E8=A7=92?= =?UTF-8?q?=E8=89=B2=E6=95=B0=E6=8D=AE=E7=BB=93=E6=9E=84=E4=BB=A5=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E5=A4=9A=E4=B8=AA=E8=A7=92=E8=89=B2=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=EF=BC=8C=E5=B9=B6=E4=BF=AE=E5=A4=8D=E8=A7=92=E8=89=B2=E8=A7=A3?= =?UTF-8?q?=E6=9E=90=E5=87=BD=E6=95=B0=E4=BB=A5=E9=80=82=E5=BA=94=E6=96=B0?= =?UTF-8?q?=E7=BB=93=E6=9E=84=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/DTO/movieEdit.ts | 20 ++++++++++++-------- api/video_flow.ts | 2 +- app/service/usecase/RoleEditUseCase.ts | 12 ++++++------ 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/api/DTO/movieEdit.ts b/api/DTO/movieEdit.ts index 383746f..94abf18 100644 --- a/api/DTO/movieEdit.ts +++ b/api/DTO/movieEdit.ts @@ -602,14 +602,18 @@ export interface RoleRecognitionResponse { characters_used: CharacterUsed[]; } export interface RoleResponse { - /** 角色描述 */ - character_description: string; - /** 角色名称 */ - character_name: string; - /** 高亮关键词 */ - highlights: string[]; - /** 角色图片地址 */ - image_path: string; + characters: { + /** 角色描述 */ + character_description: string; + /** 角色名称 */ + character_name: string; + /** 高亮关键词 */ + highlights: string[]; + /** 角色图片地址 */ + image_path: string; + /** 角色图片地址 */ + image_url: string; + }[]; /**缓存 */ character_draft: string; } diff --git a/api/video_flow.ts b/api/video_flow.ts index f8752d8..1a43125 100644 --- a/api/video_flow.ts +++ b/api/video_flow.ts @@ -918,7 +918,7 @@ export const getCharacterListByProjectWithHighlight = async (request: { project_id: string; /** 每个角色最多提取的高亮关键词数量 */ max_keywords?: number; -}): Promise> => { +}): Promise> => { return post("/character/list_by_project_with_highlight", request); }; diff --git a/app/service/usecase/RoleEditUseCase.ts b/app/service/usecase/RoleEditUseCase.ts index 639211f..4402343 100644 --- a/app/service/usecase/RoleEditUseCase.ts +++ b/app/service/usecase/RoleEditUseCase.ts @@ -86,16 +86,16 @@ export class RoleEditUseCase { * @returns {RoleEntity[]} 角色实体数组 * @throws {Error} 如果数据格式不正确则抛出异常 */ - parseProjectRoleList(projectRoleData: RoleResponse[]): RoleEntity[] { + parseProjectRoleList(projectRoleData: RoleResponse): RoleEntity[] { if (!Array.isArray(projectRoleData)) { throw new Error('项目角色数据格式错误'); } - return projectRoleData.map((char, index) => { - if(char.character_draft){ - const roleEntity: RoleEntity = JSON.parse(char.character_draft); - return roleEntity; - } + if(projectRoleData.character_draft){ + const roleEntity: RoleEntity[] = JSON.parse(projectRoleData.character_draft); + return roleEntity; + } + return projectRoleData.characters.map((char, index) => { /** 角色实体对象 */ const roleEntity: RoleEntity = { id: `role_${index + 1}`,