From db93e1331d1ae48d3ff89d6058bf3d904d3d18bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=BE=B7=E5=AE=87?= Date: Tue, 15 Sep 2026 19:51:57 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B4=E7=90=86=E5=BC=95=E7=94=A8=E8=8A=AF?= =?UTF-8?q?=E7=89=87=E6=A0=87=E9=A2=98=E5=88=86=E6=94=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 提取资源、Skill 与运行区域标题计算 helper 移除 ResourceReferenceChip 的嵌套三元表达式 --- .../ResourceReferenceChip.tsx | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/apps/ai-game-creator-shell/src/features/project-workspace/ResourceReferenceChip.tsx b/apps/ai-game-creator-shell/src/features/project-workspace/ResourceReferenceChip.tsx index d9806292f..80a5d81c3 100644 --- a/apps/ai-game-creator-shell/src/features/project-workspace/ResourceReferenceChip.tsx +++ b/apps/ai-game-creator-shell/src/features/project-workspace/ResourceReferenceChip.tsx @@ -4,6 +4,16 @@ import { X } from 'lucide-react'; import type { ChatReference } from './resourceReferences'; +function chipTitle(reference: ChatReference) { + if (reference.type === 'resource') { + return `${reference.label} · ${reference.kind}`; + } + if (reference.type === 'skill') { + return `${reference.name} · Skill`; + } + return `${reference.label} · 运行区域`; +} + export function ResourceReferenceChip({ reference, nodeKey, @@ -25,13 +35,7 @@ export function ResourceReferenceChip({ reference.type === 'skill' ? reference.name : undefined } contentEditable={false} - title={ - reference.type === 'resource' - ? `${reference.label} · ${reference.kind}` - : reference.type === 'skill' - ? `${reference.name} · Skill` - : `${reference.label} · 运行区域` - } + title={chipTitle(reference)} >