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.

🐛 fix: udpate discover detail tools get & more link (#10586)

Shinji-Li8ace3f0e48a9
diff --git a/locales/ar/discover.json b/locales/ar/discover.json
index 05492c9f03e..28cc99ced08 100644
--- a/locales/ar/discover.json
+++ b/locales/ar/discover.json
@@ -616,6 +616,7 @@
"supportedProviders": "مزودو الخدمة المدعومون لهذا النموذج"
},
"plugins": {
+ "builtinTag": "الملحقات المدمجة",
"community": "إضافات المجتمع",
"details": {
"settings": {
@@ -630,6 +631,7 @@
},
"install": "تثبيت الإضافة",
"installed": "تم التثبيت",
+ "legacyTag": "الملحقات القديمة",
"list": "قائمة الإضافات",
"meta": {
"description": "وصف",
diff --git a/locales/bg-BG/discover.json b/locales/bg-BG/discover.json
index 107d5365253..968ee3b9c63 100644
--- a/locales/bg-BG/discover.json
+++ b/locales/bg-BG/discover.json
@@ -616,6 +616,7 @@
"supportedProviders": "Доставчици, поддържащи този модел"
},
"plugins": {
+ "builtinTag": "Вграден плъгин",
"community": "Обществени плъгини",
"details": {
"settings": {
@@ -630,6 +631,7 @@
},
"install": "Инсталирай плъгин",
"installed": "Инсталиран",
+ "legacyTag": "Остарял плъгин",
"list": "Списък с плъгини",
"meta": {
"description": "Описание",
diff --git a/locales/de-DE/discover.json b/locales/de-DE/discover.json
index fa30b796eff..74f1f456951 100644
--- a/locales/de-DE/discover.json
+++ b/locales/de-DE/discover.json
@@ -616,6 +616,7 @@
"supportedProviders": "Anbieter, die dieses Modell unterstützen"
},
"plugins": {
+ "builtinTag": "Integriertes Plugin",
"community": "Community-Plugins",
"details": {
"settings": {
@@ -630,6 +631,7 @@
},
"install": "Plugin installieren",
"installed": "Installiert",
+ "legacyTag": "Veraltetes Plugin",
"list": "Plugin-Liste",
"meta": {
"description": "Beschreibung",
diff --git a/locales/en-US/discover.json b/locales/en-US/discover.json
index 3816b009b53..9e721d828be 100644
--- a/locales/en-US/discover.json
+++ b/locales/en-US/discover.json
@@ -616,6 +616,7 @@
"supportedProviders": "Providers Supporting This Model"
},
"plugins": {
+ "builtinTag": "Built-in",
"community": "Community Plugins",
"details": {
"settings": {
@@ -630,6 +631,7 @@
},
"install": "Install Plugin",
"installed": "Installed",
+ "legacyTag": "Legacy",
"list": "Plugin List",
"meta": {
"description": "Description",
diff --git a/locales/es-ES/discover.json b/locales/es-ES/discover.json
index 258860bfe1d..c64ac16f74a 100644
--- a/locales/es-ES/discover.json
+++ b/locales/es-ES/discover.json
@@ -616,6 +616,7 @@
"supportedProviders": "Proveedores que admiten este modelo"
},
"plugins": {
+ "builtinTag": "Complemento incorporado",
"community": "Complementos de la comunidad",
"details": {
"settings": {
@@ -630,6 +631,7 @@
},
"install": "Instalar complemento",
"installed": "Instalado",
+ "legacyTag": "Complemento heredado",
"list": "Lista de complementos",
"meta": {
"description": "Descripción",
diff --git a/locales/fa-IR/discover.json b/locales/fa-IR/discover.json
index cd52ca42610..2bc2c25ec22 100644
--- a/locales/fa-IR/discover.json
+++ b/locales/fa-IR/discover.json
@@ -616,6 +616,7 @@
"supportedProviders": "ارائه‌دهندگان پشتیبانی شده برای این مدل"
},
"plugins": {
+ "builtinTag": "افزونه داخلی",
"community": "پلاگین‌های انجمن",
"details": {
"settings": {
@@ -630,6 +631,7 @@
},
"install": "نصب پلاگین",
"installed": "نصب شده",
+ "legacyTag": "افزونه قدیمی",
"list": "فهرست پلاگین‌ها",
"meta": {
"description": "توضیحات",
diff --git a/locales/fr-FR/discover.json b/locales/fr-FR/discover.json
index 776ec0e2d52..c3f66356866 100644
--- a/locales/fr-FR/discover.json
+++ b/locales/fr-FR/discover.json
@@ -616,6 +616,7 @@
"supportedProviders": "Fournisseurs prenant en charge ce modèle"
},
"plugins": {
+ "builtinTag": "Plugin intégré",
"community": "Plugins communautaires",
"details": {
"settings": {
@@ -630,6 +631,7 @@
},
"install": "Installer le plugin",
"installed": "Installé",
+ "legacyTag": "Ancien plugin",
"list": "Liste des plugins",
"meta": {
"description": "Description",
diff --git a/locales/it-IT/discover.json b/locales/it-IT/discover.json
index b2be3108901..d61677299ed 100644
--- a/locales/it-IT/discover.json
+++ b/locales/it-IT/discover.json
@@ -616,6 +616,7 @@
"supportedProviders": "Fornitori supportati da questo modello"
},
"plugins": {
+ "builtinTag": "Plugin integrato",
"community": "Plugin della comunità",
"details": {
"settings": {
@@ -630,6 +631,7 @@
},
"install": "Installa plugin",
"installed": "Installato",
+ "legacyTag": "Plugin legacy",
"list": "Elenco plugin",
"meta": {
"description": "Descrizione",
diff --git a/locales/ja-JP/discover.json b/locales/ja-JP/discover.json
index e090a8a0428..bb1eebb6c39 100644
--- a/locales/ja-JP/discover.json
+++ b/locales/ja-JP/discover.json
@@ -616,6 +616,7 @@
"supportedProviders": "このモデルをサポートするプロバイダー"
},
"plugins": {
+ "builtinTag": "内蔵プラグイン",
"community": "コミュニティプラグイン",
"details": {
"settings": {
@@ -630,6 +631,7 @@
},
"install": "プラグインをインストール",
"installed": "インストール済み",
+ "legacyTag": "旧バージョンプラグイン",
"list": "プラグインリスト",
"meta": {
"description": "説明",
diff --git a/locales/ko-KR/discover.json b/locales/ko-KR/discover.json
index a4262a875b1..9c52a54b954 100644
--- a/locales/ko-KR/discover.json
+++ b/locales/ko-KR/discover.json
@@ -616,6 +616,7 @@
"supportedProviders": "이 모델을 지원하는 서비스 제공자"
},
"plugins": {
+ "builtinTag": "내장 플러그인",
"community": "커뮤니티 플러그인",
"details": {
"settings": {
@@ -630,6 +631,7 @@
},
"install": "플러그인 설치",
"installed": "설치됨",
+ "legacyTag": "구버전 플러그인",
"list": "플러그인 목록",
"meta": {
"description": "설명",
diff --git a/locales/nl-NL/discover.json b/locales/nl-NL/discover.json
index 3ef397d737b..6e35cf733da 100644
--- a/locales/nl-NL/discover.json
+++ b/locales/nl-NL/discover.json
@@ -616,6 +616,7 @@
"supportedProviders": "Providers die dit model ondersteunen"
},
"plugins": {
+ "builtinTag": "Ingebouwde plug-in",
"community": "Gemeenschapsplugins",
"details": {
"settings": {
@@ -630,6 +631,7 @@
},
"install": "Plugin installeren",
"installed": "Geïnstalleerd",
+ "legacyTag": "Verouderde plug-in",
"list": "Pluginlijst",
"meta": {
"description": "Beschrijving",
diff --git a/locales/pl-PL/discover.json b/locales/pl-PL/discover.json
index e650fcc2b11..0e779ba7a7a 100644
--- a/locales/pl-PL/discover.json
+++ b/locales/pl-PL/discover.json
@@ -616,6 +616,7 @@
"supportedProviders": "Dostawcy obsługujący ten model"
},
"plugins": {
+ "builtinTag": "Wbudowana wtyczka",
"community": "Wtyczki społecznościowe",
"details": {
"settings": {
@@ -630,6 +631,7 @@
},
"install": "Zainstaluj wtyczkę",
"installed": "Zainstalowane",
+ "legacyTag": "Starsza wersja wtyczki",
"list": "Lista wtyczek",
"meta": {
"description": "Opis",
diff --git a/locales/pt-BR/discover.json b/locales/pt-BR/discover.json
index 68a74d77980..5e9d04cebcc 100644
--- a/locales/pt-BR/discover.json
+++ b/locales/pt-BR/discover.json
@@ -616,6 +616,7 @@
"supportedProviders": "Provedores que suportam este modelo"
},
"plugins": {
+ "builtinTag": "Plugin Integrado",
"community": "Plugins da Comunidade",
"details": {
"settings": {
@@ -630,6 +631,7 @@
},
"install": "Instalar Plugin",
"installed": "Instalado",
+ "legacyTag": "Plugin Legado",
"list": "Lista de Plugins",
"meta": {
"description": "Descrição",
diff --git a/locales/ru-RU/discover.json b/locales/ru-RU/discover.json
index 0c3c7cf0d75..22bbbcf7a24 100644
--- a/locales/ru-RU/discover.json
+++ b/locales/ru-RU/discover.json
@@ -616,6 +616,7 @@
"supportedProviders": "Поставщики, поддерживающие эту модель"
},
"plugins": {
+ "builtinTag": "Встроенный плагин",
"community": "Сообщество плагинов",
"details": {
"settings": {
@@ -630,6 +631,7 @@
},
"install": "Установить плагин",
"installed": "Установлено",
+ "legacyTag": "Устаревший плагин",
"list": "Список плагинов",
"meta": {
"description": "Описание",
diff --git a/locales/tr-TR/discover.json b/locales/tr-TR/discover.json
index 7973af6dba2..292c6f66d06 100644
--- a/locales/tr-TR/discover.json
+++ b/locales/tr-TR/discover.json
@@ -616,6 +616,7 @@
"supportedProviders": "Bu modeli destekleyen sağlayıcılar"
},
"plugins": {
+ "builtinTag": "Yerleşik Eklenti",
"community": "Topluluk Eklentisi",
"details": {
"settings": {
@@ -630,6 +631,7 @@
},
"install": "Eklenti Yükle",
"installed": "Yüklü",
+ "legacyTag": "Eski Sürüm Eklenti",
"list": "Eklenti Listesi",
"meta": {
"description": "Açıklama",
diff --git a/locales/vi-VN/discover.json b/locales/vi-VN/discover.json
index 4c19a5a2caa..6dc8b7e62c8 100644
--- a/locales/vi-VN/discover.json
+++ b/locales/vi-VN/discover.json
@@ -616,6 +616,7 @@
"supportedProviders": "Nhà cung cấp hỗ trợ mô hình này"
},
"plugins": {
+ "builtinTag": "Plugin tích hợp sẵn",
"community": "Plugin cộng đồng",
"details": {
"settings": {
@@ -630,6 +631,7 @@
},
"install": "Cài đặt plugin",
"installed": "Đã cài đặt",
+ "legacyTag": "Plugin phiên bản cũ",
"list": "Danh sách plugin",
"meta": {
"description": "Mô tả",
diff --git a/locales/zh-CN/discover.json b/locales/zh-CN/discover.json
index 1cf72f5f9e0..efb597df203 100644
--- a/locales/zh-CN/discover.json
+++ b/locales/zh-CN/discover.json
@@ -616,6 +616,7 @@
"supportedProviders": "支持该模型的服务商"
},
"plugins": {
+ "builtinTag": "内置插件",
"community": "社区插件",
"details": {
"settings": {
@@ -630,6 +631,7 @@
},
"install": "安装插件",
"installed": "已安装",
+ "legacyTag": "旧版插件",
"list": "插件列表",
"meta": {
"description": "描述",
diff --git a/locales/zh-TW/discover.json b/locales/zh-TW/discover.json
index 92218792e25..bf21c2d4f48 100644
--- a/locales/zh-TW/discover.json
+++ b/locales/zh-TW/discover.json
@@ -616,6 +616,7 @@
"supportedProviders": "支持該模型的服務商"
},
"plugins": {
+ "builtinTag": "內建外掛",
"community": "社區插件",
"details": {
"settings": {
@@ -630,6 +631,7 @@
},
"install": "安裝插件",
"installed": "已安裝",
+ "legacyTag": "舊版外掛",
"list": "插件列表",
"meta": {
"description": "描述",
diff --git a/packages/types/src/discover/plugins.ts b/packages/types/src/discover/plugins.ts
index 7c713a00c95..b0046a59306 100644
--- a/packages/types/src/discover/plugins.ts
+++ b/packages/types/src/discover/plugins.ts
@@ -46,7 +46,19 @@ export interface PluginListResponse {
totalPages: number;
}
+/**
+ * Plugin source types
+ * - legacy: From old plugin list (_getPluginList)
+ * - market: From Market SDK (getMcpDetail)
+ * - builtin: From LobeHub builtin tools
+ */
+export type PluginSource = 'legacy' | 'market' | 'builtin';
+
export interface DiscoverPluginDetail extends Omit<DiscoverPluginItem, 'manifest'> {
manifest?: LobeChatPluginManifest | string;
related: DiscoverPluginItem[];
+ /**
+ * Plugin source type
+ */
+ source?: PluginSource;
}
diff --git a/src/app/[variants]/(main)/discover/(detail)/assistant/features/Details/Capabilities/PluginItem.tsx b/src/app/[variants]/(main)/discover/(detail)/assistant/features/Details/Capabilities/PluginItem.tsx
index 92bd28e762b..a76343e3317 100644
--- a/src/app/[variants]/(main)/discover/(detail)/assistant/features/Details/Capabilities/PluginItem.tsx
+++ b/src/app/[variants]/(main)/discover/(detail)/assistant/features/Details/Capabilities/PluginItem.tsx
@@ -1,35 +1,96 @@
-import { Avatar, Block, Text } from '@lobehub/ui';
+import { PluginSource } from '@lobechat/types';
+import { Avatar, Block, Tag, Text } from '@lobehub/ui';
import { Skeleton } from 'antd';
import { createStyles } from 'antd-style';
-import { memo } from 'react';
+import { memo, useMemo } from 'react';
+import { useTranslation } from 'react-i18next';
import { Flexbox } from 'react-layout-kit';
+import { Link } from 'react-router-dom';
+import urlJoin from 'url-join';
import { useDiscoverStore } from '@/store/discover';
const useStyles = createStyles(({ css, token }) => {
return {
+ clickable: css`
+ cursor: pointer;
+
+ &:hover {
+ .plugin-title {
+ color: ${token.colorLink};
+ }
+ }
+ `,
desc: css`
flex: 1;
margin: 0 !important;
font-size: 14px !important;
color: ${token.colorTextSecondary};
`,
+ noLink: css`
+ cursor: default;
+ `,
+ tag: css`
+ flex-shrink: 0;
+ `,
title: css`
margin: 0 !important;
font-size: 14px !important;
font-weight: 500 !important;
-
- &:hover {
- color: ${token.colorLink};
- }
+ `,
+ titleRow: css`
+ display: flex;
+ gap: 8px;
+ align-items: center;
`,
};
});
-const PluginItem = memo<{ identifier: string }>(({ identifier }) => {
+interface PluginItemProps {
+ identifier: string;
+}
+
+const PluginItem = memo<PluginItemProps>(({ identifier }) => {
+ const { t } = useTranslation('discover');
const usePluginDetail = useDiscoverStore((s) => s.usePluginDetail);
const { data, isLoading } = usePluginDetail({ identifier, withManifest: false });
- const { styles } = useStyles();
+ const { styles, cx } = useStyles();
+
+ const sourceConfig = useMemo(() => {
+ const source: PluginSource = data?.source || 'market';
+
+ switch (source) {
+ case 'builtin': {
+ return {
+ clickable: false,
+ href: undefined,
+ isExternal: false,
+ tagColor: 'geekblue' as const,
+ tagText: t('plugins.builtinTag'),
+ };
+ }
+ case 'legacy': {
+ return {
+ clickable: true,
+ href: data?.homepage,
+ isExternal: true,
+ tagColor: 'orange' as const,
+ tagText: t('plugins.legacyTag'),
+ };
+ }
+ // eslint-disable-next-line unicorn/no-useless-switch-case
+ case 'market':
+ default: {
+ return {
+ clickable: true,
+ href: urlJoin('/discover/plugin', identifier),
+ isExternal: false,
+ tagColor: undefined,
+ tagText: undefined,
+ };
+ }
+ }
+ }, [data?.source, data?.homepage, identifier, t]);
if (isLoading || !data)
return (
@@ -38,8 +99,15 @@ const PluginItem = memo<{ identifier: string }>(({ identifier }) => {
</Block>
);
- return (
- <Block gap={12} horizontal key={identifier} padding={12} variant={'outlined'}>
+ const content = (
+ <Block
+ className={cx(sourceConfig.clickable ? styles.clickable : styles.noLink)}
+ gap={12}
+ horizontal
+ key={identifier}
+ padding={12}
+ variant={'outlined'}
+ >
<Avatar avatar={data.avatar} size={40} style={{ flex: 'none' }} />
<Flexbox
flex={1}
@@ -48,9 +116,16 @@ const PluginItem = memo<{ identifier: string }>(({ identifier }) => {
overflow: 'hidden',
}}
>
- <Text as={'h2'} className={styles.title} ellipsis>
- {data.title}
- </Text>
+ <div className={styles.titleRow}>
+ <Text as={'h2'} className={cx(styles.title, 'plugin-title')} ellipsis>
+ {data.title}
+ </Text>
+ {sourceConfig.tagText && (
+ <Tag className={styles.tag} color={sourceConfig.tagColor} size={'small'}>
+ {sourceConfig.tagText}
+ </Tag>
+ )}
+ </div>
<Text
as={'p'}
className={styles.desc}
@@ -63,6 +138,27 @@ const PluginItem = memo<{ identifier: string }>(({ identifier }) => {
</Flexbox>
</Block>
);
+
+ // For builtin plugins, no link wrapper
+ if (!sourceConfig.clickable) {
+ return content;
+ }
+
+ // For external links (legacy plugins), use <a> tag
+ if (sourceConfig.isExternal && sourceConfig.href) {
+ return (
+ <a href={sourceConfig.href} rel="noopener noreferrer" target="_blank">
+ {content}
+ </a>
+ );
+ }
+
+ // For internal links (market plugins), use Link component
+ if (sourceConfig.href) {
+ return <Link to={sourceConfig.href}>{content}</Link>;
+ }
+
+ return content;
});
export default PluginItem;
diff --git a/src/app/[variants]/(main)/discover/(detail)/assistant/features/Details/Capabilities/Plugins.tsx b/src/app/[variants]/(main)/discover/(detail)/assistant/features/Details/Capabilities/Plugins.tsx
index caf4337dbdd..d59098f45f6 100644
--- a/src/app/[variants]/(main)/discover/(detail)/assistant/features/Details/Capabilities/Plugins.tsx
+++ b/src/app/[variants]/(main)/discover/(detail)/assistant/features/Details/Capabilities/Plugins.tsx
@@ -1,9 +1,7 @@
import { Block } from '@lobehub/ui';
import { Empty } from 'antd';
-import { Link } from 'react-router-dom';
import { memo } from 'react';
import { Flexbox } from 'react-layout-kit';
-import urlJoin from 'url-join';
import { useDetailContext } from '../../DetailProvider';
import PluginItem from './PluginItem';
@@ -24,11 +22,7 @@ const Plugin = memo(() => {
const identifier =
typeof item === 'string' ? item : (item as { identifier: string }).identifier;
- return (
- <Link key={identifier} to={urlJoin('/discover/plugin', identifier)}>
- <PluginItem identifier={identifier} />
- </Link>
- );
+ return <PluginItem identifier={identifier} key={identifier} />;
})}
</Flexbox>
);
diff --git a/src/app/[variants]/(main)/discover/(list)/(home)/Client.tsx b/src/app/[variants]/(main)/discover/(list)/(home)/Client.tsx
index b32d8b38488..727a9cfb1cc 100644
--- a/src/app/[variants]/(main)/discover/(list)/(home)/Client.tsx
+++ b/src/app/[variants]/(main)/discover/(list)/(home)/Client.tsx
@@ -29,12 +29,12 @@ const Client = memo<{ mobile?: boolean }>(() => {
return (
<>
- <Title more={t('home.more')} moreLink={'/assistant'}>
+ <Title more={t('home.more')} moreLink={'/discover/assistant'}>
{t('home.featuredAssistants')}
</Title>
<AssistantList data={assistantList.items} rows={4} />
<div />
- <Title more={t('home.more')} moreLink={'/mcp'}>
+ <Title more={t('home.more')} moreLink={'/discover/mcp'}>
{t('home.featuredTools')}
</Title>
<McpList data={mcpList.items} rows={4} />
diff --git a/src/app/[variants]/(main)/discover/(list)/(home)/index.tsx b/src/app/[variants]/(main)/discover/(list)/(home)/index.tsx
index c996c5fbb4d..3da0a70d914 100644
--- a/src/app/[variants]/(main)/discover/(list)/(home)/index.tsx
+++ b/src/app/[variants]/(main)/discover/(list)/(home)/index.tsx
@@ -29,12 +29,12 @@ const HomePage = memo<{ mobile?: boolean }>(() => {
return (
<>
- <Title more={t('home.more')} moreLink={'/assistant'}>
+ <Title more={t('home.more')} moreLink={'/discover/assistant'}>
{t('home.featuredAssistants')}
</Title>
<AssistantList data={assistantList.items} rows={4} />
<div />
- <Title more={t('home.more')} moreLink={'/mcp'}>
+ <Title more={t('home.more')} moreLink={'/discover/mcp'}>
{t('home.featuredTools')}
</Title>
<McpList data={mcpList.items} rows={4} />
@@ -56,4 +56,3 @@ DesktopHomePage.displayName = 'DesktopHomePage';
export { DesktopHomePage, MobileHomePage };
export default HomePage;
-
diff --git a/src/app/[variants]/(main)/discover/features/Title.tsx b/src/app/[variants]/(main)/discover/features/Title.tsx
index bb1bcfd6366..cab3f3d8672 100644
--- a/src/app/[variants]/(main)/discover/features/Title.tsx
+++ b/src/app/[variants]/(main)/discover/features/Title.tsx
@@ -48,6 +48,7 @@ const Title = memo<TitleProps>(
// Check if it's an external link or internal discover route
const isExternalLink = moreLink?.startsWith('http') ?? false;
const isDiscoverRoute = moreLink?.startsWith('/discover') ?? false;
+ console.log('moreLink', moreLink);
let moreLinkElement = null;
if (moreLink) {
@@ -60,7 +61,7 @@ const Title = memo<TitleProps>(
);
} else if (isDiscoverRoute) {
moreLinkElement = (
- <RouterLink className={styles.more} to={moreLink.replace('/discover', '')}>
+ <RouterLink className={styles.more} to={moreLink}>
<span style={{ marginRight: 4 }}>{more}</span>
<Icon icon={ChevronRight} />
</RouterLink>
diff --git a/src/locales/default/discover.ts b/src/locales/default/discover.ts
index 7046eef18de..3ca82974a77 100644
--- a/src/locales/default/discover.ts
+++ b/src/locales/default/discover.ts
@@ -623,6 +623,7 @@ export default {
supportedProviders: '支持该模型的服务商',
},
plugins: {
+ builtinTag: '内置插件',
community: '社区插件',
details: {
settings: {
@@ -637,6 +638,7 @@ export default {
},
install: '安装插件',
installed: '已安装',
+ legacyTag: '旧版插件',
list: '插件列表',
meta: {
description: '描述',
diff --git a/src/server/services/discover/index.ts b/src/server/services/discover/index.ts
index ee84f479a97..3e35b1135c6 100644
--- a/src/server/services/discover/index.ts
+++ b/src/server/services/discover/index.ts
@@ -921,88 +921,110 @@ export class DiscoverService {
}): Promise<DiscoverPluginDetail | undefined> => {
log('getPluginDetail: params=%O', params);
const { locale, identifier, withManifest } = params;
+
+ // Step 1: Try to find in legacy plugin list
const all = await this._getPluginList(locale);
- let raw = all.find((item) => item.identifier === identifier);
- if (!raw) {
- log(
- 'getPluginDetail: plugin not found in default store for identifier=%s, trying MCP plugin',
- identifier,
- );
- try {
- const mcpDetail = await this.getMcpDetail({ identifier, locale });
- const convertedMcp: Partial<DiscoverPluginDetail> = {
+ const raw = all.find((item) => item.identifier === identifier);
+ if (raw) {
+ log('getPluginDetail: found plugin in legacy list for identifier=%s', identifier);
+ const mergedRaw = merge(cloneDeep(DEFAULT_DISCOVER_PLUGIN_ITEM), raw);
+ const list = await this.getPluginList({
+ category: mergedRaw.category,
+ locale,
+ page: 1,
+ pageSize: 7,
+ });
+
+ const plugin: DiscoverPluginDetail = {
+ ...mergedRaw,
+ related: list.items.filter((item) => item.identifier !== mergedRaw.identifier).slice(0, 6),
+ source: 'legacy',
+ };
+
+ if (!withManifest || !plugin?.manifest || !isString(plugin?.manifest)) {
+ log('getPluginDetail: returning legacy plugin without manifest processing');
+ return plugin;
+ }
+
+ return plugin;
+ }
+
+ // Step 2: Try to find in Market MCP plugins
+ log(
+ 'getPluginDetail: plugin not found in legacy store for identifier=%s, trying MCP plugin',
+ identifier,
+ );
+ try {
+ const mcpDetail = await this.getMcpDetail({ identifier, locale });
+ const convertedMcp: Partial<DiscoverPluginDetail> = {
+ author:
+ typeof (mcpDetail as any).author === 'object'
+ ? (mcpDetail as any).author?.name || ''
+ : (mcpDetail as any).author || '',
+ avatar: (mcpDetail as any).icon || (mcpDetail as any).avatar || '',
+ category: (mcpDetail as any).category as any,
+ createdAt: (mcpDetail as any).createdAt || '',
+ description: mcpDetail.description || '',
+ homepage: mcpDetail.homepage || '',
+ identifier: mcpDetail.identifier,
+ manifest: undefined,
+ related: mcpDetail.related.map((item) => ({
author:
- typeof (mcpDetail as any).author === 'object'
- ? (mcpDetail as any).author?.name || ''
- : (mcpDetail as any).author || '',
- avatar: (mcpDetail as any).icon || (mcpDetail as any).avatar || '',
- category: (mcpDetail as any).category as any,
- createdAt: (mcpDetail as any).createdAt || '',
- description: mcpDetail.description || '',
- homepage: mcpDetail.homepage || '',
- identifier: mcpDetail.identifier,
+ typeof (item as any).author === 'object'
+ ? (item as any).author?.name || ''
+ : (item as any).author || '',
+ avatar: (item as any).icon || (item as any).avatar || '',
+ category: (item as any).category as any,
+ createdAt: (item as any).createdAt || '',
+ description: (item as any).description || '',
+ homepage: (item as any).homepage || '',
+ identifier: item.identifier,
manifest: undefined,
- related: mcpDetail.related.map((item) => ({
- author:
- typeof (item as any).author === 'object'
- ? (item as any).author?.name || ''
- : (item as any).author || '',
- avatar: (item as any).icon || (item as any).avatar || '',
- category: (item as any).category as any,
- createdAt: (item as any).createdAt || '',
- description: (item as any).description || '',
- homepage: (item as any).homepage || '',
- identifier: item.identifier,
- manifest: undefined,
- schemaVersion: 1,
- tags: (item as any).tags || [],
- title: (item as any).name || item.identifier,
- })) as unknown as DiscoverPluginItem[],
schemaVersion: 1,
- tags: (mcpDetail as any).tags || [],
- title: (mcpDetail as any).name || mcpDetail.identifier,
- };
- const plugin = merge(cloneDeep(DEFAULT_DISCOVER_PLUGIN_ITEM), convertedMcp);
- log('getPluginDetail: returning converted MCP plugin');
- return plugin as DiscoverPluginDetail;
- } catch (error) {
- log('getPluginDetail: MCP plugin not found for identifier=%s, error=%O', identifier, error);
- return;
- }
+ tags: (item as any).tags || [],
+ title: (item as any).name || item.identifier,
+ })) as unknown as DiscoverPluginItem[],
+ schemaVersion: 1,
+ source: 'market',
+ tags: (mcpDetail as any).tags || [],
+ title: (mcpDetail as any).name || mcpDetail.identifier,
+ };
+ const plugin = merge(cloneDeep(DEFAULT_DISCOVER_PLUGIN_ITEM), convertedMcp);
+ log('getPluginDetail: returning converted MCP plugin');
+ return plugin as DiscoverPluginDetail;
+ } catch {
+ log(
+ 'getPluginDetail: MCP plugin not found for identifier=%s, trying builtin tools',
+ identifier,
+ );
}
- raw = merge(cloneDeep(DEFAULT_DISCOVER_PLUGIN_ITEM), raw);
- const list = await this.getPluginList({
- category: raw.category,
- locale,
- page: 1,
- pageSize: 7,
- });
-
- let plugin = {
- ...raw,
- related: list.items.filter((item) => item.identifier !== raw.identifier).slice(0, 6),
- };
-
- if (!withManifest || !plugin?.manifest || !isString(plugin?.manifest)) {
- log('getPluginDetail: returning plugin without manifest processing');
+ // Step 3: Try to find in builtin tools
+ const { builtinTools } = await import('@/tools/index');
+ const builtinTool = builtinTools.find((tool) => tool.identifier === identifier);
+ if (builtinTool) {
+ log('getPluginDetail: found builtin tool for identifier=%s', identifier);
+ const plugin: DiscoverPluginDetail = {
+ author: 'LobeHub',
+ avatar: builtinTool.manifest.meta.avatar || '',
+ category: undefined,
+ createdAt: '',
+ description: builtinTool.manifest.meta.description || '',
+ homepage: 'https://lobehub.com',
+ identifier: builtinTool.identifier,
+ manifest: undefined,
+ related: [],
+ schemaVersion: 1,
+ source: 'builtin',
+ tags: builtinTool.manifest.meta.tags || [],
+ title: builtinTool.manifest.meta.title,
+ };
+ log('getPluginDetail: returning builtin tool plugin');
return plugin;
}
- // 在 Edge Runtime 环境中使用了 Node.js 的 path 模块,但 Edge Runtime 不支持所有 Node.js API
- // 这个函数使用了 @lobehub/chat-plugin-sdk/openapi,该包最终依赖了 @apidevtools/swagger-parser,而这个包在 Edge Runtime 环境中使用了不被支持的 Node.js path 模块。
- // try {
- // const manifest = await getToolManifest(plugin.manifest);
- //
- // return {
- // ...plugin,
- // manifest,
- // };
- // } catch {
- // return plugin;
- // }
-
- return plugin;
+ log('getPluginDetail: plugin not found anywhere for identifier=%s', identifier);
+ return;
};
getPluginIdentifiers = async (): Promise<IdentifiersResponse> => {