forked from 77media/video-flow
更新角色响应接口,调整角色数据结构以支持多个角色信息,并修复角色解析函数以适应新结构。
This commit is contained in:
parent
5e55ec5baa
commit
4f31df7fe7
@ -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;
|
||||
}
|
||||
|
||||
@ -918,7 +918,7 @@ export const getCharacterListByProjectWithHighlight = async (request: {
|
||||
project_id: string;
|
||||
/** 每个角色最多提取的高亮关键词数量 */
|
||||
max_keywords?: number;
|
||||
}): Promise<ApiResponse<RoleResponse[]>> => {
|
||||
}): Promise<ApiResponse<RoleResponse>> => {
|
||||
return post("/character/list_by_project_with_highlight", request);
|
||||
};
|
||||
|
||||
|
||||
@ -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}`,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user