@lobehub/lobehub 2.0.0-next.337 → 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 +69 -0
- package/changelog/v1.json +24 -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 +97 -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/auth.json +1 -0
- package/locales/zh-CN/plugin.json +12 -2
- package/locales/zh-CN/providers.json +1 -0
- package/locales/zh-CN/setting.json +97 -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/packages/model-runtime/src/providers/google/index.ts +14 -14
- package/packages/model-runtime/src/providers/moonshot/index.ts +1 -1
- package/packages/model-runtime/src/providers/openai/index.ts +3 -3
- package/packages/types/src/discover/index.ts +1 -1
- 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)/agent/cron/[cronId]/CronConfig.ts +16 -16
- package/src/app/[variants]/(main)/agent/cron/[cronId]/features/CronJobSaveButton.tsx +1 -1
- package/src/app/[variants]/(main)/agent/cron/[cronId]/features/CronJobScheduleConfig.tsx +5 -2
- package/src/app/[variants]/(main)/community/features/Search.tsx +1 -1
- 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/app/[variants]/(mobile)/router/mobileRouter.config.tsx +27 -0
- package/src/app/[variants]/(mobile)/settings/_layout/Header.tsx +8 -17
- package/src/app/[variants]/(mobile)/settings/_layout/index.tsx +6 -1
- package/src/app/[variants]/(mobile)/settings/provider/_layout/index.tsx +22 -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 +204 -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,130 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { Github } from '@lobehub/icons';
|
|
4
|
-
import { ActionIcon, Avatar, Collapse, Flexbox, Icon, Text } from '@lobehub/ui';
|
|
5
|
-
import { createStaticStyles, cssVar, useResponsive } from 'antd-style';
|
|
6
|
-
import { DotIcon } from 'lucide-react';
|
|
7
|
-
import { memo } from 'react';
|
|
8
|
-
import { useTranslation } from 'react-i18next';
|
|
9
|
-
import urlJoin from 'url-join';
|
|
10
|
-
|
|
11
|
-
import PublishedTime from '@/components/PublishedTime';
|
|
12
|
-
|
|
13
|
-
import { useDetailContext } from './DetailProvider';
|
|
14
|
-
import TagList from './TagList';
|
|
15
|
-
|
|
16
|
-
const styles = createStaticStyles(({ css }) => {
|
|
17
|
-
return {
|
|
18
|
-
desc: css`
|
|
19
|
-
color: ${cssVar.colorTextSecondary};
|
|
20
|
-
`,
|
|
21
|
-
time: css`
|
|
22
|
-
font-size: 12px;
|
|
23
|
-
color: ${cssVar.colorTextDescription};
|
|
24
|
-
`,
|
|
25
|
-
version: css`
|
|
26
|
-
font-family: ${cssVar.fontFamilyCode};
|
|
27
|
-
font-size: 13px;
|
|
28
|
-
`,
|
|
29
|
-
};
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
const Header = memo<{ inModal?: boolean; mobile?: boolean }>(({ mobile: isMobile, inModal }) => {
|
|
33
|
-
const { author, identifier, createdAt, avatar, title, tags, description } = useDetailContext();
|
|
34
|
-
const { mobile = isMobile } = useResponsive();
|
|
35
|
-
const { t } = useTranslation('discover');
|
|
36
|
-
|
|
37
|
-
return (
|
|
38
|
-
<Flexbox gap={24}>
|
|
39
|
-
<Flexbox align={'flex-start'} gap={16} horizontal width={'100%'}>
|
|
40
|
-
<Avatar avatar={avatar} shape={'square'} size={mobile ? 48 : 64} />
|
|
41
|
-
<Flexbox
|
|
42
|
-
flex={1}
|
|
43
|
-
gap={4}
|
|
44
|
-
style={{
|
|
45
|
-
overflow: 'hidden',
|
|
46
|
-
}}
|
|
47
|
-
>
|
|
48
|
-
<Flexbox
|
|
49
|
-
align={'center'}
|
|
50
|
-
gap={8}
|
|
51
|
-
horizontal
|
|
52
|
-
justify={'space-between'}
|
|
53
|
-
style={{
|
|
54
|
-
overflow: 'hidden',
|
|
55
|
-
position: 'relative',
|
|
56
|
-
}}
|
|
57
|
-
>
|
|
58
|
-
<Flexbox
|
|
59
|
-
align={'center'}
|
|
60
|
-
flex={1}
|
|
61
|
-
gap={12}
|
|
62
|
-
horizontal
|
|
63
|
-
style={{
|
|
64
|
-
overflow: 'hidden',
|
|
65
|
-
position: 'relative',
|
|
66
|
-
}}
|
|
67
|
-
>
|
|
68
|
-
<Text
|
|
69
|
-
as={'h1'}
|
|
70
|
-
ellipsis
|
|
71
|
-
style={{ fontSize: inModal ? 20 : mobile ? 18 : 24, margin: 0 }}
|
|
72
|
-
title={identifier}
|
|
73
|
-
>
|
|
74
|
-
{title}
|
|
75
|
-
</Text>
|
|
76
|
-
</Flexbox>
|
|
77
|
-
{identifier && (
|
|
78
|
-
<Flexbox align={'center'} gap={6} horizontal>
|
|
79
|
-
<a
|
|
80
|
-
href={urlJoin(
|
|
81
|
-
'https://github.com/lobehub/lobe-chat-agents/tree/main/locales',
|
|
82
|
-
identifier,
|
|
83
|
-
)}
|
|
84
|
-
onClick={(e) => e.stopPropagation()}
|
|
85
|
-
rel="noreferrer"
|
|
86
|
-
target="_blank"
|
|
87
|
-
>
|
|
88
|
-
<ActionIcon fill={cssVar.colorTextDescription} icon={Github} />
|
|
89
|
-
</a>
|
|
90
|
-
</Flexbox>
|
|
91
|
-
)}
|
|
92
|
-
</Flexbox>
|
|
93
|
-
<Flexbox horizontal justify={'space-between'}>
|
|
94
|
-
<Flexbox>
|
|
95
|
-
<Flexbox align={'center'} gap={4} horizontal>
|
|
96
|
-
{author && (
|
|
97
|
-
<a href={urlJoin('https://github.com', author)} rel="noreferrer" target="_blank">
|
|
98
|
-
{author}
|
|
99
|
-
</a>
|
|
100
|
-
)}
|
|
101
|
-
<Icon icon={DotIcon} />
|
|
102
|
-
<PublishedTime
|
|
103
|
-
className={styles.time}
|
|
104
|
-
date={createdAt as string}
|
|
105
|
-
template={'MMM DD, YYYY'}
|
|
106
|
-
/>
|
|
107
|
-
</Flexbox>
|
|
108
|
-
{tags && <TagList tags={tags} />}
|
|
109
|
-
</Flexbox>
|
|
110
|
-
</Flexbox>
|
|
111
|
-
</Flexbox>
|
|
112
|
-
</Flexbox>
|
|
113
|
-
|
|
114
|
-
<Collapse
|
|
115
|
-
defaultActiveKey={['summary']}
|
|
116
|
-
expandIconPlacement={'end'}
|
|
117
|
-
items={[
|
|
118
|
-
{
|
|
119
|
-
children: description,
|
|
120
|
-
key: 'summary',
|
|
121
|
-
label: t('plugins.details.summary.title'),
|
|
122
|
-
},
|
|
123
|
-
]}
|
|
124
|
-
variant={'outlined'}
|
|
125
|
-
/>
|
|
126
|
-
</Flexbox>
|
|
127
|
-
);
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
export default Header;
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { Flexbox, Icon, Tabs, type TabsProps } from '@lobehub/ui';
|
|
4
|
-
import { createStaticStyles } from 'antd-style';
|
|
5
|
-
import { BookOpenIcon, HammerIcon } from 'lucide-react';
|
|
6
|
-
import { memo } from 'react';
|
|
7
|
-
import { useTranslation } from 'react-i18next';
|
|
8
|
-
|
|
9
|
-
import { useToolStore } from '@/store/tool';
|
|
10
|
-
import { pluginSelectors } from '@/store/tool/selectors';
|
|
11
|
-
import { PluginNavKey } from '@/types/discover';
|
|
12
|
-
|
|
13
|
-
const styles = createStaticStyles(({ css, cssVar }) => {
|
|
14
|
-
return {
|
|
15
|
-
link: css`
|
|
16
|
-
color: ${cssVar.colorTextDescription};
|
|
17
|
-
|
|
18
|
-
&:hover {
|
|
19
|
-
color: ${cssVar.colorInfo};
|
|
20
|
-
}
|
|
21
|
-
`,
|
|
22
|
-
nav: css`
|
|
23
|
-
border-block-end: 1px solid ${cssVar.colorBorder};
|
|
24
|
-
`,
|
|
25
|
-
};
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
interface NavProps {
|
|
29
|
-
activeTab?: PluginNavKey;
|
|
30
|
-
mobile?: boolean;
|
|
31
|
-
setActiveTab?: (tab: PluginNavKey) => void;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const Nav = memo<NavProps>(({ mobile, setActiveTab, activeTab = PluginNavKey.Tools }) => {
|
|
35
|
-
const { t } = useTranslation('discover');
|
|
36
|
-
const [identifier] = useToolStore((s) => [s.activePluginIdentifier]);
|
|
37
|
-
const plugin = useToolStore(pluginSelectors.getInstalledPluginById(identifier));
|
|
38
|
-
|
|
39
|
-
const hasSettings =
|
|
40
|
-
plugin?.manifest?.settings && Object.keys(plugin?.manifest?.settings.properties).length > 0;
|
|
41
|
-
|
|
42
|
-
const nav = (
|
|
43
|
-
<Tabs
|
|
44
|
-
activeKey={activeTab}
|
|
45
|
-
compact={mobile}
|
|
46
|
-
items={
|
|
47
|
-
[
|
|
48
|
-
{
|
|
49
|
-
icon: <Icon icon={HammerIcon} size={16} />,
|
|
50
|
-
key: PluginNavKey.Tools,
|
|
51
|
-
label: t('plugins.details.tools.title'),
|
|
52
|
-
},
|
|
53
|
-
hasSettings && {
|
|
54
|
-
icon: <Icon icon={BookOpenIcon} size={16} />,
|
|
55
|
-
key: PluginNavKey.Settings,
|
|
56
|
-
label: t('plugins.details.settings.title'),
|
|
57
|
-
},
|
|
58
|
-
].filter(Boolean) as TabsProps['items']
|
|
59
|
-
}
|
|
60
|
-
onChange={(key) => setActiveTab?.(key as PluginNavKey)}
|
|
61
|
-
/>
|
|
62
|
-
);
|
|
63
|
-
|
|
64
|
-
return mobile ? (
|
|
65
|
-
nav
|
|
66
|
-
) : (
|
|
67
|
-
<Flexbox align={'center'} className={styles.nav} horizontal justify={'space-between'}>
|
|
68
|
-
{nav}
|
|
69
|
-
</Flexbox>
|
|
70
|
-
);
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
export default Nav;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { memo } from 'react';
|
|
2
|
-
|
|
3
|
-
import PluginSettingsConfig from '@/features/PluginSettings';
|
|
4
|
-
import { useToolStore } from '@/store/tool';
|
|
5
|
-
import { pluginSelectors } from '@/store/tool/selectors';
|
|
6
|
-
|
|
7
|
-
const Settings = memo(() => {
|
|
8
|
-
const [identifier] = useToolStore((s) => [s.activePluginIdentifier]);
|
|
9
|
-
const plugin = useToolStore(pluginSelectors.getInstalledPluginById(identifier));
|
|
10
|
-
const { manifest } = plugin || {};
|
|
11
|
-
|
|
12
|
-
return (
|
|
13
|
-
manifest?.settings && (
|
|
14
|
-
<PluginSettingsConfig id={manifest.identifier} schema={manifest.settings} />
|
|
15
|
-
)
|
|
16
|
-
);
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
export default Settings;
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
import { Block, Collapse, Empty, Highlighter, Markdown, Tag } from '@lobehub/ui';
|
|
2
|
-
import { isString } from 'es-toolkit/compat';
|
|
3
|
-
import { Wrench } from 'lucide-react';
|
|
4
|
-
import { markdownToTxt } from 'markdown-to-txt';
|
|
5
|
-
import { memo, useState } from 'react';
|
|
6
|
-
import { useTranslation } from 'react-i18next';
|
|
7
|
-
|
|
8
|
-
import InlineTable from '@/components/InlineTable';
|
|
9
|
-
import CollapseDesc from '@/features/MCPPluginDetail/CollapseDesc';
|
|
10
|
-
import CollapseLayout from '@/features/MCPPluginDetail/CollapseLayout';
|
|
11
|
-
import { ModeType } from '@/features/MCPPluginDetail/Schema/types';
|
|
12
|
-
import { useToolStore } from '@/store/tool';
|
|
13
|
-
import { pluginSelectors } from '@/store/tool/selectors';
|
|
14
|
-
|
|
15
|
-
import Title from '../../../../../app/[variants]/(main)/community/features/Title';
|
|
16
|
-
|
|
17
|
-
interface ToolProps {
|
|
18
|
-
mode?: ModeType;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const Tools = memo<ToolProps>(({ mode }) => {
|
|
22
|
-
const { t } = useTranslation('discover');
|
|
23
|
-
const [activeKey, setActiveKey] = useState<string[]>([]);
|
|
24
|
-
const [identifier] = useToolStore((s) => [s.activePluginIdentifier]);
|
|
25
|
-
const plugin = useToolStore(pluginSelectors.getInstalledPluginById(identifier));
|
|
26
|
-
const { manifest } = plugin || {};
|
|
27
|
-
|
|
28
|
-
if (!manifest || isString(manifest))
|
|
29
|
-
return (
|
|
30
|
-
<Block variant={'outlined'}>
|
|
31
|
-
<Empty
|
|
32
|
-
description={t('mcp.details.schema.tools.empty')}
|
|
33
|
-
descriptionProps={{ fontSize: 14 }}
|
|
34
|
-
icon={Wrench}
|
|
35
|
-
style={{ maxWidth: 400 }}
|
|
36
|
-
/>
|
|
37
|
-
</Block>
|
|
38
|
-
);
|
|
39
|
-
|
|
40
|
-
return (
|
|
41
|
-
<Collapse
|
|
42
|
-
activeKey={activeKey}
|
|
43
|
-
expandIconPlacement={'end'}
|
|
44
|
-
gap={8}
|
|
45
|
-
items={manifest.api.map((item) => {
|
|
46
|
-
const parameters = Object.entries(item.parameters?.properties || {}).map(
|
|
47
|
-
([key, value]) => ({
|
|
48
|
-
name: key,
|
|
49
|
-
type: value.type,
|
|
50
|
-
}),
|
|
51
|
-
);
|
|
52
|
-
return {
|
|
53
|
-
children:
|
|
54
|
-
mode === ModeType.Docs ? (
|
|
55
|
-
<CollapseLayout
|
|
56
|
-
items={[
|
|
57
|
-
{
|
|
58
|
-
children: <Markdown>{item.description || ''}</Markdown>,
|
|
59
|
-
key: 'instructions',
|
|
60
|
-
title: t('mcp.details.schema.tools.instructions'),
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
children: (
|
|
64
|
-
<InlineTable
|
|
65
|
-
columns={[
|
|
66
|
-
{
|
|
67
|
-
dataIndex: 'name',
|
|
68
|
-
render: (name: string) => <code>{name}</code>,
|
|
69
|
-
title: t('plugins.meta.parameter'),
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
dataIndex: 'type',
|
|
73
|
-
render: (type: string) => <Tag>{type.toUpperCase()}</Tag>,
|
|
74
|
-
title: t('plugins.meta.type'),
|
|
75
|
-
},
|
|
76
|
-
]}
|
|
77
|
-
dataSource={parameters}
|
|
78
|
-
pagination={false}
|
|
79
|
-
rowKey={'name'}
|
|
80
|
-
/>
|
|
81
|
-
),
|
|
82
|
-
key: 'inputSchema',
|
|
83
|
-
title: t('mcp.details.schema.tools.inputSchema'),
|
|
84
|
-
},
|
|
85
|
-
]}
|
|
86
|
-
/>
|
|
87
|
-
) : (
|
|
88
|
-
<Highlighter language={'json'} style={{ fontSize: 12 }} variant={'borderless'}>
|
|
89
|
-
{JSON.stringify(item, null, 2)}
|
|
90
|
-
</Highlighter>
|
|
91
|
-
),
|
|
92
|
-
desc: item.description && (
|
|
93
|
-
<CollapseDesc hide={activeKey.includes(item.name)}>
|
|
94
|
-
{markdownToTxt(item.description)}
|
|
95
|
-
</CollapseDesc>
|
|
96
|
-
),
|
|
97
|
-
key: item.name,
|
|
98
|
-
label: (
|
|
99
|
-
<Title id={`tools-${item.name}`} level={3}>
|
|
100
|
-
{item.name}
|
|
101
|
-
</Title>
|
|
102
|
-
),
|
|
103
|
-
};
|
|
104
|
-
})}
|
|
105
|
-
onChange={setActiveKey}
|
|
106
|
-
variant={'outlined'}
|
|
107
|
-
/>
|
|
108
|
-
);
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
export default Tools;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { Flexbox } from '@lobehub/ui';
|
|
2
|
-
import { memo, useState } from 'react';
|
|
3
|
-
|
|
4
|
-
import { PluginNavKey } from '@/types/discover';
|
|
5
|
-
|
|
6
|
-
import Nav from './Nav';
|
|
7
|
-
import Settings from './Settings';
|
|
8
|
-
import Tools from './Tools';
|
|
9
|
-
|
|
10
|
-
const InstallDetail = memo(() => {
|
|
11
|
-
const [activeTab, setActiveTab] = useState(PluginNavKey.Tools);
|
|
12
|
-
|
|
13
|
-
return (
|
|
14
|
-
<Flexbox gap={16}>
|
|
15
|
-
<Nav activeTab={activeTab as PluginNavKey} setActiveTab={setActiveTab} />
|
|
16
|
-
<Flexbox>
|
|
17
|
-
{activeTab === PluginNavKey.Tools && <Tools />}
|
|
18
|
-
{activeTab === PluginNavKey.Settings && <Settings />}
|
|
19
|
-
</Flexbox>
|
|
20
|
-
</Flexbox>
|
|
21
|
-
);
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
export default InstallDetail;
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { Flexbox, Skeleton } from '@lobehub/ui';
|
|
2
|
-
import { cssVar } from 'antd-style';
|
|
3
|
-
import { memo } from 'react';
|
|
4
|
-
|
|
5
|
-
const DetailsLoading = memo(() => {
|
|
6
|
-
return (
|
|
7
|
-
<Flexbox gap={24}>
|
|
8
|
-
<Flexbox gap={12}>
|
|
9
|
-
<Flexbox align={'center'} gap={16} horizontal width={'100%'}>
|
|
10
|
-
<Skeleton.Avatar active shape={'square'} size={64} />
|
|
11
|
-
<Skeleton.Button active style={{ height: 36, width: 200 }} />
|
|
12
|
-
</Flexbox>
|
|
13
|
-
<Skeleton.Button active size={'small'} style={{ width: 200 }} />
|
|
14
|
-
</Flexbox>
|
|
15
|
-
<Flexbox
|
|
16
|
-
gap={12}
|
|
17
|
-
height={54}
|
|
18
|
-
horizontal
|
|
19
|
-
style={{
|
|
20
|
-
borderBottom: `1px solid ${cssVar.colorBorder}`,
|
|
21
|
-
}}
|
|
22
|
-
>
|
|
23
|
-
<Skeleton.Button />
|
|
24
|
-
<Skeleton.Button />
|
|
25
|
-
</Flexbox>
|
|
26
|
-
<Flexbox
|
|
27
|
-
flex={1}
|
|
28
|
-
gap={16}
|
|
29
|
-
style={{
|
|
30
|
-
overflow: 'hidden',
|
|
31
|
-
}}
|
|
32
|
-
width={'100%'}
|
|
33
|
-
>
|
|
34
|
-
<Skeleton paragraph={{ rows: 3 }} title={false} />
|
|
35
|
-
<Skeleton paragraph={{ rows: 8 }} title={false} />
|
|
36
|
-
<Skeleton paragraph={{ rows: 8 }} title={false} />
|
|
37
|
-
</Flexbox>
|
|
38
|
-
</Flexbox>
|
|
39
|
-
);
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
export default DetailsLoading;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { Flexbox, Tag } from '@lobehub/ui';
|
|
4
|
-
import { createStaticStyles } from 'antd-style';
|
|
5
|
-
import { memo } from 'react';
|
|
6
|
-
|
|
7
|
-
const styles = createStaticStyles(({ css, cssVar }) => {
|
|
8
|
-
return {
|
|
9
|
-
tag: css`
|
|
10
|
-
margin: 0;
|
|
11
|
-
padding-block: 4px;
|
|
12
|
-
padding-inline: 12px;
|
|
13
|
-
border-radius: 16px;
|
|
14
|
-
|
|
15
|
-
color: ${cssVar.colorTextSecondary};
|
|
16
|
-
`,
|
|
17
|
-
};
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
const TagList = memo<{ tags: string[] }>(({ tags }) => {
|
|
21
|
-
const showTags = Boolean(tags?.length && tags?.length > 0);
|
|
22
|
-
return (
|
|
23
|
-
showTags && (
|
|
24
|
-
<Flexbox gap={8} horizontal wrap={'wrap'}>
|
|
25
|
-
{tags.map((tag) => (
|
|
26
|
-
<Tag className={styles.tag} key={tag}>
|
|
27
|
-
{tag}
|
|
28
|
-
</Tag>
|
|
29
|
-
))}
|
|
30
|
-
</Flexbox>
|
|
31
|
-
)
|
|
32
|
-
);
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
export default TagList;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { Flexbox } from '@lobehub/ui';
|
|
2
|
-
import { memo } from 'react';
|
|
3
|
-
|
|
4
|
-
import { useDiscoverStore } from '@/store/discover';
|
|
5
|
-
import { useToolStore } from '@/store/tool';
|
|
6
|
-
import { pluginSelectors } from '@/store/tool/selectors';
|
|
7
|
-
|
|
8
|
-
import { DetailProvider } from './DetailProvider';
|
|
9
|
-
import EmptyState from './EmptyState';
|
|
10
|
-
import Header from './Header';
|
|
11
|
-
import InstallDetail from './InstallDetail';
|
|
12
|
-
import DetailsLoading from './Loading';
|
|
13
|
-
|
|
14
|
-
const Detail = memo<{ identifier?: string }>(({ identifier: defaultIdentifier }) => {
|
|
15
|
-
const [activeMCPIdentifier, isPluginListInit] = useToolStore((s) => [
|
|
16
|
-
s.activePluginIdentifier,
|
|
17
|
-
s.isPluginListInit,
|
|
18
|
-
]);
|
|
19
|
-
|
|
20
|
-
const identifier = defaultIdentifier ?? activeMCPIdentifier;
|
|
21
|
-
|
|
22
|
-
const isPluginInstalled = useToolStore(pluginSelectors.isPluginInstalled(identifier!));
|
|
23
|
-
const usePluginDetail = useDiscoverStore((s) => s.usePluginDetail);
|
|
24
|
-
|
|
25
|
-
const { data, isLoading } = usePluginDetail({ identifier });
|
|
26
|
-
|
|
27
|
-
if (!isPluginListInit || isLoading) return <DetailsLoading />;
|
|
28
|
-
|
|
29
|
-
return (
|
|
30
|
-
<DetailProvider config={data}>
|
|
31
|
-
<Flexbox gap={16}>
|
|
32
|
-
<Header inModal />
|
|
33
|
-
{isPluginInstalled ? <InstallDetail /> : <EmptyState />}
|
|
34
|
-
</Flexbox>
|
|
35
|
-
</DetailProvider>
|
|
36
|
-
);
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
export default Detail;
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Gamepad2,
|
|
3
|
-
ImagePlay,
|
|
4
|
-
LayoutPanelTop,
|
|
5
|
-
MicroscopeIcon,
|
|
6
|
-
PocketKnife,
|
|
7
|
-
Receipt,
|
|
8
|
-
ScanSearch,
|
|
9
|
-
TwitterIcon,
|
|
10
|
-
Umbrella,
|
|
11
|
-
} from 'lucide-react';
|
|
12
|
-
import { useMemo } from 'react';
|
|
13
|
-
import { useTranslation } from 'react-i18next';
|
|
14
|
-
|
|
15
|
-
import { PluginCategory } from '@/types/discover';
|
|
16
|
-
|
|
17
|
-
export const useCategory = () => {
|
|
18
|
-
const { t } = useTranslation('discover');
|
|
19
|
-
|
|
20
|
-
return useMemo(
|
|
21
|
-
() => [
|
|
22
|
-
{
|
|
23
|
-
icon: LayoutPanelTop,
|
|
24
|
-
key: PluginCategory.All,
|
|
25
|
-
label: t('category.plugin.all'),
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
icon: ImagePlay,
|
|
29
|
-
key: PluginCategory.MediaGenerate,
|
|
30
|
-
label: t('category.plugin.media-generate'),
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
icon: ScanSearch,
|
|
34
|
-
key: PluginCategory.WebSearch,
|
|
35
|
-
label: t('category.plugin.web-search'),
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
icon: Receipt,
|
|
39
|
-
key: PluginCategory.StocksFinance,
|
|
40
|
-
label: t('category.plugin.stocks-finance'),
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
icon: PocketKnife,
|
|
44
|
-
key: PluginCategory.Tools,
|
|
45
|
-
label: t('category.plugin.tools'),
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
icon: Umbrella,
|
|
49
|
-
key: PluginCategory.LifeStyle,
|
|
50
|
-
label: t('category.plugin.life-style'),
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
icon: MicroscopeIcon,
|
|
54
|
-
key: PluginCategory.ScienceEducation,
|
|
55
|
-
label: t('category.plugin.science-education'),
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
icon: TwitterIcon,
|
|
59
|
-
key: PluginCategory.Social,
|
|
60
|
-
label: t('category.plugin.social'),
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
icon: Gamepad2,
|
|
64
|
-
key: PluginCategory.GamingEntertainment,
|
|
65
|
-
label: t('category.plugin.gaming-entertainment'),
|
|
66
|
-
},
|
|
67
|
-
],
|
|
68
|
-
[t],
|
|
69
|
-
);
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
export const useCategoryItem = (key?: PluginCategory) => {
|
|
73
|
-
const items = useCategory();
|
|
74
|
-
if (!key) return;
|
|
75
|
-
return items.find((item) => item.key === key);
|
|
76
|
-
};
|
|
@@ -1,78 +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 { useAgentStore } from '@/store/agent';
|
|
8
|
-
import { agentSelectors } from '@/store/agent/selectors';
|
|
9
|
-
import { useToolStore } from '@/store/tool';
|
|
10
|
-
import { pluginSelectors, pluginStoreSelectors } from '@/store/tool/selectors';
|
|
11
|
-
|
|
12
|
-
interface ActionsProps {
|
|
13
|
-
identifier: string;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const Actions = memo<ActionsProps>(({ identifier }) => {
|
|
17
|
-
const [installed, installing, installPlugin, unInstallPlugin] = useToolStore((s) => [
|
|
18
|
-
pluginSelectors.isPluginInstalled(identifier)(s),
|
|
19
|
-
pluginStoreSelectors.isOldPluginInInstallProgress(identifier)(s),
|
|
20
|
-
s.installOldPlugin,
|
|
21
|
-
s.uninstallPlugin,
|
|
22
|
-
]);
|
|
23
|
-
|
|
24
|
-
const { t } = useTranslation('plugin');
|
|
25
|
-
const [togglePlugin, isPluginEnabledInAgent] = useAgentStore((s) => [
|
|
26
|
-
s.togglePlugin,
|
|
27
|
-
agentSelectors.currentAgentPlugins(s).includes(identifier),
|
|
28
|
-
]);
|
|
29
|
-
const { modal } = App.useApp();
|
|
30
|
-
|
|
31
|
-
return (
|
|
32
|
-
<Flexbox align={'center'} horizontal>
|
|
33
|
-
{installed ? (
|
|
34
|
-
<DropdownMenu
|
|
35
|
-
items={[
|
|
36
|
-
{
|
|
37
|
-
danger: true,
|
|
38
|
-
icon: <Icon icon={Trash2} />,
|
|
39
|
-
key: 'uninstall',
|
|
40
|
-
label: t('store.actions.uninstall'),
|
|
41
|
-
onClick: () => {
|
|
42
|
-
modal.confirm({
|
|
43
|
-
centered: true,
|
|
44
|
-
okButtonProps: { danger: true },
|
|
45
|
-
onOk: async () => {
|
|
46
|
-
// If plugin is enabled in current agent, disable it first
|
|
47
|
-
if (isPluginEnabledInAgent) {
|
|
48
|
-
await togglePlugin(identifier, false);
|
|
49
|
-
}
|
|
50
|
-
await unInstallPlugin(identifier);
|
|
51
|
-
},
|
|
52
|
-
title: t('store.actions.confirmUninstall'),
|
|
53
|
-
type: 'error',
|
|
54
|
-
});
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
]}
|
|
58
|
-
placement="bottomRight"
|
|
59
|
-
>
|
|
60
|
-
<ActionIcon icon={MoreVerticalIcon} loading={installing} />
|
|
61
|
-
</DropdownMenu>
|
|
62
|
-
) : (
|
|
63
|
-
<Button
|
|
64
|
-
loading={installing}
|
|
65
|
-
onClick={async () => {
|
|
66
|
-
await installPlugin(identifier);
|
|
67
|
-
await togglePlugin(identifier);
|
|
68
|
-
}}
|
|
69
|
-
variant={'filled'}
|
|
70
|
-
>
|
|
71
|
-
{t('store.actions.install')}
|
|
72
|
-
</Button>
|
|
73
|
-
)}
|
|
74
|
-
</Flexbox>
|
|
75
|
-
);
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
export default Actions;
|