diff --git a/console/src/pages/Settings/Models/components/cards/PineAgentsModelCards.tsx b/console/src/pages/Settings/Models/components/cards/PineAgentsModelCards.tsx index 7ad6650..9b4992e 100644 --- a/console/src/pages/Settings/Models/components/cards/PineAgentsModelCards.tsx +++ b/console/src/pages/Settings/Models/components/cards/PineAgentsModelCards.tsx @@ -20,6 +20,21 @@ interface Props { onOpenModels: (provider: ProviderInfo) => void; } +// 图标主题色(按模型 id 首字符给一个稳定渐变色) +const PALETTE = [ + "linear-gradient(135deg,#6366f1,#8b5cf6)", + "linear-gradient(135deg,#0ea5e9,#22d3ee)", + "linear-gradient(135deg,#f59e0b,#f97316)", + "linear-gradient(135deg,#10b981,#34d399)", + "linear-gradient(135deg,#ef4444,#f87171)", + "linear-gradient(135deg,#ec4899,#f472b6)", +]; +function iconBg(id: string) { + let h = 0; + for (let i = 0; i < id.length; i++) h = (h * 31 + id.charCodeAt(i)) >>> 0; + return PALETTE[h % PALETTE.length]; +} + export const PineAgentsModelCards = React.memo(function PineAgentsModelCards({ providers, onOpenModels, @@ -44,13 +59,13 @@ export const PineAgentsModelCards = React.memo(function PineAgentsModelCards({ try { localStorage.setItem(LS_KEY, JSON.stringify(next)); } catch { /* ignore */ } }; - const tags = (m: ModelInfo) => { - const tgs: string[] = []; - if (m.supports_multimodal) tgs.push(t("models.tagMultimodal", "多模态")); - if (m.supports_image) tgs.push(t("models.tagVision", "视觉")); - if (m.supports_video) tgs.push(t("models.tagVideo", "视频")); - if (tgs.length === 0) tgs.push(t("models.tagText", "文本")); - return tgs; + const chips = (m: ModelInfo) => { + const c: string[] = []; + if (m.supports_multimodal) c.push(t("models.tagMultimodal", "多模态")); + if (m.supports_image) c.push(t("models.tagVision", "视觉")); + if (m.supports_video) c.push(t("models.tagVideo", "视频")); + if (c.length === 0) c.push(t("models.tagText", "文本")); + return c; }; if (models.length === 0) { @@ -58,37 +73,37 @@ export const PineAgentsModelCards = React.memo(function PineAgentsModelCards({ } return ( -
+
{models.map(({ provider, model }) => { const pid = provider.id, mid = model.id; return ( -
-
- {model.name || model.id} - {isEnabled(pid, mid) && ( - Live - )} -
-
-
- - {model.id} - -
- {tags(model).map((tg) => ( - {tg} - ))} +
+
+ + {(model.name || mid || "?").charAt(0).toUpperCase()} + +
+
+ {model.name || mid}
+ {mid}
+ {isEnabled(pid, mid) && Live}
-
-
);