Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

✨ feat(home): support image URLs for model shortcuts (#18580)

YuTengjing18269f431df5
diff --git a/src/business/client/hooks/useHomeNewModels.ts b/src/business/client/hooks/useHomeNewModels.ts
index b5ff94abc3a..1ce8422e4de 100644
--- a/src/business/client/hooks/useHomeNewModels.ts
+++ b/src/business/client/hooks/useHomeNewModels.ts
@@ -2,6 +2,8 @@ export type HomeNewModelType = 'chat' | 'image' | 'video';
export interface HomeNewModelItem {
iconModel?: string;
+ /** Optional image URL rendered instead of the model icon mapping. */
+ iconUrl?: string;
model: string;
provider?: string;
title: string;
diff --git a/src/features/Home/NewModelShortcuts/index.tsx b/src/features/Home/NewModelShortcuts/index.tsx
index 55d7f8b72b6..d006a13b94f 100644
--- a/src/features/Home/NewModelShortcuts/index.tsx
+++ b/src/features/Home/NewModelShortcuts/index.tsx
@@ -1,5 +1,5 @@
import { ModelIcon } from '@lobehub/icons';
-import { Flexbox, Skeleton, Text } from '@lobehub/ui';
+import { Avatar, Flexbox, Skeleton, Text } from '@lobehub/ui';
import { Button } from '@lobehub/ui/base-ui';
import { App } from 'antd';
import { createStaticStyles, cx } from 'antd-style';
@@ -176,10 +176,16 @@ export const NewModelShortcuts = () => {
aria-pressed={item.type === 'chat' ? isCurrent : undefined}
className={cx(styles.button, isCurrent && styles.active)}
disabled={!!switchingKey && !isSwitching}
- icon={<ModelIcon model={getShortcutIconModelId(item)} size={18} />}
key={key}
loading={isSwitching}
type={'text'}
+ icon={
+ item.iconUrl ? (
+ <Avatar alt={''} avatar={item.iconUrl} size={18} />
+ ) : (
+ <ModelIcon model={getShortcutIconModelId(item)} size={18} />
+ )
+ }
onClick={() => handleClick(item)}
>
{item.title}