From 0832930bcba2378652c76188e37233aa677c5739 Mon Sep 17 00:00:00 2001 From: sp mac bookpro 2605 Date: Mon, 8 Jun 2026 15:13:27 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20AgentList=20=E5=B1=95=E7=A4=BA=E6=A8=A1?= =?UTF-8?q?=E5=9E=8B=E5=90=8D=E7=A7=B0=E8=80=8C=E9=9D=9EJSON?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/AgentList.tsx | 39 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/src/pages/AgentList.tsx b/src/pages/AgentList.tsx index d2e33d9..ba564b9 100644 --- a/src/pages/AgentList.tsx +++ b/src/pages/AgentList.tsx @@ -37,6 +37,41 @@ export default function AgentList() { }; const isImageUrl = (url: string) => url?.startsWith('http') || url?.startsWith('/'); + const getModelLabel = (value: unknown) => { + if (Array.isArray(value)) { + const names = value + .map((item: any) => (typeof item === 'string' ? item : item?.name)) + .map((v) => String(v || '').trim()) + .filter(Boolean); + return names.join('、'); + } + if (typeof value !== 'string') { + return ''; + } + const raw = value.trim(); + if (!raw) { + return ''; + } + try { + const parsed = JSON.parse(raw); + if (Array.isArray(parsed)) { + const names = parsed + .map((item: any) => (typeof item === 'string' ? item : item?.name)) + .map((v) => String(v || '').trim()) + .filter(Boolean); + return names.join('、'); + } + } catch { + } + if (raw.includes(',')) { + return raw + .split(',') + .map((s) => s.trim()) + .filter(Boolean) + .join('、'); + } + return raw; + }; const publicCount = useMemo(() => list.filter((a) => a.visibility === 'public').length, [list]); const teamCount = useMemo(() => list.filter((a) => a.visibility === 'team').length, [list]); @@ -208,10 +243,10 @@ export default function AgentList() { 私有 )} - {a.model && ( + {getModelLabel(a.model) && ( - {a.model} + {getModelLabel(a.model)} )}