From 1871be3d9485deef45f7a8efae23f301ab2edd1e 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 20:41:24 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AE=80=E5=8C=96=E8=A7=92=E8=89=B2=E8=A7=A3?= =?UTF-8?q?=E6=9E=90=E5=87=BD=E6=95=B0=EF=BC=8C=E7=A7=BB=E9=99=A4=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E6=A0=BC=E5=BC=8F=E6=A3=80=E6=9F=A5=E5=B9=B6=E8=B0=83?= =?UTF-8?q?=E6=95=B4=E8=A7=92=E8=89=B2=E5=B1=9E=E6=80=A7=E6=98=A0=E5=B0=84?= =?UTF-8?q?=EF=BC=8C=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81=E9=80=BB=E8=BE=91?= =?UTF-8?q?=E3=80=82=E5=90=8C=E6=97=B6=EF=BC=8C=E6=9B=B4=E6=96=B0=E8=A7=92?= =?UTF-8?q?=E8=89=B2=E9=80=89=E6=8B=A9=E9=80=BB=E8=BE=91=E4=BB=A5=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E6=96=B0=E7=9A=84=E8=A7=92=E8=89=B2=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E7=BB=93=E6=9E=84=EF=BC=8C=E4=BF=AE=E5=A4=8D=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E7=9A=84=E6=97=A5=E5=BF=97=E8=BE=93=E5=87=BA=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/service/usecase/RoleEditUseCase.ts | 13 +++++++------ components/ui/character-tab-content.tsx | 12 ++++++++---- components/ui/replace-panel.tsx | 12 +++--------- 3 files changed, 18 insertions(+), 19 deletions(-) diff --git a/app/service/usecase/RoleEditUseCase.ts b/app/service/usecase/RoleEditUseCase.ts index 868f7d5..2de550a 100644 --- a/app/service/usecase/RoleEditUseCase.ts +++ b/app/service/usecase/RoleEditUseCase.ts @@ -145,18 +145,19 @@ export class RoleEditUseCase { * @throws {Error} 如果数据格式不正确则抛出异常 */ parseSimilarCharacterList(similarCharacterData: any): RoleEntity[] { - if (!similarCharacterData || !Array.isArray(similarCharacterData.characters)) { - throw new Error('相似角色数据格式错误'); - } + // if (!similarCharacterData || !Array.isArray(similarCharacterData.characters)) { + // throw new Error('相似角色数据格式错误'); + // } + const characters = [...similarCharacterData.similar_characters, ...similarCharacterData.user_characters]; - return similarCharacterData.characters.map((char: any, index: number) => { + return characters.map((char: any, index: number) => { /** 角色实体对象 */ const roleEntity: RoleEntity = { id: char.id || `role_${Date.now()}_${index}`, name: char.name || '', - generateText: char.description || '', + generateText: char.brief || '', tags: [], // 相似角色接口可能不返回标签,暂时为空 - imageUrl: char.image_url || '', + imageUrl: char.avatar || '', loadingProgress: 100, disableEdit: false, updatedAt: Date.now(), diff --git a/components/ui/character-tab-content.tsx b/components/ui/character-tab-content.tsx index 0ac1a41..4e14eb7 100644 --- a/components/ui/character-tab-content.tsx +++ b/components/ui/character-tab-content.tsx @@ -111,8 +111,8 @@ export function CharacterTabContent({ }, [roleData, isInitialized]); useEffect(() => { - console.log('获取选中项数据', selectedRole); - }, [selectedRole]); + console.log('获取shotSelectionList数据', shotSelectionList); + }, [shotSelectionList]); useEffect(() => { console.log('获取角色库数据', userRoleLibrary); @@ -184,8 +184,12 @@ export function CharacterTabContent({ setShowAddToLibrary(false); // 使用真实的角色数据 - const selectedRole = userRoleLibrary[index]; - if (selectedRole) { + const role = userRoleLibrary[index]; + if (role) { + selectRole({ + ...role, + name: selectedRole?.name || '' + }); handleStartReplaceCharacter(); } }; diff --git a/components/ui/replace-panel.tsx b/components/ui/replace-panel.tsx index 51033f2..d1e9ebe 100644 --- a/components/ui/replace-panel.tsx +++ b/components/ui/replace-panel.tsx @@ -158,23 +158,22 @@ export function ReplacePanel({ whileHover={{ scale: 1.02 }} whileTap={{ scale: 0.98 }} > - {shot.videoUrl && ( + {shot.videoUrl && shot.videoUrl.length > 0 && (