@lobehub/lobehub 2.0.0-next.338 → 2.0.0-next.339
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.gitattributes +35 -0
- package/CHANGELOG.md +44 -0
- package/changelog/v1.json +15 -0
- package/locales/ar/plugin.json +12 -2
- package/locales/ar/providers.json +1 -0
- package/locales/ar/setting.json +77 -1
- package/locales/bg-BG/models.json +5 -10
- package/locales/bg-BG/plugin.json +12 -2
- package/locales/bg-BG/providers.json +1 -0
- package/locales/bg-BG/setting.json +78 -2
- package/locales/de-DE/models.json +51 -9
- package/locales/de-DE/plugin.json +12 -2
- package/locales/de-DE/providers.json +1 -0
- package/locales/de-DE/setting.json +78 -2
- package/locales/en-US/models.json +11 -10
- package/locales/en-US/plugin.json +14 -4
- package/locales/en-US/providers.json +1 -0
- package/locales/en-US/setting.json +78 -2
- package/locales/es-ES/plugin.json +12 -2
- package/locales/es-ES/providers.json +1 -0
- package/locales/es-ES/setting.json +78 -2
- package/locales/fa-IR/plugin.json +12 -2
- package/locales/fa-IR/providers.json +1 -0
- package/locales/fa-IR/setting.json +78 -2
- package/locales/fr-FR/plugin.json +12 -2
- package/locales/fr-FR/providers.json +1 -0
- package/locales/fr-FR/setting.json +78 -2
- package/locales/it-IT/plugin.json +12 -2
- package/locales/it-IT/providers.json +1 -0
- package/locales/it-IT/setting.json +78 -2
- package/locales/ja-JP/plugin.json +12 -2
- package/locales/ja-JP/providers.json +1 -0
- package/locales/ja-JP/setting.json +78 -2
- package/locales/ko-KR/plugin.json +12 -2
- package/locales/ko-KR/providers.json +1 -0
- package/locales/ko-KR/setting.json +78 -2
- package/locales/nl-NL/models.json +4 -9
- package/locales/nl-NL/plugin.json +12 -2
- package/locales/nl-NL/providers.json +1 -0
- package/locales/nl-NL/setting.json +78 -2
- package/locales/pl-PL/plugin.json +12 -2
- package/locales/pl-PL/providers.json +1 -0
- package/locales/pl-PL/setting.json +78 -2
- package/locales/pt-BR/plugin.json +12 -2
- package/locales/pt-BR/providers.json +1 -0
- package/locales/pt-BR/setting.json +78 -2
- package/locales/ru-RU/plugin.json +12 -2
- package/locales/ru-RU/providers.json +1 -0
- package/locales/ru-RU/setting.json +78 -2
- package/locales/tr-TR/plugin.json +12 -2
- package/locales/tr-TR/providers.json +1 -0
- package/locales/tr-TR/setting.json +78 -2
- package/locales/vi-VN/plugin.json +12 -2
- package/locales/vi-VN/providers.json +1 -0
- package/locales/vi-VN/setting.json +77 -1
- package/locales/zh-CN/plugin.json +12 -2
- package/locales/zh-CN/providers.json +1 -0
- package/locales/zh-CN/setting.json +78 -2
- package/locales/zh-TW/plugin.json +12 -2
- package/locales/zh-TW/providers.json +1 -0
- package/locales/zh-TW/setting.json +78 -2
- package/package.json +1 -1
- package/packages/agent-runtime/src/groupOrchestration/GroupOrchestrationSupervisor.ts +2 -0
- package/packages/agent-runtime/src/groupOrchestration/__tests__/GroupOrchestrationSupervisor.test.ts +3 -1
- package/packages/agent-runtime/src/groupOrchestration/types.ts +5 -0
- package/packages/const/src/index.ts +1 -0
- package/packages/const/src/klavis.ts +144 -0
- package/packages/const/src/lobehubSkill.ts +34 -0
- package/packages/const/src/recommendedSkill.ts +17 -0
- package/packages/model-runtime/src/core/contextBuilders/anthropic.test.ts +38 -0
- package/packages/model-runtime/src/core/contextBuilders/anthropic.ts +20 -1
- package/packages/model-runtime/src/core/contextBuilders/google.test.ts +42 -0
- package/packages/model-runtime/src/core/contextBuilders/google.ts +17 -0
- package/scripts/electronWorkflow/modifiers/dynamicToStatic.mts +273 -0
- package/scripts/electronWorkflow/modifiers/index.mts +10 -0
- package/scripts/electronWorkflow/modifiers/nextConfig.mts +1 -0
- package/scripts/electronWorkflow/modifiers/nextDynamicToStatic.mts +233 -0
- package/scripts/electronWorkflow/modifiers/removeSuspense.mts +124 -0
- package/scripts/electronWorkflow/modifiers/routes.mts +14 -2
- package/scripts/electronWorkflow/modifiers/settingsContentToStatic.mts +148 -0
- package/scripts/electronWorkflow/modifiers/wrapChildrenWithClientOnly.mts +73 -0
- package/src/app/[variants]/(main)/home/features/InputArea/SkillInstallBanner.tsx +131 -0
- package/src/app/[variants]/(main)/home/features/InputArea/index.tsx +34 -27
- package/src/app/[variants]/(main)/settings/features/SettingHeader.tsx +8 -4
- package/src/app/[variants]/(main)/settings/features/SettingsContent.tsx +3 -0
- package/src/app/[variants]/(main)/settings/hooks/useCategory.tsx +6 -0
- package/src/{features/PluginStore/InstalledList/List/Item/Action.tsx → app/[variants]/(main)/settings/skill/features/Actions.tsx} +45 -40
- package/src/app/[variants]/(main)/settings/skill/features/KlavisSkillItem.tsx +353 -0
- package/src/app/[variants]/(main)/settings/skill/features/LobehubSkillItem.tsx +344 -0
- package/src/app/[variants]/(main)/settings/skill/features/McpSkillItem.tsx +116 -0
- package/src/app/[variants]/(main)/settings/skill/features/SkillList.tsx +244 -0
- package/src/app/[variants]/(main)/settings/skill/index.tsx +35 -0
- package/src/components/Plugins/PluginTag.tsx +23 -35
- package/src/components/client/ClientOnly.tsx +6 -2
- package/src/features/AgentSetting/AgentPlugin/index.tsx +2 -2
- package/src/features/ChatInput/ActionBar/Tools/KlavisServerItem.tsx +8 -32
- package/src/features/ChatInput/ActionBar/Tools/LobehubSkillServerItem.tsx +8 -30
- package/src/features/ChatInput/ActionBar/Tools/PopoverContent.tsx +48 -59
- package/src/features/ChatInput/ActionBar/Tools/index.tsx +5 -23
- package/src/features/ChatInput/ActionBar/Tools/useControls.tsx +158 -56
- package/src/features/IntegrationDetailModal/index.tsx +293 -0
- package/src/features/{PluginStore/McpList/Detail → MCP/MCPDetail}/index.tsx +15 -6
- package/src/features/MCP/MCPSettings/McpSettingsModal.tsx +58 -0
- package/src/features/{PluginStore/McpList/Detail/Settings → MCP/MCPSettings}/index.tsx +39 -27
- package/src/features/PluginDetailModal/index.tsx +2 -2
- package/src/features/PluginDevModal/index.tsx +16 -40
- package/src/features/ProfileEditor/AgentTool.tsx +2 -2
- package/src/features/ProtocolUrlHandler/InstallPlugin/OfficialPluginInstallModal/index.tsx +1 -1
- package/src/features/{PluginStore/AddPluginButton.tsx → SkillStore/AddSkillButton.tsx} +3 -3
- package/src/features/SkillStore/CommunityList/Item.tsx +158 -0
- package/src/features/SkillStore/CommunityList/index.tsx +101 -0
- package/src/features/SkillStore/Content.tsx +59 -0
- package/src/features/{PluginStore/PluginEmpty.tsx → SkillStore/Empty.tsx} +8 -8
- package/src/features/SkillStore/LobeHubList/Item.tsx +118 -0
- package/src/features/SkillStore/LobeHubList/index.tsx +187 -0
- package/src/features/SkillStore/LobeHubList/useSkillConnect.ts +239 -0
- package/src/features/SkillStore/Search/index.tsx +43 -0
- package/src/features/{PluginStore → SkillStore}/index.tsx +14 -10
- package/src/features/SkillStore/style.ts +27 -0
- package/src/locales/default/plugin.ts +15 -4
- package/src/locales/default/setting.ts +185 -2
- package/src/services/chat/mecha/agentConfigResolver.test.ts +197 -0
- package/src/services/chat/mecha/agentConfigResolver.ts +44 -17
- package/src/store/chat/agents/GroupOrchestration/createGroupOrchestrationExecutors.ts +40 -37
- package/src/store/chat/slices/aiChat/actions/__tests__/streamingExecutor.test.ts +78 -0
- package/src/store/chat/slices/aiChat/actions/streamingExecutor.ts +50 -16
- package/src/store/global/initialState.ts +1 -0
- package/src/store/tool/slices/lobehubSkillStore/action.test.ts +914 -0
- package/src/store/tool/slices/lobehubSkillStore/selectors.test.ts +548 -0
- package/.cursor/skills/vercel-react-best-practices/AGENTS.md +0 -2410
- package/.cursor/skills/vercel-react-best-practices/SKILL.md +0 -125
- package/.cursor/skills/vercel-react-best-practices/rules/advanced-event-handler-refs.md +0 -55
- package/.cursor/skills/vercel-react-best-practices/rules/advanced-use-latest.md +0 -49
- package/.cursor/skills/vercel-react-best-practices/rules/async-api-routes.md +0 -38
- package/.cursor/skills/vercel-react-best-practices/rules/async-defer-await.md +0 -80
- package/.cursor/skills/vercel-react-best-practices/rules/async-dependencies.md +0 -36
- package/.cursor/skills/vercel-react-best-practices/rules/async-parallel.md +0 -28
- package/.cursor/skills/vercel-react-best-practices/rules/async-suspense-boundaries.md +0 -99
- package/.cursor/skills/vercel-react-best-practices/rules/bundle-barrel-imports.md +0 -59
- package/.cursor/skills/vercel-react-best-practices/rules/bundle-conditional.md +0 -31
- package/.cursor/skills/vercel-react-best-practices/rules/bundle-defer-third-party.md +0 -49
- package/.cursor/skills/vercel-react-best-practices/rules/bundle-dynamic-imports.md +0 -35
- package/.cursor/skills/vercel-react-best-practices/rules/bundle-preload.md +0 -50
- package/.cursor/skills/vercel-react-best-practices/rules/client-event-listeners.md +0 -74
- package/.cursor/skills/vercel-react-best-practices/rules/client-localstorage-schema.md +0 -71
- package/.cursor/skills/vercel-react-best-practices/rules/client-passive-event-listeners.md +0 -48
- package/.cursor/skills/vercel-react-best-practices/rules/client-swr-dedup.md +0 -56
- package/.cursor/skills/vercel-react-best-practices/rules/js-batch-dom-css.md +0 -57
- package/.cursor/skills/vercel-react-best-practices/rules/js-cache-function-results.md +0 -80
- package/.cursor/skills/vercel-react-best-practices/rules/js-cache-property-access.md +0 -28
- package/.cursor/skills/vercel-react-best-practices/rules/js-cache-storage.md +0 -70
- package/.cursor/skills/vercel-react-best-practices/rules/js-combine-iterations.md +0 -32
- package/.cursor/skills/vercel-react-best-practices/rules/js-early-exit.md +0 -50
- package/.cursor/skills/vercel-react-best-practices/rules/js-hoist-regexp.md +0 -45
- package/.cursor/skills/vercel-react-best-practices/rules/js-index-maps.md +0 -37
- package/.cursor/skills/vercel-react-best-practices/rules/js-length-check-first.md +0 -49
- package/.cursor/skills/vercel-react-best-practices/rules/js-min-max-loop.md +0 -82
- package/.cursor/skills/vercel-react-best-practices/rules/js-set-map-lookups.md +0 -24
- package/.cursor/skills/vercel-react-best-practices/rules/js-tosorted-immutable.md +0 -57
- package/.cursor/skills/vercel-react-best-practices/rules/rendering-activity.md +0 -26
- package/.cursor/skills/vercel-react-best-practices/rules/rendering-animate-svg-wrapper.md +0 -47
- package/.cursor/skills/vercel-react-best-practices/rules/rendering-conditional-render.md +0 -40
- package/.cursor/skills/vercel-react-best-practices/rules/rendering-content-visibility.md +0 -38
- package/.cursor/skills/vercel-react-best-practices/rules/rendering-hoist-jsx.md +0 -46
- package/.cursor/skills/vercel-react-best-practices/rules/rendering-hydration-no-flicker.md +0 -82
- package/.cursor/skills/vercel-react-best-practices/rules/rendering-svg-precision.md +0 -28
- package/.cursor/skills/vercel-react-best-practices/rules/rerender-defer-reads.md +0 -39
- package/.cursor/skills/vercel-react-best-practices/rules/rerender-dependencies.md +0 -45
- package/.cursor/skills/vercel-react-best-practices/rules/rerender-derived-state.md +0 -29
- package/.cursor/skills/vercel-react-best-practices/rules/rerender-functional-setstate.md +0 -74
- package/.cursor/skills/vercel-react-best-practices/rules/rerender-lazy-state-init.md +0 -58
- package/.cursor/skills/vercel-react-best-practices/rules/rerender-memo.md +0 -44
- package/.cursor/skills/vercel-react-best-practices/rules/rerender-transitions.md +0 -40
- package/.cursor/skills/vercel-react-best-practices/rules/server-after-nonblocking.md +0 -73
- package/.cursor/skills/vercel-react-best-practices/rules/server-cache-lru.md +0 -41
- package/.cursor/skills/vercel-react-best-practices/rules/server-cache-react.md +0 -76
- package/.cursor/skills/vercel-react-best-practices/rules/server-parallel-fetching.md +0 -83
- package/.cursor/skills/vercel-react-best-practices/rules/server-serialization.md +0 -38
- package/src/features/PluginStore/Content.tsx +0 -54
- package/src/features/PluginStore/InstalledList/Detail/CustomPluginEmptyState.tsx +0 -79
- package/src/features/PluginStore/InstalledList/Detail/index.tsx +0 -21
- package/src/features/PluginStore/InstalledList/List/Item/index.tsx +0 -61
- package/src/features/PluginStore/InstalledList/List/index.tsx +0 -72
- package/src/features/PluginStore/InstalledList/index.tsx +0 -90
- package/src/features/PluginStore/McpList/List/Action.tsx +0 -119
- package/src/features/PluginStore/McpList/List/Item.tsx +0 -83
- package/src/features/PluginStore/McpList/List/index.tsx +0 -93
- package/src/features/PluginStore/McpList/index.tsx +0 -58
- package/src/features/PluginStore/PluginList/Detail/DetailProvider.tsx +0 -19
- package/src/features/PluginStore/PluginList/Detail/EmptyState.tsx +0 -56
- package/src/features/PluginStore/PluginList/Detail/Header.tsx +0 -130
- package/src/features/PluginStore/PluginList/Detail/InstallDetail/Nav.tsx +0 -73
- package/src/features/PluginStore/PluginList/Detail/InstallDetail/Settings.tsx +0 -19
- package/src/features/PluginStore/PluginList/Detail/InstallDetail/Tools.tsx +0 -111
- package/src/features/PluginStore/PluginList/Detail/InstallDetail/index.tsx +0 -24
- package/src/features/PluginStore/PluginList/Detail/Loading.tsx +0 -42
- package/src/features/PluginStore/PluginList/Detail/TagList.tsx +0 -35
- package/src/features/PluginStore/PluginList/Detail/index.tsx +0 -39
- package/src/features/PluginStore/PluginList/Detail/useCategory.tsx +0 -76
- package/src/features/PluginStore/PluginList/List/Action.tsx +0 -78
- package/src/features/PluginStore/PluginList/List/Item.tsx +0 -92
- package/src/features/PluginStore/PluginList/List/index.tsx +0 -94
- package/src/features/PluginStore/PluginList/index.tsx +0 -46
- package/src/features/PluginStore/Search/index.tsx +0 -40
- /package/{.codex/skills → .agents}/vercel-react-best-practices/AGENTS.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/SKILL.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/advanced-event-handler-refs.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/advanced-use-latest.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/async-api-routes.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/async-defer-await.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/async-dependencies.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/async-parallel.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/async-suspense-boundaries.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/bundle-barrel-imports.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/bundle-conditional.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/bundle-defer-third-party.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/bundle-dynamic-imports.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/bundle-preload.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/client-event-listeners.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/client-localstorage-schema.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/client-passive-event-listeners.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/client-swr-dedup.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/js-batch-dom-css.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/js-cache-function-results.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/js-cache-property-access.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/js-cache-storage.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/js-combine-iterations.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/js-early-exit.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/js-hoist-regexp.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/js-index-maps.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/js-length-check-first.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/js-min-max-loop.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/js-set-map-lookups.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/js-tosorted-immutable.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/rendering-activity.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/rendering-animate-svg-wrapper.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/rendering-conditional-render.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/rendering-content-visibility.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/rendering-hoist-jsx.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/rendering-hydration-no-flicker.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/rendering-svg-precision.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/rerender-defer-reads.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/rerender-dependencies.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/rerender-derived-state.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/rerender-functional-setstate.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/rerender-lazy-state-init.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/rerender-memo.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/rerender-transitions.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/server-after-nonblocking.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/server-cache-lru.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/server-cache-react.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/server-parallel-fetching.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/server-serialization.md +0 -0
- /package/src/{features/PluginStore/InstalledList → app/[variants]/(main)/settings/skill/features}/EditCustomPlugin.tsx +0 -0
- /package/src/features/{PluginStore/McpList/Detail → MCP/MCPDetail}/Loading.tsx +0 -0
- /package/src/features/{PluginStore → SkillStore}/Loading.tsx +0 -0
- /package/src/features/{PluginStore → SkillStore}/VirtuosoLoading.tsx +0 -0
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { Block, Flexbox, Text } from '@lobehub/ui';
|
|
2
|
-
import { memo } from 'react';
|
|
3
|
-
|
|
4
|
-
import PluginAvatar from '@/components/Plugins/PluginAvatar';
|
|
5
|
-
import PluginTag from '@/components/Plugins/PluginTag';
|
|
6
|
-
import { type DiscoverPluginItem } from '@/types/discover';
|
|
7
|
-
import { type LobeToolType } from '@/types/tool/tool';
|
|
8
|
-
|
|
9
|
-
import Actions from './Action';
|
|
10
|
-
|
|
11
|
-
interface PluginItemProps extends DiscoverPluginItem {
|
|
12
|
-
active?: boolean;
|
|
13
|
-
onClick?: () => void;
|
|
14
|
-
runtimeType?: 'mcp' | 'default' | 'markdown' | 'standalone' | undefined;
|
|
15
|
-
type: LobeToolType;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
const Item = memo<PluginItemProps>(
|
|
19
|
-
({ title, description, avatar, onClick, active, identifier, author, runtimeType, type }) => {
|
|
20
|
-
const isMCP = runtimeType === 'mcp';
|
|
21
|
-
|
|
22
|
-
return (
|
|
23
|
-
<Block
|
|
24
|
-
align={'center'}
|
|
25
|
-
clickable
|
|
26
|
-
gap={8}
|
|
27
|
-
horizontal
|
|
28
|
-
justify={'space-between'}
|
|
29
|
-
onClick={onClick}
|
|
30
|
-
paddingBlock={8}
|
|
31
|
-
paddingInline={12}
|
|
32
|
-
style={{ position: 'relative' }}
|
|
33
|
-
variant={active ? 'filled' : 'borderless'}
|
|
34
|
-
>
|
|
35
|
-
<Flexbox
|
|
36
|
-
align={'center'}
|
|
37
|
-
flex={1}
|
|
38
|
-
gap={8}
|
|
39
|
-
horizontal
|
|
40
|
-
style={{ overflow: 'hidden', position: 'relative' }}
|
|
41
|
-
>
|
|
42
|
-
<PluginAvatar avatar={avatar} />
|
|
43
|
-
<Flexbox flex={1} gap={4} style={{ overflow: 'hidden', position: 'relative' }}>
|
|
44
|
-
<Flexbox align={'center'} gap={4} horizontal>
|
|
45
|
-
<Text ellipsis strong>
|
|
46
|
-
{title}
|
|
47
|
-
</Text>
|
|
48
|
-
<PluginTag author={author} isMCP={isMCP} type={type!} />
|
|
49
|
-
</Flexbox>
|
|
50
|
-
<Text ellipsis fontSize={12} type={'secondary'}>
|
|
51
|
-
{description}
|
|
52
|
-
</Text>
|
|
53
|
-
</Flexbox>
|
|
54
|
-
</Flexbox>
|
|
55
|
-
<Actions identifier={identifier} isMCP={isMCP} type={type!} />
|
|
56
|
-
</Block>
|
|
57
|
-
);
|
|
58
|
-
},
|
|
59
|
-
);
|
|
60
|
-
|
|
61
|
-
export default Item;
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { Flexbox } from '@lobehub/ui';
|
|
2
|
-
import isEqual from 'fast-deep-equal';
|
|
3
|
-
import { memo, useMemo } from 'react';
|
|
4
|
-
import { Virtuoso } from 'react-virtuoso';
|
|
5
|
-
|
|
6
|
-
import { useToolStore } from '@/store/tool';
|
|
7
|
-
import { pluginSelectors } from '@/store/tool/selectors';
|
|
8
|
-
import { type LobeToolType } from '@/types/tool/tool';
|
|
9
|
-
|
|
10
|
-
import PluginEmpty from '../../PluginEmpty';
|
|
11
|
-
import PluginItem from './Item';
|
|
12
|
-
|
|
13
|
-
interface ListProps {
|
|
14
|
-
identifier?: string;
|
|
15
|
-
keywords?: string;
|
|
16
|
-
setIdentifier?: (props: {
|
|
17
|
-
identifier?: string;
|
|
18
|
-
runtimeType: 'mcp' | 'default';
|
|
19
|
-
type?: LobeToolType;
|
|
20
|
-
}) => void;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export const List = memo<ListProps>(({ keywords, identifier, setIdentifier }) => {
|
|
24
|
-
const installedPlugins = useToolStore(pluginSelectors.installedPluginMetaList, isEqual);
|
|
25
|
-
|
|
26
|
-
const filteredPluginList = useMemo(
|
|
27
|
-
() =>
|
|
28
|
-
installedPlugins.filter((item) =>
|
|
29
|
-
[item?.title, item?.description, item.author, ...(item?.tags || [])]
|
|
30
|
-
.filter(Boolean)
|
|
31
|
-
.join('')
|
|
32
|
-
.toLowerCase()
|
|
33
|
-
.includes((keywords || '')?.toLowerCase()),
|
|
34
|
-
),
|
|
35
|
-
[installedPlugins, keywords],
|
|
36
|
-
);
|
|
37
|
-
|
|
38
|
-
const isEmpty = installedPlugins.length === 0;
|
|
39
|
-
const hasSearchKeywords = Boolean(keywords && keywords.trim());
|
|
40
|
-
|
|
41
|
-
if (isEmpty) return <PluginEmpty search={hasSearchKeywords} />;
|
|
42
|
-
|
|
43
|
-
return (
|
|
44
|
-
<Virtuoso
|
|
45
|
-
data={filteredPluginList}
|
|
46
|
-
increaseViewportBy={typeof window !== 'undefined' ? window.innerHeight : 0}
|
|
47
|
-
itemContent={(_, item) => {
|
|
48
|
-
return (
|
|
49
|
-
<Flexbox
|
|
50
|
-
key={item.identifier}
|
|
51
|
-
onClick={() => {
|
|
52
|
-
setIdentifier?.({
|
|
53
|
-
identifier: item.identifier,
|
|
54
|
-
runtimeType: item.runtimeType as any,
|
|
55
|
-
type: item.type,
|
|
56
|
-
});
|
|
57
|
-
}}
|
|
58
|
-
paddingBlock={2}
|
|
59
|
-
paddingInline={4}
|
|
60
|
-
>
|
|
61
|
-
<PluginItem active={identifier === item.identifier} {...(item as any)} />
|
|
62
|
-
</Flexbox>
|
|
63
|
-
);
|
|
64
|
-
}}
|
|
65
|
-
overscan={24}
|
|
66
|
-
style={{ height: '100%', width: '100%' }}
|
|
67
|
-
totalCount={filteredPluginList.length}
|
|
68
|
-
/>
|
|
69
|
-
);
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
export default List;
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import { Center, DraggablePanel, Empty, Flexbox } from '@lobehub/ui';
|
|
2
|
-
import { cssVar, useTheme } from 'antd-style';
|
|
3
|
-
import { Plug2 } from 'lucide-react';
|
|
4
|
-
import { memo, useRef, useState } from 'react';
|
|
5
|
-
import { useTranslation } from 'react-i18next';
|
|
6
|
-
|
|
7
|
-
import { useToolStore } from '@/store/tool';
|
|
8
|
-
import { pluginSelectors } from '@/store/tool/selectors';
|
|
9
|
-
import { type LobeToolType } from '@/types/tool/tool';
|
|
10
|
-
|
|
11
|
-
import PluginEmpty from '../PluginEmpty';
|
|
12
|
-
import Detail from './Detail';
|
|
13
|
-
import List from './List';
|
|
14
|
-
|
|
15
|
-
const PluginList = memo<{ keywords?: string }>(({ keywords }) => {
|
|
16
|
-
const { t } = useTranslation('plugin');
|
|
17
|
-
const ref = useRef<HTMLDivElement>(null);
|
|
18
|
-
|
|
19
|
-
const [type, setType] = useState<LobeToolType>();
|
|
20
|
-
const [runtimeType, setRuntimeType] = useState<'mcp' | 'default'>();
|
|
21
|
-
const theme = useTheme(); // Keep for colorBgContainerSecondary (not in cssVar)
|
|
22
|
-
|
|
23
|
-
const [identifier] = useToolStore((s) => [s.activePluginIdentifier]);
|
|
24
|
-
const isEmpty = useToolStore((s) => pluginSelectors.installedPluginMetaList(s).length === 0);
|
|
25
|
-
|
|
26
|
-
if (isEmpty)
|
|
27
|
-
return (
|
|
28
|
-
<Center height={'75vh'}>
|
|
29
|
-
<PluginEmpty />
|
|
30
|
-
</Center>
|
|
31
|
-
);
|
|
32
|
-
|
|
33
|
-
return (
|
|
34
|
-
<Flexbox
|
|
35
|
-
height={'75vh'}
|
|
36
|
-
horizontal
|
|
37
|
-
style={{
|
|
38
|
-
borderTop: `1px solid ${cssVar.colorBorderSecondary}`,
|
|
39
|
-
overflow: 'hidden',
|
|
40
|
-
position: 'relative',
|
|
41
|
-
}}
|
|
42
|
-
width={'100%'}
|
|
43
|
-
>
|
|
44
|
-
<DraggablePanel maxWidth={1024} minWidth={420} placement={'left'}>
|
|
45
|
-
<List
|
|
46
|
-
identifier={identifier}
|
|
47
|
-
keywords={keywords}
|
|
48
|
-
setIdentifier={({ identifier, type, runtimeType }) => {
|
|
49
|
-
useToolStore.setState({ activePluginIdentifier: identifier });
|
|
50
|
-
setType(type);
|
|
51
|
-
setRuntimeType(runtimeType);
|
|
52
|
-
ref?.current?.scrollTo({ top: 0 });
|
|
53
|
-
}}
|
|
54
|
-
/>
|
|
55
|
-
</DraggablePanel>
|
|
56
|
-
{identifier ? (
|
|
57
|
-
<Flexbox
|
|
58
|
-
height={'100%'}
|
|
59
|
-
padding={16}
|
|
60
|
-
ref={ref}
|
|
61
|
-
style={{
|
|
62
|
-
background: theme.colorBgContainerSecondary,
|
|
63
|
-
overflowX: 'hidden',
|
|
64
|
-
overflowY: 'auto',
|
|
65
|
-
}}
|
|
66
|
-
width={'100%'}
|
|
67
|
-
>
|
|
68
|
-
<Detail identifier={identifier} runtimeType={runtimeType} type={type} />
|
|
69
|
-
</Flexbox>
|
|
70
|
-
) : (
|
|
71
|
-
<Center
|
|
72
|
-
height={'100%'}
|
|
73
|
-
style={{
|
|
74
|
-
background: theme.colorBgContainerSecondary,
|
|
75
|
-
}}
|
|
76
|
-
width={'100%'}
|
|
77
|
-
>
|
|
78
|
-
<Empty
|
|
79
|
-
description={t('store.emptySelectHint')}
|
|
80
|
-
descriptionProps={{ fontSize: 14 }}
|
|
81
|
-
icon={Plug2}
|
|
82
|
-
style={{ maxWidth: 400 }}
|
|
83
|
-
/>
|
|
84
|
-
</Center>
|
|
85
|
-
)}
|
|
86
|
-
</Flexbox>
|
|
87
|
-
);
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
export default PluginList;
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import { ActionIcon, Button, DropdownMenu, Flexbox, Icon } from '@lobehub/ui';
|
|
2
|
-
import { App } from 'antd';
|
|
3
|
-
import { MoreVerticalIcon, Trash2 } from 'lucide-react';
|
|
4
|
-
import { memo } from 'react';
|
|
5
|
-
import { useTranslation } from 'react-i18next';
|
|
6
|
-
|
|
7
|
-
import { useMarketAuth } from '@/layout/AuthProvider/MarketAuth';
|
|
8
|
-
import { useAgentStore } from '@/store/agent';
|
|
9
|
-
import { agentSelectors } from '@/store/agent/selectors';
|
|
10
|
-
import { useToolStore } from '@/store/tool';
|
|
11
|
-
import { mcpStoreSelectors, pluginSelectors } from '@/store/tool/selectors';
|
|
12
|
-
|
|
13
|
-
interface ActionsProps {
|
|
14
|
-
identifier: string;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const Actions = memo<ActionsProps>(({ identifier }) => {
|
|
18
|
-
const [installed, installing, unInstallPlugin, installMCPPlugin, cancelInstallMCPPlugin, plugin] =
|
|
19
|
-
useToolStore((s) => [
|
|
20
|
-
pluginSelectors.isPluginInstalled(identifier)(s),
|
|
21
|
-
mcpStoreSelectors.isMCPInstalling(identifier)(s),
|
|
22
|
-
s.uninstallPlugin,
|
|
23
|
-
s.installMCPPlugin,
|
|
24
|
-
s.cancelInstallMCPPlugin,
|
|
25
|
-
mcpStoreSelectors.getPluginById(identifier)(s),
|
|
26
|
-
]);
|
|
27
|
-
|
|
28
|
-
const { t } = useTranslation('plugin');
|
|
29
|
-
const [togglePlugin, isPluginEnabledInAgent] = useAgentStore((s) => [
|
|
30
|
-
s.togglePlugin,
|
|
31
|
-
agentSelectors.currentAgentPlugins(s).includes(identifier),
|
|
32
|
-
]);
|
|
33
|
-
const { modal } = App.useApp();
|
|
34
|
-
const { isAuthenticated, signIn } = useMarketAuth();
|
|
35
|
-
|
|
36
|
-
// Check if this is a cloud MCP plugin
|
|
37
|
-
const isCloudMcp = !!((plugin as any)?.cloudEndPoint || (plugin as any)?.haveCloudEndpoint);
|
|
38
|
-
|
|
39
|
-
return (
|
|
40
|
-
<Flexbox align={'center'} horizontal>
|
|
41
|
-
{installed ? (
|
|
42
|
-
<DropdownMenu
|
|
43
|
-
items={[
|
|
44
|
-
{
|
|
45
|
-
danger: true,
|
|
46
|
-
icon: <Icon icon={Trash2} />,
|
|
47
|
-
key: 'uninstall',
|
|
48
|
-
label: t('store.actions.uninstall'),
|
|
49
|
-
onClick: () => {
|
|
50
|
-
modal.confirm({
|
|
51
|
-
centered: true,
|
|
52
|
-
okButtonProps: { danger: true },
|
|
53
|
-
onOk: async () => {
|
|
54
|
-
// If plugin is enabled in current agent, disable it first
|
|
55
|
-
if (isPluginEnabledInAgent) {
|
|
56
|
-
await togglePlugin(identifier, false);
|
|
57
|
-
}
|
|
58
|
-
await unInstallPlugin(identifier);
|
|
59
|
-
},
|
|
60
|
-
title: t('store.actions.confirmUninstall'),
|
|
61
|
-
type: 'error',
|
|
62
|
-
});
|
|
63
|
-
},
|
|
64
|
-
},
|
|
65
|
-
]}
|
|
66
|
-
placement="bottomRight"
|
|
67
|
-
>
|
|
68
|
-
<ActionIcon
|
|
69
|
-
icon={MoreVerticalIcon}
|
|
70
|
-
loading={installing}
|
|
71
|
-
onClick={(e) => {
|
|
72
|
-
e.stopPropagation();
|
|
73
|
-
}}
|
|
74
|
-
/>
|
|
75
|
-
</DropdownMenu>
|
|
76
|
-
) : installing ? (
|
|
77
|
-
<Button
|
|
78
|
-
onClick={async (e) => {
|
|
79
|
-
e.stopPropagation();
|
|
80
|
-
await cancelInstallMCPPlugin(identifier);
|
|
81
|
-
}}
|
|
82
|
-
variant={'filled'}
|
|
83
|
-
>
|
|
84
|
-
{t('store.actions.cancel')}
|
|
85
|
-
</Button>
|
|
86
|
-
) : (
|
|
87
|
-
<Button
|
|
88
|
-
onClick={async (e) => {
|
|
89
|
-
e.stopPropagation();
|
|
90
|
-
|
|
91
|
-
// If this is a cloud MCP and user is not authenticated, request authorization first
|
|
92
|
-
if (isCloudMcp && !isAuthenticated) {
|
|
93
|
-
console.log(
|
|
94
|
-
'[MCPListAction] Cloud MCP detected, user not authenticated, starting authorization',
|
|
95
|
-
);
|
|
96
|
-
|
|
97
|
-
try {
|
|
98
|
-
await signIn();
|
|
99
|
-
} catch {
|
|
100
|
-
return; // Don't proceed with installation if auth fails
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
const isSuccess = await installMCPPlugin(identifier);
|
|
105
|
-
|
|
106
|
-
if (isSuccess) {
|
|
107
|
-
await togglePlugin(identifier);
|
|
108
|
-
}
|
|
109
|
-
}}
|
|
110
|
-
variant={'filled'}
|
|
111
|
-
>
|
|
112
|
-
{t('store.actions.install')}
|
|
113
|
-
</Button>
|
|
114
|
-
)}
|
|
115
|
-
</Flexbox>
|
|
116
|
-
);
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
export default Actions;
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import { Block, Flexbox, Text } from '@lobehub/ui';
|
|
2
|
-
import isEqual from 'fast-deep-equal';
|
|
3
|
-
import { memo, useEffect, useRef } from 'react';
|
|
4
|
-
|
|
5
|
-
import PluginAvatar from '@/components/Plugins/PluginAvatar';
|
|
6
|
-
import MCPInstallProgress from '@/features/MCP/MCPInstallProgress';
|
|
7
|
-
import { useToolStore } from '@/store/tool';
|
|
8
|
-
import { mcpStoreSelectors } from '@/store/tool/selectors';
|
|
9
|
-
import { type DiscoverMcpItem } from '@/types/discover';
|
|
10
|
-
import { MCPInstallStep } from '@/types/plugins';
|
|
11
|
-
import { type LobeToolType } from '@/types/tool/tool';
|
|
12
|
-
|
|
13
|
-
import Actions from './Action';
|
|
14
|
-
|
|
15
|
-
interface PluginItemProps extends DiscoverMcpItem {
|
|
16
|
-
active?: boolean;
|
|
17
|
-
setIdentifier: (identifier?: string) => void;
|
|
18
|
-
type?: LobeToolType;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const Item = memo<PluginItemProps>(
|
|
22
|
-
({ name, description, icon, setIdentifier, active, identifier }) => {
|
|
23
|
-
const installProgress = useToolStore(
|
|
24
|
-
mcpStoreSelectors.getMCPInstallProgress(identifier),
|
|
25
|
-
isEqual,
|
|
26
|
-
);
|
|
27
|
-
|
|
28
|
-
const needsConfig = installProgress?.needsConfig;
|
|
29
|
-
const needsDependencies = installProgress?.step === MCPInstallStep.DEPENDENCIES_REQUIRED;
|
|
30
|
-
|
|
31
|
-
const containerRef = useRef<HTMLButtonElement | null>(null);
|
|
32
|
-
|
|
33
|
-
useEffect(() => {
|
|
34
|
-
if ((!needsConfig && !needsDependencies) || !containerRef.current) return;
|
|
35
|
-
|
|
36
|
-
containerRef.current.scrollIntoView({ behavior: 'smooth', block: 'start' });
|
|
37
|
-
}, [needsConfig, needsDependencies]);
|
|
38
|
-
|
|
39
|
-
return (
|
|
40
|
-
<Flexbox gap={0} ref={containerRef}>
|
|
41
|
-
<Block
|
|
42
|
-
align={'center'}
|
|
43
|
-
clickable
|
|
44
|
-
gap={16}
|
|
45
|
-
horizontal
|
|
46
|
-
justify={'space-between'}
|
|
47
|
-
onClick={() => setIdentifier(identifier)}
|
|
48
|
-
paddingBlock={8}
|
|
49
|
-
paddingInline={12}
|
|
50
|
-
style={{ position: 'relative' }}
|
|
51
|
-
variant={active ? 'filled' : 'borderless'}
|
|
52
|
-
>
|
|
53
|
-
<Flexbox
|
|
54
|
-
align={'center'}
|
|
55
|
-
flex={1}
|
|
56
|
-
gap={8}
|
|
57
|
-
horizontal
|
|
58
|
-
style={{ overflow: 'hidden', position: 'relative' }}
|
|
59
|
-
>
|
|
60
|
-
<PluginAvatar avatar={icon} />
|
|
61
|
-
<Flexbox flex={1} gap={4} style={{ overflow: 'hidden', position: 'relative' }}>
|
|
62
|
-
<Text ellipsis strong>
|
|
63
|
-
{name}
|
|
64
|
-
</Text>
|
|
65
|
-
<Text ellipsis fontSize={12} type={'secondary'}>
|
|
66
|
-
{description}
|
|
67
|
-
</Text>
|
|
68
|
-
</Flexbox>
|
|
69
|
-
</Flexbox>
|
|
70
|
-
<Actions identifier={identifier} />
|
|
71
|
-
</Block>
|
|
72
|
-
|
|
73
|
-
{!!installProgress && (
|
|
74
|
-
<Flexbox paddingInline={12}>
|
|
75
|
-
<MCPInstallProgress identifier={identifier} />
|
|
76
|
-
</Flexbox>
|
|
77
|
-
)}
|
|
78
|
-
</Flexbox>
|
|
79
|
-
);
|
|
80
|
-
},
|
|
81
|
-
);
|
|
82
|
-
|
|
83
|
-
export default Item;
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import { Center, Flexbox, Icon } from '@lobehub/ui';
|
|
2
|
-
import { ServerCrash } from 'lucide-react';
|
|
3
|
-
import { memo, useEffect } from 'react';
|
|
4
|
-
import { useTranslation } from 'react-i18next';
|
|
5
|
-
import { Virtuoso } from 'react-virtuoso';
|
|
6
|
-
|
|
7
|
-
import { useToolStore } from '@/store/tool';
|
|
8
|
-
|
|
9
|
-
import SearchLoading from '../../Loading';
|
|
10
|
-
import PluginEmpty from '../../PluginEmpty';
|
|
11
|
-
import VirtuosoLoading from '../../VirtuosoLoading';
|
|
12
|
-
import Item from './Item';
|
|
13
|
-
|
|
14
|
-
interface ListProps {
|
|
15
|
-
setIdentifier: (identifier?: string) => void;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export const List = memo<ListProps>(({ setIdentifier }) => {
|
|
19
|
-
const { t } = useTranslation('plugin');
|
|
20
|
-
|
|
21
|
-
const [
|
|
22
|
-
isMcpListInit,
|
|
23
|
-
identifier,
|
|
24
|
-
allItems,
|
|
25
|
-
totalCount,
|
|
26
|
-
currentPage,
|
|
27
|
-
keywords,
|
|
28
|
-
searchLoading,
|
|
29
|
-
useFetchMCPPluginList,
|
|
30
|
-
loadMoreMCPPlugins,
|
|
31
|
-
resetMCPPluginList,
|
|
32
|
-
] = useToolStore((s) => [
|
|
33
|
-
s.isMcpListInit,
|
|
34
|
-
s.activeMCPIdentifier,
|
|
35
|
-
s.mcpPluginItems,
|
|
36
|
-
s.totalCount,
|
|
37
|
-
s.currentPage,
|
|
38
|
-
s.mcpSearchKeywords,
|
|
39
|
-
s.searchLoading,
|
|
40
|
-
s.useFetchMCPPluginList,
|
|
41
|
-
s.loadMoreMCPPlugins,
|
|
42
|
-
s.resetMCPPluginList,
|
|
43
|
-
]);
|
|
44
|
-
|
|
45
|
-
// 当 keywords 变化时重置列表
|
|
46
|
-
useEffect(() => {
|
|
47
|
-
resetMCPPluginList(keywords);
|
|
48
|
-
}, [keywords, resetMCPPluginList]);
|
|
49
|
-
|
|
50
|
-
const { isLoading, error } = useFetchMCPPluginList({
|
|
51
|
-
page: currentPage,
|
|
52
|
-
pageSize: 20,
|
|
53
|
-
q: keywords,
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
if (searchLoading || !isMcpListInit) return <SearchLoading />;
|
|
57
|
-
|
|
58
|
-
if (error)
|
|
59
|
-
return (
|
|
60
|
-
<Center gap={12} padding={40}>
|
|
61
|
-
<Icon icon={ServerCrash} size={80} />
|
|
62
|
-
{t('store.networkError')}
|
|
63
|
-
</Center>
|
|
64
|
-
);
|
|
65
|
-
|
|
66
|
-
const isEmpty = allItems.length === 0;
|
|
67
|
-
const hasSearchKeywords = Boolean(keywords && keywords.trim());
|
|
68
|
-
|
|
69
|
-
if (isEmpty) return <PluginEmpty search={hasSearchKeywords} />;
|
|
70
|
-
|
|
71
|
-
return (
|
|
72
|
-
<Virtuoso
|
|
73
|
-
components={{
|
|
74
|
-
Footer: isLoading ? VirtuosoLoading : undefined,
|
|
75
|
-
}}
|
|
76
|
-
data={allItems}
|
|
77
|
-
endReached={loadMoreMCPPlugins}
|
|
78
|
-
increaseViewportBy={typeof window !== 'undefined' ? window.innerHeight : 0}
|
|
79
|
-
itemContent={(_, item) => {
|
|
80
|
-
return (
|
|
81
|
-
<Flexbox key={item.identifier} paddingBlock={2} paddingInline={4}>
|
|
82
|
-
<Item active={identifier === item.identifier} {...item} setIdentifier={setIdentifier} />
|
|
83
|
-
</Flexbox>
|
|
84
|
-
);
|
|
85
|
-
}}
|
|
86
|
-
overscan={24}
|
|
87
|
-
style={{ height: '100%', width: '100%' }}
|
|
88
|
-
totalCount={totalCount || 0}
|
|
89
|
-
/>
|
|
90
|
-
);
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
export default List;
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { DraggablePanel, Flexbox } from '@lobehub/ui';
|
|
2
|
-
import { cssVar, useTheme } from 'antd-style';
|
|
3
|
-
import dynamic from '@/libs/next/dynamic';
|
|
4
|
-
import { memo, useRef } from 'react';
|
|
5
|
-
|
|
6
|
-
import { useServerConfigStore } from '@/store/serverConfig';
|
|
7
|
-
import { useToolStore } from '@/store/tool';
|
|
8
|
-
|
|
9
|
-
import DetailLoading from './Detail/Loading';
|
|
10
|
-
import List from './List';
|
|
11
|
-
|
|
12
|
-
const Detail = dynamic(() => import('./Detail'), { loading: DetailLoading, ssr: false });
|
|
13
|
-
|
|
14
|
-
export const MCPPluginList = memo(() => {
|
|
15
|
-
const ref = useRef<HTMLDivElement>(null);
|
|
16
|
-
const theme = useTheme(); // Keep for colorBgContainerSecondary (not in cssVar)
|
|
17
|
-
|
|
18
|
-
const mobile = useServerConfigStore((s) => s.isMobile);
|
|
19
|
-
|
|
20
|
-
return (
|
|
21
|
-
<Flexbox
|
|
22
|
-
height={'75vh'}
|
|
23
|
-
horizontal
|
|
24
|
-
style={{
|
|
25
|
-
borderTop: `1px solid ${cssVar.colorBorderSecondary}`,
|
|
26
|
-
overflow: 'hidden',
|
|
27
|
-
position: 'relative',
|
|
28
|
-
}}
|
|
29
|
-
width={'100%'}
|
|
30
|
-
>
|
|
31
|
-
{/* eslint-disable-next-line @typescript-eslint/ban-ts-comment */}
|
|
32
|
-
{/* @ts-ignore */}
|
|
33
|
-
<DraggablePanel maxWidth={1024} minWidth={mobile ? '100vw' : 420} placement={'left'}>
|
|
34
|
-
<List
|
|
35
|
-
setIdentifier={(identifier) => {
|
|
36
|
-
useToolStore.setState({ activeMCPIdentifier: identifier });
|
|
37
|
-
ref?.current?.scrollTo({ top: 0 });
|
|
38
|
-
}}
|
|
39
|
-
/>
|
|
40
|
-
</DraggablePanel>
|
|
41
|
-
<Flexbox
|
|
42
|
-
height={'100%'}
|
|
43
|
-
padding={16}
|
|
44
|
-
ref={ref}
|
|
45
|
-
style={{
|
|
46
|
-
background: theme.colorBgContainerSecondary,
|
|
47
|
-
overflowX: 'hidden',
|
|
48
|
-
overflowY: 'auto',
|
|
49
|
-
}}
|
|
50
|
-
width={'100%'}
|
|
51
|
-
>
|
|
52
|
-
<Detail />
|
|
53
|
-
</Flexbox>
|
|
54
|
-
</Flexbox>
|
|
55
|
-
);
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
export default MCPPluginList;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { type ReactNode, createContext, memo, use } from 'react';
|
|
4
|
-
|
|
5
|
-
import { type DiscoverPluginDetail } from '@/types/discover';
|
|
6
|
-
|
|
7
|
-
export type DetailContextConfig = Partial<DiscoverPluginDetail>;
|
|
8
|
-
|
|
9
|
-
export const DetailContext = createContext<DetailContextConfig>({});
|
|
10
|
-
|
|
11
|
-
export const DetailProvider = memo<{ children: ReactNode; config?: DetailContextConfig }>(
|
|
12
|
-
({ children, config = {} }) => {
|
|
13
|
-
return <DetailContext value={config}>{children}</DetailContext>;
|
|
14
|
-
},
|
|
15
|
-
);
|
|
16
|
-
|
|
17
|
-
export const useDetailContext = () => {
|
|
18
|
-
return use(DetailContext);
|
|
19
|
-
};
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { Center, Flexbox, Icon, Text } from '@lobehub/ui';
|
|
2
|
-
import { createStaticStyles } from 'antd-style';
|
|
3
|
-
import { Puzzle } from 'lucide-react';
|
|
4
|
-
import { memo } from 'react';
|
|
5
|
-
import { useTranslation } from 'react-i18next';
|
|
6
|
-
|
|
7
|
-
const styles = createStaticStyles(({ css, cssVar }) => ({
|
|
8
|
-
container: css`
|
|
9
|
-
padding-block: ${cssVar.paddingXL};
|
|
10
|
-
padding-inline: ${cssVar.paddingLG};
|
|
11
|
-
`,
|
|
12
|
-
description: css`
|
|
13
|
-
max-width: 240px;
|
|
14
|
-
line-height: 1.5;
|
|
15
|
-
color: ${cssVar.colorTextSecondary};
|
|
16
|
-
text-align: center;
|
|
17
|
-
`,
|
|
18
|
-
iconWrapper: css`
|
|
19
|
-
display: flex;
|
|
20
|
-
align-items: center;
|
|
21
|
-
justify-content: center;
|
|
22
|
-
|
|
23
|
-
width: 64px;
|
|
24
|
-
height: 64px;
|
|
25
|
-
margin-block-end: ${cssVar.marginMD};
|
|
26
|
-
border-radius: 50%;
|
|
27
|
-
|
|
28
|
-
background-color: ${cssVar.colorPrimaryBg};
|
|
29
|
-
`,
|
|
30
|
-
title: css`
|
|
31
|
-
margin-block-end: ${cssVar.marginSM};
|
|
32
|
-
|
|
33
|
-
font-size: ${cssVar.fontSizeLG};
|
|
34
|
-
font-weight: 500;
|
|
35
|
-
color: ${cssVar.colorText};
|
|
36
|
-
text-align: center;
|
|
37
|
-
`,
|
|
38
|
-
}));
|
|
39
|
-
|
|
40
|
-
const EmptyState = memo(() => {
|
|
41
|
-
const { t } = useTranslation('plugin');
|
|
42
|
-
|
|
43
|
-
return (
|
|
44
|
-
<Center className={styles.container}>
|
|
45
|
-
<Flexbox align="center">
|
|
46
|
-
<div className={styles.iconWrapper}>
|
|
47
|
-
<Icon icon={Puzzle} size={32} />
|
|
48
|
-
</div>
|
|
49
|
-
<Text className={styles.title}>{t('detailModal.emptyState.title')}</Text>
|
|
50
|
-
<Text className={styles.description}>{t('detailModal.emptyState.description')}</Text>
|
|
51
|
-
</Flexbox>
|
|
52
|
-
</Center>
|
|
53
|
-
);
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
export default EmptyState;
|