@lobehub/lobehub 2.0.0-next.293 → 2.0.0-next.295

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.
Files changed (181) hide show
  1. package/.github/workflows/release-desktop-beta.yml +6 -6
  2. package/.github/workflows/release-desktop-stable.yml +11 -11
  3. package/CHANGELOG.md +52 -0
  4. package/apps/desktop/electron.vite.config.ts +0 -1
  5. package/apps/desktop/src/main/__mocks__/node-mac-permissions.ts +0 -1
  6. package/apps/desktop/src/main/__mocks__/setup.ts +0 -1
  7. package/apps/desktop/src/main/controllers/McpCtr.ts +50 -18
  8. package/apps/desktop/src/main/controllers/__tests__/SystemCtr.test.ts +1 -4
  9. package/apps/desktop/src/main/libs/mcp/client.ts +54 -2
  10. package/apps/desktop/tsconfig.json +4 -10
  11. package/changelog/v1.json +14 -0
  12. package/e2e/scripts/setup.ts +45 -32
  13. package/package.json +1 -1
  14. package/packages/database/src/models/__tests__/knowledgeBase.test.ts +1 -1
  15. package/packages/database/src/repositories/knowledge/index.ts +1 -4
  16. package/packages/types/src/discover/assistants.ts +2 -2
  17. package/scripts/migrate-spa-navigation.ts +129 -0
  18. package/src/app/(backend)/api/workflows/memory-user-memory/pipelines/chat-topic/process-topics/route.ts +112 -109
  19. package/src/app/(backend)/api/workflows/memory-user-memory/pipelines/chat-topic/process-user-topics/route.ts +125 -113
  20. package/src/app/(backend)/api/workflows/memory-user-memory/pipelines/chat-topic/process-users/route.ts +74 -65
  21. package/src/app/[variants]/(auth)/auth-error/page.tsx +1 -1
  22. package/src/app/[variants]/(auth)/login/[[...login]]/page.tsx +1 -1
  23. package/src/app/[variants]/(auth)/next-auth/error/AuthErrorPage.tsx +1 -1
  24. package/src/app/[variants]/(auth)/next-auth/signin/AuthSignInBox.tsx +1 -1
  25. package/src/app/[variants]/(auth)/oauth/callback/error/page.tsx +1 -1
  26. package/src/app/[variants]/(auth)/oauth/callback/success/page.tsx +1 -1
  27. package/src/app/[variants]/(auth)/oauth/consent/[uid]/page.tsx +1 -1
  28. package/src/app/[variants]/(auth)/reset-password/layout.tsx +1 -1
  29. package/src/app/[variants]/(auth)/reset-password/page.tsx +2 -2
  30. package/src/app/[variants]/(auth)/signin/layout.tsx +1 -1
  31. package/src/app/[variants]/(auth)/signin/useSignIn.ts +1 -1
  32. package/src/app/[variants]/(auth)/signup/[[...signup]]/BetterAuthSignUpForm.tsx +2 -2
  33. package/src/app/[variants]/(auth)/signup/[[...signup]]/page.tsx +1 -1
  34. package/src/app/[variants]/(auth)/signup/[[...signup]]/useSignUp.tsx +1 -1
  35. package/src/app/[variants]/(auth)/verify-email/layout.tsx +1 -1
  36. package/src/app/[variants]/(auth)/verify-email/page.tsx +2 -2
  37. package/src/app/[variants]/(main)/_layout/index.tsx +1 -1
  38. package/src/app/[variants]/(main)/agent/_layout/AgentIdSync.tsx +12 -1
  39. package/src/app/[variants]/(main)/agent/_layout/Sidebar/Cron/CronTopicGroup.tsx +1 -1
  40. package/src/app/[variants]/(main)/agent/_layout/Sidebar/Header/AddTopicButon.tsx +1 -1
  41. package/src/app/[variants]/(main)/agent/_layout/Sidebar/Header/Nav.tsx +1 -1
  42. package/src/app/[variants]/(main)/agent/_layout/Sidebar/Topic/AllTopicsDrawer/index.tsx +1 -1
  43. package/src/app/[variants]/(main)/agent/_layout/Sidebar/Topic/hooks/useThreadNavigation.ts +1 -1
  44. package/src/app/[variants]/(main)/agent/_layout/Sidebar/Topic/hooks/useTopicNavigation.ts +1 -1
  45. package/src/app/[variants]/(main)/agent/features/TelemetryNotification.tsx +2 -3
  46. package/src/app/[variants]/(main)/community/(detail)/assistant/features/Details/Nav.tsx +9 -9
  47. package/src/app/[variants]/(main)/community/(detail)/assistant/features/Details/Versions/index.tsx +2 -3
  48. package/src/app/[variants]/(main)/community/(detail)/features/MakedownRender.tsx +1 -2
  49. package/src/app/[variants]/(main)/community/(detail)/features/ShareButton.tsx +2 -3
  50. package/src/app/[variants]/(main)/community/(detail)/features/Toc/Heading.tsx +2 -3
  51. package/src/app/[variants]/(main)/community/(detail)/mcp/features/Details/Versions/index.tsx +2 -2
  52. package/src/app/[variants]/(main)/community/(detail)/model/features/Details/Nav.tsx +12 -11
  53. package/src/app/[variants]/(main)/community/(detail)/model/features/Details/Parameter/ParameterItem.tsx +2 -3
  54. package/src/app/[variants]/(main)/community/(detail)/provider/features/Details/Nav.tsx +11 -10
  55. package/src/app/[variants]/(main)/community/(detail)/provider/features/Header.tsx +10 -9
  56. package/src/app/[variants]/(main)/community/(list)/(home)/index.tsx +1 -1
  57. package/src/app/[variants]/(main)/community/(list)/assistant/features/Category/useCategory.tsx +1 -1
  58. package/src/app/[variants]/(main)/community/(list)/features/SortButton/index.tsx +2 -3
  59. package/src/app/[variants]/(main)/community/_layout/Sidebar/Header/Nav.tsx +1 -1
  60. package/src/app/[variants]/(main)/community/features/CreateButton/Inner.tsx +1 -1
  61. package/src/app/[variants]/(main)/community/features/CreateButton/index.tsx +1 -1
  62. package/src/app/[variants]/(main)/community/features/Search.tsx +1 -2
  63. package/src/app/[variants]/(main)/community/features/Title.tsx +5 -5
  64. package/src/app/[variants]/(main)/group/_layout/GroupIdSync.tsx +12 -1
  65. package/src/app/[variants]/(main)/group/_layout/Sidebar/Header/Nav.tsx +1 -1
  66. package/src/app/[variants]/(main)/group/_layout/Sidebar/Topic/AllTopicsDrawer/index.tsx +1 -1
  67. package/src/app/[variants]/(main)/group/_layout/Sidebar/Topic/hooks/useThreadNavigation.ts +1 -1
  68. package/src/app/[variants]/(main)/group/features/Conversation/Header/ShareButton/index.tsx +1 -1
  69. package/src/app/[variants]/(main)/group/features/TelemetryNotification.tsx +2 -3
  70. package/src/app/[variants]/(main)/home/_layout/Body/Agent/AllAgentsDrawer/index.tsx +1 -1
  71. package/src/app/[variants]/(main)/hooks/useActiveTabKey.ts +6 -11
  72. package/src/app/[variants]/(main)/image/NotSupportClient.tsx +4 -3
  73. package/src/app/[variants]/(main)/image/_layout/ConfigPanel/components/ImageUpload.tsx +1 -1
  74. package/src/app/[variants]/(main)/image/_layout/ConfigPanel/components/MultiImagesUpload/ImageManageModal.tsx +1 -1
  75. package/src/app/[variants]/(main)/image/_layout/ConfigPanel/components/MultiImagesUpload/index.tsx +1 -1
  76. package/src/app/[variants]/(main)/memory/(home)/features/RoleTagCloud/index.tsx +1 -1
  77. package/src/app/[variants]/(main)/memory/_layout/Sidebar/Header/Nav.tsx +1 -1
  78. package/src/app/[variants]/(main)/memory/features/SourceLink.tsx +1 -1
  79. package/src/app/[variants]/(main)/page/_layout/Body/AllPagesDrawer/index.tsx +1 -1
  80. package/src/app/[variants]/(main)/settings/about/features/ItemCard.tsx +2 -3
  81. package/src/app/[variants]/(main)/settings/about/features/ItemLink.tsx +2 -3
  82. package/src/app/[variants]/(main)/settings/about/features/Version.tsx +6 -7
  83. package/src/app/[variants]/(main)/settings/features/SettingsContent.tsx +1 -1
  84. package/src/app/[variants]/(main)/settings/features/UpgradeAlert.tsx +4 -4
  85. package/src/app/[variants]/(main)/settings/provider/(list)/Footer.tsx +2 -2
  86. package/src/app/[variants]/(main)/settings/provider/detail/index.tsx +1 -1
  87. package/src/app/[variants]/(main)/settings/provider/detail/ollama/CheckError.tsx +1 -1
  88. package/src/app/[variants]/(main)/settings/provider/features/ProviderConfig/index.tsx +12 -6
  89. package/src/app/[variants]/(main)/settings/security/index.tsx +1 -1
  90. package/src/app/[variants]/(main)/settings/stats/features/overview/ShareButton/ShareModal.tsx +1 -1
  91. package/src/app/[variants]/(main)/settings/stats/features/rankings/AssistantsRank.tsx +1 -1
  92. package/src/app/[variants]/(main)/settings/stats/features/rankings/TopicsRank.tsx +1 -1
  93. package/src/app/[variants]/(mobile)/_layout/index.tsx +1 -1
  94. package/src/app/[variants]/(mobile)/chat/settings/features/AgentInfoDescription/index.tsx +1 -1
  95. package/src/app/[variants]/(mobile)/chat/settings/features/SettingButton.tsx +1 -1
  96. package/src/app/[variants]/(mobile)/router/index.tsx +1 -1
  97. package/src/app/[variants]/page.tsx +1 -1
  98. package/src/app/[variants]/router/index.tsx +1 -1
  99. package/src/components/404/index.tsx +4 -4
  100. package/src/components/Analytics/index.tsx +1 -1
  101. package/src/components/BrandWatermark/index.tsx +4 -4
  102. package/src/components/Branding/ProductLogo/Custom.tsx +1 -1
  103. package/src/components/Error/index.tsx +3 -4
  104. package/src/components/GoBack/index.tsx +2 -2
  105. package/src/components/LabsModal/LabCard.tsx +1 -1
  106. package/src/components/Link.tsx +25 -5
  107. package/src/components/OllamaSetupGuide/index.tsx +5 -4
  108. package/src/components/WebFavicon/index.tsx +1 -1
  109. package/src/components/client/ClientResponsiveContent/index.tsx +1 -1
  110. package/src/components/client/ClientResponsiveLayout.tsx +1 -1
  111. package/src/components/mdx/Image.tsx +1 -1
  112. package/src/components/mdx/Link.tsx +26 -9
  113. package/src/features/AlertBanner/CloudBanner.tsx +2 -3
  114. package/src/features/ChatInput/ActionBar/Model/ControlsForm.tsx +8 -7
  115. package/src/features/ChatInput/ActionBar/Params/Controls.tsx +1 -3
  116. package/src/features/ChatInput/ActionBar/Token/index.tsx +1 -1
  117. package/src/features/ChatInput/Mobile/index.tsx +1 -1
  118. package/src/features/Conversation/ChatItem/components/MessageContent/index.tsx +1 -1
  119. package/src/features/Conversation/Error/OllamaBizError/index.tsx +1 -1
  120. package/src/features/Conversation/Error/OllamaSetupGuide/Desktop.tsx +1 -2
  121. package/src/features/Conversation/Error/index.tsx +1 -1
  122. package/src/features/Conversation/Messages/AssistantGroup/Tool/Actions/Settings.tsx +1 -1
  123. package/src/features/Conversation/Messages/AssistantGroup/Tool/index.tsx +1 -1
  124. package/src/features/Conversation/Messages/AssistantGroup/index.tsx +1 -1
  125. package/src/features/Conversation/Messages/Tool/Tool/index.tsx +1 -1
  126. package/src/features/Conversation/Messages/components/SearchGrounding.tsx +1 -1
  127. package/src/features/DataImporter/Error.tsx +3 -3
  128. package/src/features/DevPanel/CacheViewer/cacheProvider.tsx +2 -1
  129. package/src/features/DevPanel/MetadataViewer/Og.tsx +1 -1
  130. package/src/features/DevPanel/features/FloatPanel.tsx +1 -1
  131. package/src/features/DevPanel/features/Table/TooltipContent.tsx +3 -4
  132. package/src/features/DevPanel/index.tsx +1 -1
  133. package/src/features/EditorCanvas/InlineToolbar.tsx +1 -6
  134. package/src/features/FileViewer/NotSupport/index.tsx +2 -3
  135. package/src/features/Follow/index.tsx +8 -9
  136. package/src/features/LibraryModal/AddFilesToKnowledgeBase/SelectForm.tsx +2 -2
  137. package/src/features/MCP/MCPInstallProgress/InstallError/ErrorDetails.tsx +61 -83
  138. package/src/features/MCP/Scores.tsx +1 -1
  139. package/src/features/MCPPluginDetail/Nav.tsx +8 -8
  140. package/src/features/MCPPluginDetail/Overview/TagList.tsx +1 -1
  141. package/src/features/MobileTabBar/index.tsx +2 -1
  142. package/src/features/OllamaSetupGuide/Desktop.tsx +1 -2
  143. package/src/features/PWAInstall/Install.tsx +1 -1
  144. package/src/features/PWAInstall/index.tsx +1 -1
  145. package/src/features/PluginDevModal/MCPManifestForm/index.tsx +30 -3
  146. package/src/features/PluginStore/McpList/index.tsx +1 -1
  147. package/src/features/PluginStore/PluginList/Detail/Header.tsx +6 -6
  148. package/src/features/PluginsUI/Render/DefaultType/index.tsx +1 -1
  149. package/src/features/Portal/Artifacts/Body/Renderer/index.tsx +1 -1
  150. package/src/features/ResourceManager/components/ChunkDrawer/index.tsx +1 -1
  151. package/src/features/ResourceManager/components/Explorer/ListView/Skeleton.tsx +26 -26
  152. package/src/features/ResourceManager/components/Explorer/ToolBar/BatchActionsDropdown.tsx +147 -149
  153. package/src/features/ResourceManager/index.tsx +1 -1
  154. package/src/features/Setting/Footer.tsx +4 -5
  155. package/src/features/User/UserPanel/PanelContent.tsx +1 -1
  156. package/src/hooks/useActiveTabKey.ts +6 -3
  157. package/src/hooks/useIsSingleMode.test.ts +10 -24
  158. package/src/hooks/useIsSingleMode.ts +4 -2
  159. package/src/hooks/useIsSubSlug.ts +2 -1
  160. package/src/hooks/useQuery.ts +5 -5
  161. package/src/layout/GlobalProvider/AppTheme.tsx +2 -2
  162. package/src/layout/GlobalProvider/StyleRegistry.tsx +1 -1
  163. package/src/layout/GlobalProvider/useUserStateRedirect.ts +13 -25
  164. package/src/libs/mcp/types.ts +31 -0
  165. package/src/libs/next/Image.tsx +13 -0
  166. package/src/libs/next/Link.tsx +13 -0
  167. package/src/libs/next/dynamic.tsx +13 -0
  168. package/src/libs/next/index.ts +22 -0
  169. package/src/libs/next/navigation.ts +22 -0
  170. package/src/libs/router/Link.tsx +30 -0
  171. package/src/libs/router/index.ts +18 -0
  172. package/src/libs/router/navigation.ts +72 -0
  173. package/src/server/modules/AgentRuntime/AgentStateManager.ts +5 -1
  174. package/src/store/chat/slices/portal/selectors.test.ts +5 -15
  175. package/src/store/page/index.ts +1 -1
  176. package/src/store/page/slices/crud/index.ts +1 -1
  177. package/src/store/tool/slices/mcpStore/action.ts +26 -11
  178. package/src/app/[variants]/(main)/hooks/usePathname.ts +0 -10
  179. package/src/app/[variants]/(main)/hooks/useQuery.ts +0 -12
  180. package/src/app/[variants]/(main)/hooks/useRouter.ts +0 -22
  181. package/src/app/[variants]/(main)/hooks/useSearchParams.ts +0 -11
@@ -2,7 +2,6 @@ import { ProviderCombine } from '@lobehub/icons';
2
2
  import { Flexbox, Highlighter, Snippet, Tabs } from '@lobehub/ui';
3
3
  import { Steps } from 'antd';
4
4
  import { createStaticStyles, cssVar } from 'antd-style';
5
- import Link from 'next/link';
6
5
  import { readableColor } from 'polished';
7
6
  import React, { memo, useMemo } from 'react';
8
7
  import { Trans, useTranslation } from 'react-i18next';
@@ -48,7 +47,7 @@ const SetupGuide = memo(() => {
48
47
  <Trans
49
48
  components={[
50
49
  <span key="0" />,
51
- <Link href={'https://ollama.com/download'} key="1" />,
50
+ <a href={'https://ollama.com/download'} key="1" rel="noreferrer" target="_blank" />,
52
51
  ]}
53
52
  i18nKey={'OllamaSetupGuide.install.description'}
54
53
  ns={'components'}
@@ -94,7 +93,7 @@ const SetupGuide = memo(() => {
94
93
  <Trans
95
94
  components={[
96
95
  <span key="0" />,
97
- <Link href={'https://ollama.com/download'} key="1" />,
96
+ <a href={'https://ollama.com/download'} key="1" rel="noreferrer" target="_blank" />,
98
97
  ]}
99
98
  i18nKey={'OllamaSetupGuide.install.description'}
100
99
  ns={'components'}
@@ -139,9 +138,11 @@ const SetupGuide = memo(() => {
139
138
  <Trans
140
139
  components={[
141
140
  <span key="0" />,
142
- <Link
141
+ <a
143
142
  href={'https://github.com/ollama/ollama/blob/main/docs/linux.md'}
144
143
  key="1"
144
+ rel="noreferrer"
145
+ target="_blank"
145
146
  />,
146
147
  ]}
147
148
  i18nKey={'OllamaSetupGuide.install.linux.manual'}
@@ -1,4 +1,4 @@
1
- import Image from 'next/image';
1
+ import Image from '@/libs/next/Image';
2
2
 
3
3
  interface WebFaviconProps {
4
4
  alt?: string;
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
 
3
3
  import { type Loader } from 'next/dist/shared/lib/dynamic';
4
- import dynamic from 'next/dynamic';
4
+ import dynamic from '@/libs/next/dynamic';
5
5
  import { type FC, memo } from 'react';
6
6
 
7
7
  import MobileSwitchLoading from '@/features/MobileSwitchLoading';
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
 
3
3
  import { type Loader } from 'next/dist/shared/lib/dynamic';
4
- import dynamic from 'next/dynamic';
4
+ import dynamic from '@/libs/next/dynamic';
5
5
  import { type FC, type PropsWithChildren, memo } from 'react';
6
6
 
7
7
  import MobileSwitchLoading from '@/features/MobileSwitchLoading';
@@ -1,7 +1,7 @@
1
1
  'use server';
2
2
 
3
3
  import { Image } from '@lobehub/ui/mdx';
4
- import Img from 'next/image';
4
+ import Img from '@/libs/next/Image';
5
5
  import { getPlaiceholder } from 'plaiceholder';
6
6
  import { type FC } from 'react';
7
7
 
@@ -1,20 +1,37 @@
1
1
  'use client';
2
2
 
3
- import Link, { type LinkProps } from 'next/link';
4
- import { type FC } from 'react';
3
+ import { type AnchorHTMLAttributes, type FC } from 'react';
4
+ import { Link } from 'react-router-dom';
5
5
 
6
6
  const EXTERNAL_HREF_REGEX = /https?:\/\//;
7
7
 
8
- const A: FC<LinkProps> = ({ href = '', ...props }) => {
8
+ interface LinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
9
+ href?: string;
10
+ }
11
+
12
+ const A: FC<LinkProps> = ({ href = '', children, ...props }) => {
9
13
  const isOutbound = EXTERNAL_HREF_REGEX.test(href as string);
10
14
  const isOfficial = String(href).includes('lobechat') || String(href).includes('lobehub');
15
+
16
+ // External links use native <a> tag
17
+ if (isOutbound) {
18
+ return (
19
+ <a
20
+ href={href}
21
+ rel={isOfficial ? 'noreferrer' : 'nofollow noreferrer'}
22
+ target="_blank"
23
+ {...props}
24
+ >
25
+ {children}
26
+ </a>
27
+ );
28
+ }
29
+
30
+ // Internal links use React Router
11
31
  return (
12
- <Link
13
- href={href}
14
- rel={isOutbound && !isOfficial ? 'nofollow' : undefined}
15
- target={isOutbound ? '_blank' : undefined}
16
- {...props}
17
- />
32
+ <Link to={href} {...props}>
33
+ {children}
34
+ </Link>
18
35
  );
19
36
  };
20
37
 
@@ -5,7 +5,6 @@ import { Button, Center, Flexbox, Icon, lobeStaticStylish } from '@lobehub/ui';
5
5
  import { useSize } from 'ahooks';
6
6
  import { createStaticStyles, cx } from 'antd-style';
7
7
  import { ArrowRightIcon } from 'lucide-react';
8
- import Link from 'next/link';
9
8
  import { memo, useEffect, useRef, useState } from 'react';
10
9
  import Marquee from 'react-fast-marquee';
11
10
  import { useTranslation } from 'react-i18next';
@@ -83,11 +82,11 @@ const CloudBanner = memo<{ mobile?: boolean }>(({ mobile }) => {
83
82
  <div className={styles.background} />
84
83
  <Center className={styles.wrapper} gap={16} horizontal width={'100%'}>
85
84
  {isTruncated ? <Marquee pauseOnHover>{content}</Marquee> : content}
86
- <Link href={`${OFFICIAL_URL}?utm_source=${UTM_SOURCE}&utm_medium=banner`} target={'_blank'}>
85
+ <a href={`${OFFICIAL_URL}?utm_source=${UTM_SOURCE}&utm_medium=banner`} rel="noreferrer" target="_blank">
87
86
  <Button size={'small'} type="primary">
88
87
  {t('alert.cloud.action')} <Icon icon={ArrowRightIcon} />
89
88
  </Button>
90
- </Link>
89
+ </a>
91
90
  </Center>
92
91
  </Center>
93
92
  );
@@ -2,7 +2,6 @@ import { Form } from '@lobehub/ui';
2
2
  import type { FormItemProps } from '@lobehub/ui';
3
3
  import { Form as AntdForm, Grid, Switch } from 'antd';
4
4
  import isEqual from 'fast-deep-equal';
5
- import Link from 'next/link';
6
5
  import { memo } from 'react';
7
6
  import { Trans, useTranslation } from 'react-i18next';
8
7
 
@@ -62,12 +61,13 @@ const ControlsForm = memo(() => {
62
61
  <span style={isNarrow ? descNarrow : descWide}>
63
62
  <Trans i18nKey={'extendParams.disableContextCaching.desc'} ns={'chat'}>
64
63
  单条对话生成成本最高可降低 90%,响应速度提升 4 倍(
65
- <Link
64
+ <a
66
65
  href={'https://www.anthropic.com/news/prompt-caching?utm_source=lobechat'}
67
- rel={'nofollow'}
66
+ rel="noreferrer nofollow"
67
+ target="_blank"
68
68
  >
69
69
  了解更多
70
- </Link>
70
+ </a>
71
71
  )。开启后将自动禁用历史记录限制
72
72
  </Trans>
73
73
  </span>
@@ -83,14 +83,15 @@ const ControlsForm = memo(() => {
83
83
  <span style={isNarrow ? descNarrow : descWide}>
84
84
  <Trans i18nKey={'extendParams.enableReasoning.desc'} ns={'chat'}>
85
85
  基于 Claude Thinking 机制限制(
86
- <Link
86
+ <a
87
87
  href={
88
88
  'https://docs.anthropic.com/en/docs/build-with-claude/extended-thinking?utm_source=lobechat#why-thinking-blocks-must-be-preserved'
89
89
  }
90
- rel={'nofollow'}
90
+ rel="noreferrer nofollow"
91
+ target="_blank"
91
92
  >
92
93
  了解更多
93
- </Link>
94
+ </a>
94
95
  ),开启后将自动禁用历史消息数限制
95
96
  </Trans>
96
97
  </span>
@@ -306,9 +306,7 @@ const Controls = memo<ControlsProps>(({ setUpdating }) => {
306
306
  ...(enableMaxTokens
307
307
  ? [
308
308
  {
309
- children: (
310
- <SliderWithInput max={32_000} min={0} step={100} unlimitedInput />
311
- ),
309
+ children: <SliderWithInput max={32_000} min={0} step={100} unlimitedInput />,
312
310
  label: (
313
311
  <Flexbox align={'center'} className={styles.label} gap={8} horizontal>
314
312
  {t('settingModel.maxTokens.title')}
@@ -1,4 +1,4 @@
1
- import dynamic from 'next/dynamic';
1
+ import dynamic from '@/libs/next/dynamic';
2
2
  import { type PropsWithChildren, memo } from 'react';
3
3
 
4
4
  import { useModelHasContextWindowToken } from '@/hooks/useModelHasContextWindowToken';
@@ -3,7 +3,7 @@
3
3
  import { ChatInput, ChatInputActionBar } from '@lobehub/editor/react';
4
4
  import { Flexbox } from '@lobehub/ui';
5
5
  import { createStaticStyles, cssVar, cx } from 'antd-style';
6
- import dynamic from 'next/dynamic';
6
+ import dynamic from '@/libs/next/dynamic';
7
7
  import { memo } from 'react';
8
8
 
9
9
  import { useChatInputStore } from '@/features/ChatInput/store';
@@ -1,6 +1,6 @@
1
1
  import { Flexbox } from '@lobehub/ui';
2
2
  import { createStaticStyles, cx } from 'antd-style';
3
- import dynamic from 'next/dynamic';
3
+ import dynamic from '@/libs/next/dynamic';
4
4
  import { type ReactNode, Suspense, memo, useCallback } from 'react';
5
5
 
6
6
  import { useConversationStore } from '@/features/Conversation/store';
@@ -1,6 +1,6 @@
1
1
  import { type ChatMessageError } from '@lobechat/types';
2
2
  import { type AlertProps, Skeleton } from '@lobehub/ui';
3
- import dynamic from 'next/dynamic';
3
+ import dynamic from '@/libs/next/dynamic';
4
4
  import { memo } from 'react';
5
5
 
6
6
  import ErrorContent from '@/features/Conversation/ChatItem/components/ErrorContent';
@@ -1,6 +1,5 @@
1
1
  import { Ollama } from '@lobehub/icons';
2
2
  import { Button } from '@lobehub/ui';
3
- import Link from 'next/link';
4
3
  import { memo } from 'react';
5
4
  import { Trans, useTranslation } from 'react-i18next';
6
5
 
@@ -29,7 +28,7 @@ const OllamaDesktopSetupGuide = memo<{ id?: string }>(({ id }) => {
29
28
  avatar={<Ollama.Avatar shape={'square'} size={40} />}
30
29
  desc={
31
30
  <Trans
32
- components={[<span key="0" />, <Link href={'https://ollama.com/download'} key="1" />]}
31
+ components={[<span key="0" />, <a href={'https://ollama.com/download'} key="1" rel="noreferrer" target="_blank" />]}
33
32
  i18nKey={'OllamaSetupGuide.install.description'}
34
33
  ns={'components'}
35
34
  />
@@ -3,7 +3,7 @@ import { AgentRuntimeErrorType, type ILobeAgentRuntimeErrorType } from '@lobecha
3
3
  import { ChatErrorType, type ChatMessageError, type ErrorType } from '@lobechat/types';
4
4
  import { type IPluginErrorType } from '@lobehub/chat-plugin-sdk';
5
5
  import { type AlertProps, Block, Highlighter, Skeleton } from '@lobehub/ui';
6
- import dynamic from 'next/dynamic';
6
+ import dynamic from '@/libs/next/dynamic';
7
7
  import { memo, useMemo } from 'react';
8
8
  import { useTranslation } from 'react-i18next';
9
9
 
@@ -1,6 +1,6 @@
1
1
  import { ActionIcon, createRawModal } from '@lobehub/ui';
2
2
  import { LucideSettings } from 'lucide-react';
3
- import dynamic from 'next/dynamic';
3
+ import dynamic from '@/libs/next/dynamic';
4
4
  import { memo } from 'react';
5
5
  import { useTranslation } from 'react-i18next';
6
6
 
@@ -2,9 +2,9 @@ import { LOADING_FLAT } from '@lobechat/const';
2
2
  import { type ChatToolResult, type ToolIntervention } from '@lobechat/types';
3
3
  import { AccordionItem, Flexbox, Skeleton } from '@lobehub/ui';
4
4
  import { Divider } from 'antd';
5
- import dynamic from 'next/dynamic';
6
5
  import { memo, useEffect, useState } from 'react';
7
6
 
7
+ import dynamic from '@/libs/next/dynamic';
8
8
  import { useChatStore } from '@/store/chat';
9
9
  import { operationSelectors } from '@/store/chat/slices/operation/selectors';
10
10
  import { useToolStore } from '@/store/tool';
@@ -2,7 +2,7 @@
2
2
 
3
3
  import type { AssistantContentBlock } from '@lobechat/types';
4
4
  import isEqual from 'fast-deep-equal';
5
- import dynamic from 'next/dynamic';
5
+ import dynamic from '@/libs/next/dynamic';
6
6
  import { type MouseEventHandler, Suspense, memo, useCallback, useMemo } from 'react';
7
7
 
8
8
  import { MESSAGE_ACTION_BAR_PORTAL_ATTRIBUTES } from '@/const/messageActionPortal';
@@ -1,8 +1,8 @@
1
1
  import { Accordion, AccordionItem, Flexbox, Skeleton } from '@lobehub/ui';
2
- import dynamic from 'next/dynamic';
3
2
  import { type CSSProperties, memo, useState } from 'react';
4
3
 
5
4
  import Actions from '@/features/Conversation/Messages/AssistantGroup/Tool/Actions';
5
+ import dynamic from '@/libs/next/dynamic';
6
6
 
7
7
  import { dataSelectors, messageStateSelectors, useConversationStore } from '../../../store';
8
8
  import Inspectors from '../../AssistantGroup/Tool/Inspector';
@@ -2,7 +2,7 @@ import { Flexbox, Icon, SearchResultCards, Tag } from '@lobehub/ui';
2
2
  import { createStaticStyles, cssVar, cx } from 'antd-style';
3
3
  import { ChevronDown, ChevronRight, Globe } from 'lucide-react';
4
4
  import { AnimatePresence, m as motion } from 'motion/react';
5
- import Image from 'next/image';
5
+ import Image from '@/libs/next/Image';
6
6
  import { memo, useState } from 'react';
7
7
  import { useTranslation } from 'react-i18next';
8
8
 
@@ -1,7 +1,6 @@
1
1
  import { Alert, Button, Flexbox, Highlighter, Icon } from '@lobehub/ui';
2
2
  import { Result } from 'antd';
3
3
  import { ShieldAlert } from 'lucide-react';
4
- import Link from 'next/link';
5
4
  import React, { memo } from 'react';
6
5
  import { Trans, useTranslation } from 'react-i18next';
7
6
  import Balancer from 'react-wrap-balancer';
@@ -41,17 +40,18 @@ const Error = memo<ErrorProps>(({ error, onClick }) => {
41
40
  <Balancer>
42
41
  <Trans i18nKey="importModal.error.desc" ns={'common'}>
43
42
  非常抱歉,数据库升级过程发生异常。请重试升级,或
44
- <Link
43
+ <a
45
44
  aria-label={'issue'}
46
45
  href={GITHUB_ISSUES}
47
46
  onClick={(e) => {
48
47
  e.preventDefault();
49
48
  githubService.submitImportError(error!);
50
49
  }}
50
+ rel="noreferrer"
51
51
  target="_blank"
52
52
  >
53
53
  提交问题
54
- </Link>
54
+ </a>
55
55
  我们将会第一时间帮你排查问题。
56
56
  </Trans>
57
57
  </Balancer>
@@ -1,6 +1,5 @@
1
1
  'use client';
2
2
 
3
- import { usePathname } from 'next/navigation';
4
3
  import {
5
4
  type PropsWithChildren,
6
5
  createContext,
@@ -10,6 +9,8 @@ import {
10
9
  useTransition,
11
10
  } from 'react';
12
11
 
12
+ import { usePathname } from '@/libs/router/navigation';
13
+
13
14
  import { getCacheFiles } from './getCacheEntries';
14
15
  import type { NextCacheFileData } from './schema';
15
16
 
@@ -1,5 +1,5 @@
1
1
  import { Flexbox, Form, Input, TextArea } from '@lobehub/ui';
2
- import Image from 'next/image';
2
+ import Image from '@/libs/next/Image';
3
3
  import { memo } from 'react';
4
4
 
5
5
  import { useHead } from './useHead';
@@ -5,11 +5,11 @@ import { ActionIcon, Flexbox, FluentEmoji, Icon, SideNav } from '@lobehub/ui';
5
5
  import { FloatButton } from 'antd';
6
6
  import { createStaticStyles, cssVar, cx } from 'antd-style';
7
7
  import { BugIcon, BugOff, XIcon } from 'lucide-react';
8
- import { usePathname } from 'next/navigation';
9
8
  import { type ReactNode, memo, useEffect, useState } from 'react';
10
9
  import { Rnd } from 'react-rnd';
11
10
 
12
11
  import { isDesktop } from '@/const/version';
12
+ import { usePathname } from '@/libs/next/navigation';
13
13
 
14
14
  // 定义样式
15
15
  const styles = createStaticStyles(({ css }) => {
@@ -1,6 +1,5 @@
1
1
  import { Flexbox, Highlighter } from '@lobehub/ui';
2
- import Image from 'next/image';
3
- import Link from 'next/link';
2
+ import Image from '@/libs/next/Image';
4
3
  import { type ReactNode, memo } from 'react';
5
4
 
6
5
  const TooltipContent = memo<{ children: ReactNode }>(({ children }) => {
@@ -19,9 +18,9 @@ const TooltipContent = memo<{ children: ReactNode }>(({ children }) => {
19
18
 
20
19
  if (children.startsWith('http'))
21
20
  return (
22
- <Link href={children} target={'_blank'}>
21
+ <a href={children} rel="noreferrer" target="_blank">
23
22
  {children}
24
- </Link>
23
+ </a>
25
24
  );
26
25
 
27
26
  const code = children.trim().trimEnd();
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
 
3
3
  import { BookText, Cog, FlagIcon, GlobeLockIcon } from 'lucide-react';
4
- import dynamic from 'next/dynamic';
4
+ import dynamic from '@/libs/next/dynamic';
5
5
 
6
6
  import CacheViewer from './CacheViewer';
7
7
  import FeatureFlagViewer from './FeatureFlagViewer';
@@ -1,11 +1,6 @@
1
1
  'use client';
2
2
 
3
- import {
4
- HotkeyEnum,
5
- INSERT_HEADING_COMMAND,
6
- getHotkeyById,
7
- type IEditor,
8
- } from '@lobehub/editor';
3
+ import { HotkeyEnum, type IEditor, INSERT_HEADING_COMMAND, getHotkeyById } from '@lobehub/editor';
9
4
  import {
10
5
  ChatInputActions,
11
6
  type ChatInputActionsProps,
@@ -1,6 +1,5 @@
1
1
  import { Button, Center, Flexbox, FluentEmoji } from '@lobehub/ui';
2
2
  import { createStaticStyles } from 'antd-style';
3
- import Link from 'next/link';
4
3
  import { type CSSProperties, type ComponentType, useState } from 'react';
5
4
  import { Trans, useTranslation } from 'react-i18next';
6
5
 
@@ -37,9 +36,9 @@ const NotSupport: ComponentType<NotSupportProps> = ({ fileName, url, style }) =>
37
36
  <Flexbox style={{ textAlign: 'center' }}>
38
37
  <Trans i18nKey="preview.unsupportedFileAndContact" ns={'file'}>
39
38
  此文件格式暂不支持在线预览,如有预览诉求,欢迎
40
- <Link aria-label={'todo'} href={MORE_FILE_PREVIEW_REQUEST_URL} target="_blank">
39
+ <a aria-label={'todo'} href={MORE_FILE_PREVIEW_REQUEST_URL} rel="noreferrer" target="_blank">
41
40
  反馈给我们
42
- </Link>
41
+ </a>
43
42
  </Trans>
44
43
  </Flexbox>
45
44
  {url && (
@@ -4,7 +4,6 @@ import { SiDiscord, SiGithub, SiMedium, SiX } from '@icons-pack/react-simple-ico
4
4
  import { SOCIAL_URL } from '@lobechat/business-const';
5
5
  import { ActionIcon, Flexbox } from '@lobehub/ui';
6
6
  import { createStaticStyles, cssVar } from 'antd-style';
7
- import Link from 'next/link';
8
7
  import { memo } from 'react';
9
8
  import { useTranslation } from 'react-i18next';
10
9
 
@@ -30,30 +29,30 @@ const Follow = memo(() => {
30
29
  const { t } = useTranslation('common');
31
30
  return (
32
31
  <Flexbox gap={8} horizontal>
33
- <Link href={GITHUB} rel="noreferrer" target={'_blank'}>
32
+ <a href={GITHUB} rel="noreferrer" target="_blank">
34
33
  <ActionIcon
35
34
  className={styles.icon}
36
35
  icon={SiGithub as any}
37
36
  title={t('follow', { name: 'GitHub' })}
38
37
  />
39
- </Link>
40
- <Link href={SOCIAL_URL.x} rel="noreferrer" target={'_blank'}>
38
+ </a>
39
+ <a href={SOCIAL_URL.x} rel="noreferrer" target="_blank">
41
40
  <ActionIcon className={styles.icon} icon={SiX as any} title={t('follow', { name: 'X' })} />
42
- </Link>
43
- <Link href={SOCIAL_URL.discord} rel="noreferrer" target={'_blank'}>
41
+ </a>
42
+ <a href={SOCIAL_URL.discord} rel="noreferrer" target="_blank">
44
43
  <ActionIcon
45
44
  className={styles.icon}
46
45
  icon={SiDiscord as any}
47
46
  title={t('follow', { name: 'Discord' })}
48
47
  />
49
- </Link>
50
- <Link href={SOCIAL_URL.medium} rel="noreferrer" target={'_blank'}>
48
+ </a>
49
+ <a href={SOCIAL_URL.medium} rel="noreferrer" target="_blank">
51
50
  <ActionIcon
52
51
  className={styles.icon}
53
52
  icon={SiMedium as any}
54
53
  title={t('follow', { name: 'Medium' })}
55
54
  />
56
- </Link>
55
+ </a>
57
56
  </Flexbox>
58
57
  );
59
58
  });
@@ -1,8 +1,8 @@
1
1
  import { Block, Button, Flexbox, Form, MaterialFileTypeIcon, Select } from '@lobehub/ui';
2
2
  import { App } from 'antd';
3
- import Link from 'next/link';
4
3
  import { memo, useState } from 'react';
5
4
  import { Trans, useTranslation } from 'react-i18next';
5
+ import { Link } from 'react-router-dom';
6
6
 
7
7
  import RepoIcon from '@/components/LibIcon';
8
8
  import { useKnowledgeBaseStore } from '@/store/library';
@@ -34,7 +34,7 @@ const SelectForm = memo<CreateFormProps>(({ onClose, knowledgeBaseId, fileIds })
34
34
  <Trans
35
35
  components={[
36
36
  <span key="0" />,
37
- <Link href={`/knowledge/library/${values.id}`} key="1" />,
37
+ <Link key="1" to={`/knowledge/library/${values.id}`} />,
38
38
  ]}
39
39
  i18nKey={'addToKnowledgeBase.addSuccess'}
40
40
  ns={'knowledgeBase'}