@lobehub/lobehub 2.0.0-next.13 → 2.0.0-next.14

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 (210) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/changelog/v1.json +9 -0
  3. package/package.json +1 -1
  4. package/packages/const/src/version.ts +3 -3
  5. package/packages/database/src/repositories/dataImporter/deprecated/__tests__/index.test.ts +2 -1
  6. package/packages/database/src/repositories/dataImporter/deprecated/index.ts +7 -1
  7. package/src/app/[variants]/(main)/(mobile)/me/(home)/__tests__/useCategory.test.tsx +9 -0
  8. package/src/app/[variants]/(main)/(mobile)/me/(home)/layout.tsx +0 -2
  9. package/src/app/[variants]/(main)/chat/@session/features/SessionListContent/List/Item/Actions.tsx +3 -28
  10. package/src/app/[variants]/(main)/chat/_layout/Desktop/index.tsx +0 -2
  11. package/src/app/[variants]/(main)/chat/_layout/Mobile.tsx +1 -5
  12. package/src/app/[variants]/(main)/chat/settings/features/HeaderContent.tsx +2 -62
  13. package/src/app/[variants]/(main)/image/page.tsx +0 -2
  14. package/src/app/[variants]/(main)/profile/_layout/Desktop/index.tsx +23 -24
  15. package/src/app/[variants]/(main)/profile/_layout/Mobile/index.tsx +5 -9
  16. package/src/app/[variants]/(main)/settings/_layout/Desktop/index.tsx +0 -2
  17. package/src/app/[variants]/(main)/settings/_layout/Mobile/index.tsx +0 -2
  18. package/src/app/[variants]/(main)/settings/provider/(list)/ProviderGrid/Card.tsx +1 -1
  19. package/src/app/[variants]/loading/index.tsx +1 -10
  20. package/src/components/Link.tsx +12 -0
  21. package/src/envs/app.ts +5 -8
  22. package/src/features/DataImporter/index.tsx +15 -60
  23. package/src/features/DevPanel/PostgresViewer/usePgTable.ts +3 -2
  24. package/src/hooks/useInterceptingRoutes.test.ts +21 -3
  25. package/src/libs/trpc/client/index.ts +0 -1
  26. package/src/libs/trpc/client/lambda.ts +8 -5
  27. package/src/server/routers/desktop/mcp.ts +1 -3
  28. package/src/server/routers/lambda/config/index.test.ts +2 -2
  29. package/src/server/routers/tools/mcp.ts +2 -3
  30. package/src/server/routers/tools/search.test.ts +1 -7
  31. package/src/server/routers/tools/search.ts +1 -4
  32. package/src/services/__tests__/tool.test.ts +0 -3
  33. package/src/services/aiModel/index.test.ts +0 -3
  34. package/src/services/aiModel/index.ts +1 -7
  35. package/src/services/aiProvider/index.test.ts +0 -3
  36. package/src/services/aiProvider/index.ts +1 -7
  37. package/src/services/chatGroup/index.ts +1 -10
  38. package/src/services/config.ts +1 -65
  39. package/src/services/export/index.ts +1 -4
  40. package/src/services/file/index.ts +1 -11
  41. package/src/services/import/index.ts +1 -7
  42. package/src/services/message/index.ts +1 -11
  43. package/src/services/plugin/index.ts +1 -11
  44. package/src/services/session/index.ts +1 -11
  45. package/src/services/tableViewer/client.ts +12 -15
  46. package/src/services/thread/index.ts +1 -7
  47. package/src/services/topic/index.ts +1 -11
  48. package/src/services/user/index.ts +1 -13
  49. package/src/store/chat/slices/aiChat/actions/__tests__/generateAIChat.test.ts +0 -241
  50. package/src/store/chat/slices/aiChat/actions/__tests__/generateAIChatV2.test.ts +26 -1
  51. package/src/store/chat/slices/aiChat/actions/__tests__/helpers.ts +3 -1
  52. package/src/store/chat/slices/aiChat/actions/generateAIChat.ts +1 -138
  53. package/src/store/user/slices/common/action.test.ts +1 -4
  54. package/src/app/(backend)/trpc/edge/[trpc]/route.ts +0 -26
  55. package/src/app/[variants]/(main)/(mobile)/me/data/features/Category.tsx +0 -48
  56. package/src/app/[variants]/(main)/(mobile)/me/data/features/Header.tsx +0 -33
  57. package/src/app/[variants]/(main)/(mobile)/me/data/layout.tsx +0 -13
  58. package/src/app/[variants]/(main)/(mobile)/me/data/loading.tsx +0 -5
  59. package/src/app/[variants]/(main)/(mobile)/me/data/page.tsx +0 -29
  60. package/src/app/[variants]/(main)/chat/features/Migration/DBReader.ts +0 -290
  61. package/src/app/[variants]/(main)/chat/features/Migration/ExportConfigButton.tsx +0 -35
  62. package/src/app/[variants]/(main)/chat/features/Migration/Failed.tsx +0 -120
  63. package/src/app/[variants]/(main)/chat/features/Migration/Modal.tsx +0 -81
  64. package/src/app/[variants]/(main)/chat/features/Migration/Start.tsx +0 -108
  65. package/src/app/[variants]/(main)/chat/features/Migration/UpgradeButton.tsx +0 -71
  66. package/src/app/[variants]/(main)/chat/features/Migration/const.ts +0 -15
  67. package/src/app/[variants]/(main)/chat/features/Migration/index.tsx +0 -50
  68. package/src/app/[variants]/loading/Client/Content.tsx +0 -48
  69. package/src/app/[variants]/loading/Client/Error.tsx +0 -27
  70. package/src/app/[variants]/loading/Client/Redirect.tsx +0 -47
  71. package/src/app/[variants]/loading/Client/index.tsx +0 -22
  72. package/src/components/InnerLink.tsx +0 -20
  73. package/src/database/_deprecated/core/__tests__/db-upgrade.test.ts +0 -42
  74. package/src/database/_deprecated/core/__tests__/db.test.ts +0 -79
  75. package/src/database/_deprecated/core/__tests__/model.test.ts +0 -55
  76. package/src/database/_deprecated/core/db.ts +0 -246
  77. package/src/database/_deprecated/core/index.ts +0 -2
  78. package/src/database/_deprecated/core/migrations/migrateSettingsToUser/fixtures/input.json +0 -55
  79. package/src/database/_deprecated/core/migrations/migrateSettingsToUser/fixtures/output.json +0 -60
  80. package/src/database/_deprecated/core/migrations/migrateSettingsToUser/index.test.ts +0 -14
  81. package/src/database/_deprecated/core/migrations/migrateSettingsToUser/index.ts +0 -22
  82. package/src/database/_deprecated/core/migrations/migrateSettingsToUser/type.ts +0 -105
  83. package/src/database/_deprecated/core/model.ts +0 -218
  84. package/src/database/_deprecated/core/schemas.ts +0 -88
  85. package/src/database/_deprecated/core/types/db.ts +0 -15
  86. package/src/database/_deprecated/models/__DEBUG.ts +0 -124
  87. package/src/database/_deprecated/models/__tests__/file.test.ts +0 -83
  88. package/src/database/_deprecated/models/__tests__/message.test.ts +0 -426
  89. package/src/database/_deprecated/models/__tests__/plugin.test.ts +0 -81
  90. package/src/database/_deprecated/models/__tests__/session.test.ts +0 -253
  91. package/src/database/_deprecated/models/__tests__/sessionGroup.test.ts +0 -220
  92. package/src/database/_deprecated/models/__tests__/topic.test.ts +0 -523
  93. package/src/database/_deprecated/models/__tests__/user.test.ts +0 -82
  94. package/src/database/_deprecated/models/file.ts +0 -51
  95. package/src/database/_deprecated/models/message.ts +0 -277
  96. package/src/database/_deprecated/models/plugin.ts +0 -62
  97. package/src/database/_deprecated/models/session.ts +0 -271
  98. package/src/database/_deprecated/models/sessionGroup.ts +0 -93
  99. package/src/database/_deprecated/models/topic.ts +0 -250
  100. package/src/database/_deprecated/models/user.ts +0 -69
  101. package/src/database/_deprecated/schemas/files.ts +0 -39
  102. package/src/database/_deprecated/schemas/message.ts +0 -50
  103. package/src/database/_deprecated/schemas/plugin.ts +0 -12
  104. package/src/database/_deprecated/schemas/session.ts +0 -54
  105. package/src/database/_deprecated/schemas/sessionGroup.ts +0 -8
  106. package/src/database/_deprecated/schemas/topic.ts +0 -12
  107. package/src/database/_deprecated/schemas/user.ts +0 -40
  108. package/src/features/DataImporter/_deprecated.ts +0 -43
  109. package/src/features/InitClientDB/EnableModal.tsx +0 -118
  110. package/src/features/InitClientDB/ErrorResult.tsx +0 -143
  111. package/src/features/InitClientDB/InitIndicator.tsx +0 -124
  112. package/src/features/InitClientDB/PGliteIcon.tsx +0 -28
  113. package/src/features/InitClientDB/features/DatabaseRepair/Backup.tsx +0 -75
  114. package/src/features/InitClientDB/features/DatabaseRepair/Diagnosis.tsx +0 -98
  115. package/src/features/InitClientDB/features/DatabaseRepair/Repair.tsx +0 -218
  116. package/src/features/InitClientDB/features/DatabaseRepair/index.tsx +0 -91
  117. package/src/features/InitClientDB/index.tsx +0 -37
  118. package/src/libs/trpc/client/edge.ts +0 -26
  119. package/src/libs/trpc/edge/context.ts +0 -71
  120. package/src/libs/trpc/edge/index.ts +0 -45
  121. package/src/libs/trpc/edge/init.ts +0 -26
  122. package/src/libs/trpc/edge/middleware/jwtPayload.test.ts +0 -75
  123. package/src/libs/trpc/edge/middleware/jwtPayload.ts +0 -14
  124. package/src/migrations/FromV0ToV1.ts +0 -10
  125. package/src/migrations/FromV1ToV2/fixtures/input-v1-session.json +0 -191
  126. package/src/migrations/FromV1ToV2/fixtures/output-v2.json +0 -202
  127. package/src/migrations/FromV1ToV2/index.ts +0 -82
  128. package/src/migrations/FromV1ToV2/migrations.test.ts +0 -224
  129. package/src/migrations/FromV1ToV2/types/v1.ts +0 -78
  130. package/src/migrations/FromV1ToV2/types/v2.ts +0 -52
  131. package/src/migrations/FromV2ToV3/fixtures/input-v2-session.json +0 -72
  132. package/src/migrations/FromV2ToV3/fixtures/output-v3-from-v1.json +0 -203
  133. package/src/migrations/FromV2ToV3/fixtures/output-v3.json +0 -74
  134. package/src/migrations/FromV2ToV3/index.ts +0 -30
  135. package/src/migrations/FromV2ToV3/migrations.test.ts +0 -42
  136. package/src/migrations/FromV2ToV3/types/v3.ts +0 -27
  137. package/src/migrations/FromV3ToV4/fixtures/azure-input-v3.json +0 -79
  138. package/src/migrations/FromV3ToV4/fixtures/azure-output-v4.json +0 -75
  139. package/src/migrations/FromV3ToV4/fixtures/ollama-input-v3.json +0 -85
  140. package/src/migrations/FromV3ToV4/fixtures/ollama-output-v4.json +0 -86
  141. package/src/migrations/FromV3ToV4/fixtures/openai-input-v3.json +0 -77
  142. package/src/migrations/FromV3ToV4/fixtures/openai-output-v4.json +0 -77
  143. package/src/migrations/FromV3ToV4/fixtures/openrouter-input-v3.json +0 -82
  144. package/src/migrations/FromV3ToV4/fixtures/openrouter-output-v4.json +0 -85
  145. package/src/migrations/FromV3ToV4/fixtures/output-v4-from-v1.json +0 -203
  146. package/src/migrations/FromV3ToV4/index.ts +0 -102
  147. package/src/migrations/FromV3ToV4/migrations.test.ts +0 -195
  148. package/src/migrations/FromV3ToV4/types/v3.ts +0 -52
  149. package/src/migrations/FromV3ToV4/types/v4.ts +0 -37
  150. package/src/migrations/FromV4ToV5/fixtures/from-v1-to-v5-output.json +0 -245
  151. package/src/migrations/FromV4ToV5/fixtures/function-input-v4.json +0 -96
  152. package/src/migrations/FromV4ToV5/fixtures/function-output-v5.json +0 -120
  153. package/src/migrations/FromV4ToV5/index.ts +0 -58
  154. package/src/migrations/FromV4ToV5/migrations.test.ts +0 -49
  155. package/src/migrations/FromV4ToV5/types/v4.ts +0 -21
  156. package/src/migrations/FromV4ToV5/types/v5.ts +0 -27
  157. package/src/migrations/FromV5ToV6/fixtures/from-v1-to-v6-output.json +0 -247
  158. package/src/migrations/FromV5ToV6/fixtures/session-input-v5.json +0 -81
  159. package/src/migrations/FromV5ToV6/fixtures/session-output-v6.json +0 -85
  160. package/src/migrations/FromV5ToV6/index.ts +0 -61
  161. package/src/migrations/FromV5ToV6/migrations.test.ts +0 -50
  162. package/src/migrations/FromV5ToV6/types/v5.ts +0 -48
  163. package/src/migrations/FromV5ToV6/types/v6.ts +0 -63
  164. package/src/migrations/FromV6ToV7/fixtures/output-v7-from-v1.json +0 -203
  165. package/src/migrations/FromV6ToV7/fixtures/provider-input-v6.json +0 -103
  166. package/src/migrations/FromV6ToV7/fixtures/provider-output-v7.json +0 -118
  167. package/src/migrations/FromV6ToV7/index.ts +0 -101
  168. package/src/migrations/FromV6ToV7/migrations.test.ts +0 -64
  169. package/src/migrations/FromV6ToV7/types/v6.ts +0 -61
  170. package/src/migrations/FromV6ToV7/types/v7.ts +0 -69
  171. package/src/migrations/VersionController.test.ts +0 -88
  172. package/src/migrations/VersionController.ts +0 -67
  173. package/src/migrations/index.ts +0 -61
  174. package/src/server/routers/edge/appStatus.ts +0 -3
  175. package/src/server/routers/edge/index.ts +0 -14
  176. package/src/server/routers/edge/upload.ts +0 -16
  177. package/src/services/aiModel/client.ts +0 -70
  178. package/src/services/aiProvider/client.ts +0 -58
  179. package/src/services/baseClientService/index.ts +0 -9
  180. package/src/services/chatGroup/client.ts +0 -63
  181. package/src/services/export/_deprecated.ts +0 -155
  182. package/src/services/export/client.ts +0 -15
  183. package/src/services/file/_deprecated.test.ts +0 -119
  184. package/src/services/file/_deprecated.ts +0 -80
  185. package/src/services/file/client.test.ts +0 -199
  186. package/src/services/file/client.ts +0 -85
  187. package/src/services/import/_deprecated.ts +0 -115
  188. package/src/services/import/client.test.ts +0 -1015
  189. package/src/services/import/client.ts +0 -64
  190. package/src/services/message/_deprecated.test.ts +0 -398
  191. package/src/services/message/_deprecated.ts +0 -168
  192. package/src/services/message/client.test.ts +0 -410
  193. package/src/services/message/client.ts +0 -192
  194. package/src/services/plugin/_deprecated.test.ts +0 -162
  195. package/src/services/plugin/_deprecated.ts +0 -42
  196. package/src/services/plugin/client.test.ts +0 -177
  197. package/src/services/plugin/client.ts +0 -46
  198. package/src/services/session/_deprecated.test.ts +0 -440
  199. package/src/services/session/_deprecated.ts +0 -190
  200. package/src/services/session/client.test.ts +0 -413
  201. package/src/services/session/client.ts +0 -193
  202. package/src/services/thread/client.ts +0 -51
  203. package/src/services/topic/_deprecated.test.ts +0 -245
  204. package/src/services/topic/_deprecated.ts +0 -75
  205. package/src/services/topic/client.ts +0 -89
  206. package/src/services/topic/pglite.test.ts +0 -212
  207. package/src/services/user/_deprecated.test.ts +0 -101
  208. package/src/services/user/_deprecated.ts +0 -70
  209. package/src/services/user/client.test.ts +0 -111
  210. package/src/services/user/client.ts +0 -104
package/CHANGELOG.md CHANGED
@@ -2,6 +2,31 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ## [Version 2.0.0-next.14](https://github.com/lobehub/lobe-chat/compare/v2.0.0-next.13...v2.0.0-next.14)
6
+
7
+ <sup>Released on **2025-11-02**</sup>
8
+
9
+ #### ♻ Code Refactoring
10
+
11
+ - **misc**: Remove client service.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### Code refactoring
19
+
20
+ - **misc**: Remove client service, closes [#9991](https://github.com/lobehub/lobe-chat/issues/9991) ([9137dba](https://github.com/lobehub/lobe-chat/commit/9137dba))
21
+
22
+ </details>
23
+
24
+ <div align="right">
25
+
26
+ [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
27
+
28
+ </div>
29
+
5
30
  ## [Version 2.0.0-next.13](https://github.com/lobehub/lobe-chat/compare/v2.0.0-next.12...v2.0.0-next.13)
6
31
 
7
32
  <sup>Released on **2025-11-02**</sup>
package/changelog/v1.json CHANGED
@@ -1,4 +1,13 @@
1
1
  [
2
+ {
3
+ "children": {
4
+ "improvements": [
5
+ "Remove client service."
6
+ ]
7
+ },
8
+ "date": "2025-11-02",
9
+ "version": "2.0.0-next.14"
10
+ },
2
11
  {
3
12
  "children": {
4
13
  "fixes": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/lobehub",
3
- "version": "2.0.0-next.13",
3
+ "version": "2.0.0-next.14",
4
4
  "description": "LobeHub - an open-source,comprehensive AI Agent framework that supports speech synthesis, multimodal, and extensible Function Call plugin system. Supports one-click free deployment of your private ChatGPT/LLM web application.",
5
5
  "keywords": [
6
6
  "framework",
@@ -4,12 +4,12 @@ import { BRANDING_NAME, ORG_NAME } from './branding';
4
4
 
5
5
  export const CURRENT_VERSION = pkg.version;
6
6
 
7
- export const isServerMode = process.env.NEXT_PUBLIC_SERVICE_MODE === 'server';
8
- export const isUsePgliteDB = process.env.NEXT_PUBLIC_CLIENT_DB === 'pglite';
7
+ export const isServerMode = true;
8
+ export const isUsePgliteDB = false;
9
9
 
10
10
  export const isDesktop = process.env.NEXT_PUBLIC_IS_DESKTOP_APP === '1';
11
11
 
12
- export const isDeprecatedEdition = !isServerMode && !isUsePgliteDB;
12
+ export const isDeprecatedEdition = false;
13
13
 
14
14
  // @ts-ignore
15
15
  export const isCustomBranding = BRANDING_NAME !== 'LobeHub';
@@ -12,12 +12,13 @@ import {
12
12
  topics,
13
13
  users,
14
14
  } from '@/database/schemas';
15
- import { CURRENT_CONFIG_VERSION } from '@/migrations';
16
15
  import { ImporterEntryData } from '@/types/importer';
17
16
 
18
17
  import { DeprecatedDataImporterRepos as DataImporterRepos } from '../index';
19
18
  import mockImportData from './fixtures/messages.json';
20
19
 
20
+ const CURRENT_CONFIG_VERSION = 7;
21
+
21
22
  const serverDB = await getTestDBInstance();
22
23
 
23
24
  const userId = 'test-user-id';
@@ -1,6 +1,5 @@
1
1
  import { and, eq, inArray, sql } from 'drizzle-orm';
2
2
 
3
- import { ImportResult } from '@/services/import/_deprecated';
4
3
  import { ImporterEntryData } from '@/types/importer';
5
4
  import { sanitizeUTF8 } from '@/utils/sanitizeUTF8';
6
5
 
@@ -16,6 +15,13 @@ import {
16
15
  } from '../../../schemas';
17
16
  import { LobeChatDatabase } from '../../../type';
18
17
 
18
+ interface ImportResult {
19
+ added: number;
20
+ errors: number;
21
+ skips: number;
22
+ updated?: number;
23
+ }
24
+
19
25
  export class DeprecatedDataImporterRepos {
20
26
  private userId: string;
21
27
  private db: LobeChatDatabase;
@@ -40,6 +40,15 @@ vi.mock('@/const/auth', () => ({
40
40
  },
41
41
  }));
42
42
 
43
+ // Mock version constants
44
+ vi.mock('@/const/version', async (importOriginal) => {
45
+ const actual = await importOriginal<typeof import('@/const/version')>();
46
+ return {
47
+ ...actual,
48
+ isServerMode: false,
49
+ };
50
+ });
51
+
43
52
  afterEach(() => {
44
53
  enableAuth = true;
45
54
  enableClerk = true;
@@ -2,7 +2,6 @@ import { PropsWithChildren, Suspense } from 'react';
2
2
 
3
3
  import Loading from '@/components/Loading/BrandTextLoading';
4
4
  import MobileContentLayout from '@/components/server/MobileNavLayout';
5
- import InitClientDB from '@/features/InitClientDB';
6
5
 
7
6
  import Header from './features/Header';
8
7
 
@@ -10,7 +9,6 @@ const Layout = ({ children }: PropsWithChildren) => {
10
9
  return (
11
10
  <MobileContentLayout header={<Header />} withNav>
12
11
  <Suspense fallback={<Loading />}>{children}</Suspense>
13
- <InitClientDB />
14
12
  </MobileContentLayout>
15
13
  );
16
14
  };
@@ -1,3 +1,5 @@
1
+ import { isDesktop } from '@lobechat/const';
2
+ import { SessionDefaultGroup } from '@lobechat/types';
1
3
  import { ActionIcon, Dropdown, Icon } from '@lobehub/ui';
2
4
  import { App } from 'antd';
3
5
  import { createStyles } from 'antd-style';
@@ -6,7 +8,6 @@ import isEqual from 'fast-deep-equal';
6
8
  import {
7
9
  Check,
8
10
  ExternalLink,
9
- HardDriveDownload,
10
11
  ListTree,
11
12
  LucideCopy,
12
13
  LucidePlus,
@@ -18,14 +19,11 @@ import {
18
19
  import { memo, useMemo } from 'react';
19
20
  import { useTranslation } from 'react-i18next';
20
21
 
21
- import { isDesktop, isServerMode } from '@/const/version';
22
- import { configService } from '@/services/config';
23
- import { useGlobalStore } from '@/store/global';
24
22
  import { useChatGroupStore } from '@/store/chatGroup';
23
+ import { useGlobalStore } from '@/store/global';
25
24
  import { useSessionStore } from '@/store/session';
26
25
  import { sessionHelpers } from '@/store/session/helpers';
27
26
  import { sessionGroupSelectors, sessionSelectors } from '@/store/session/selectors';
28
- import { SessionDefaultGroup } from '@/types/session';
29
27
 
30
28
  const useStyles = createStyles(({ css }) => ({
31
29
  modalRoot: css`
@@ -148,29 +146,6 @@ const Actions = memo<ActionProps>(({ group, id, openCreateGroupModal, parentType
148
146
  {
149
147
  type: 'divider',
150
148
  },
151
- isServerMode
152
- ? undefined
153
- : {
154
- children: [
155
- {
156
- key: 'agent',
157
- label: t('exportType.agent', { ns: 'common' }),
158
- onClick: () => {
159
- configService.exportSingleAgent(id);
160
- },
161
- },
162
- {
163
- key: 'agentWithMessage',
164
- label: t('exportType.agentWithMessage', { ns: 'common' }),
165
- onClick: () => {
166
- configService.exportSingleSession(id);
167
- },
168
- },
169
- ],
170
- icon: <Icon icon={HardDriveDownload} />,
171
- key: 'export',
172
- label: t('export', { ns: 'common' }),
173
- },
174
149
  {
175
150
  danger: true,
176
151
  icon: <Icon icon={Trash} />,
@@ -2,7 +2,6 @@ import { Suspense } from 'react';
2
2
  import { Flexbox } from 'react-layout-kit';
3
3
 
4
4
  import { isDesktop } from '@/const/version';
5
- import InitClientDB from '@/features/InitClientDB';
6
5
  import ProtocolUrlHandler from '@/features/ProtocolUrlHandler';
7
6
 
8
7
  import { LayoutProps } from '../type';
@@ -22,7 +21,6 @@ const Layout = ({ children, session }: LayoutProps) => {
22
21
  <SessionPanel>{session}</SessionPanel>
23
22
  <Workspace>{children}</Workspace>
24
23
  </Flexbox>
25
- {!isDesktop && <InitClientDB bottom={60} />}
26
24
  {/* ↓ cloud slot ↓ */}
27
25
 
28
26
  {/* ↑ cloud slot ↑ */}
@@ -1,11 +1,10 @@
1
1
  'use client';
2
2
 
3
3
  import { createStyles } from 'antd-style';
4
- import { Suspense, memo } from 'react';
4
+ import { memo } from 'react';
5
5
  import { Flexbox } from 'react-layout-kit';
6
6
 
7
7
  import { withSuspense } from '@/components/withSuspense';
8
- import InitClientDB from '@/features/InitClientDB';
9
8
  import { useShowMobileWorkspace } from '@/hooks/useShowMobileWorkspace';
10
9
 
11
10
  import { LayoutProps } from './type';
@@ -40,9 +39,6 @@ const Layout = memo<LayoutProps>(({ children, session }) => {
40
39
  >
41
40
  {children}
42
41
  </Flexbox>
43
- <Suspense>
44
- <InitClientDB bottom={100} />
45
- </Suspense>
46
42
  </>
47
43
  );
48
44
  });
@@ -1,69 +1,9 @@
1
- import { ActionIcon, Button, Dropdown, type MenuProps } from '@lobehub/ui';
2
- import { HardDriveDownload } from 'lucide-react';
3
- import { memo, useMemo } from 'react';
4
- import { useTranslation } from 'react-i18next';
5
-
6
- import { HEADER_ICON_SIZE } from '@/const/layoutTokens';
7
- import { isServerMode } from '@/const/version';
8
- import { configService } from '@/services/config';
9
- import { useServerConfigStore } from '@/store/serverConfig';
10
- import { useSessionStore } from '@/store/session';
1
+ import { memo } from 'react';
11
2
 
12
3
  import SubmitAgentButton from './SubmitAgentButton';
13
4
 
14
5
  export const HeaderContent = memo<{ mobile?: boolean; modal?: boolean }>(({ modal }) => {
15
- const { t } = useTranslation('setting');
16
- const id = useSessionStore((s) => s.activeId);
17
-
18
- const mobile = useServerConfigStore((s) => s.isMobile);
19
-
20
- const items = useMemo<MenuProps['items']>(
21
- () =>
22
- isServerMode
23
- ? []
24
- : [
25
- {
26
- key: 'agent',
27
- label: <div>{t('exportType.agent', { ns: 'common' })}</div>,
28
- onClick: () => {
29
- if (!id) return;
30
-
31
- configService.exportSingleAgent(id);
32
- },
33
- },
34
- {
35
- key: 'agentWithMessage',
36
- label: <div>{t('exportType.agentWithMessage', { ns: 'common' })}</div>,
37
- onClick: () => {
38
- if (!id) return;
39
-
40
- configService.exportSingleSession(id);
41
- },
42
- },
43
- ],
44
- [],
45
- );
46
-
47
- return (
48
- <>
49
- <SubmitAgentButton modal={modal} />
50
- {!isServerMode && (
51
- <Dropdown arrow={false} menu={{ items }} trigger={['click']}>
52
- {modal ? (
53
- <Button block icon={HardDriveDownload} variant={'filled'}>
54
- {t('export', { ns: 'common' })}
55
- </Button>
56
- ) : (
57
- <ActionIcon
58
- icon={HardDriveDownload}
59
- size={HEADER_ICON_SIZE(mobile)}
60
- title={t('export', { ns: 'common' })}
61
- />
62
- )}
63
- </Dropdown>
64
- )}
65
- </>
66
- );
6
+ return <SubmitAgentButton modal={modal} />;
67
7
  });
68
8
 
69
9
  export default HeaderContent;
@@ -2,7 +2,6 @@ import { Suspense } from 'react';
2
2
 
3
3
  import StructuredData from '@/components/StructuredData';
4
4
  import { BRANDING_NAME } from '@/const/branding';
5
- import InitClientDB from '@/features/InitClientDB';
6
5
  import { ldModule } from '@/server/ld';
7
6
  import { metadataModule } from '@/server/metadata';
8
7
  import { translation } from '@/server/translation';
@@ -34,7 +33,6 @@ const AiImage = async (props: DynamicLayoutProps) => {
34
33
  return (
35
34
  <>
36
35
  <StructuredData ld={ld} />
37
- <InitClientDB bottom={100} />
38
36
  <Suspense fallback={<SkeletonList />}>
39
37
  <ImageWorkspace />
40
38
  </Suspense>
@@ -5,7 +5,6 @@ import { memo, useRef } from 'react';
5
5
  import { useTranslation } from 'react-i18next';
6
6
  import { Flexbox } from 'react-layout-kit';
7
7
 
8
- import InitClientDB from '@/features/InitClientDB';
9
8
  import Footer from '@/features/Setting/Footer';
10
9
  import SettingContainer from '@/features/Setting/SettingContainer';
11
10
  import { useActiveProfileKey } from '@/hooks/useActiveTabKey';
@@ -21,30 +20,30 @@ const Layout = memo<LayoutProps>(({ children, category }) => {
21
20
  const activeKey = useActiveProfileKey();
22
21
 
23
22
  return (
24
- <>
25
- <Flexbox
26
- height={'100%'}
27
- horizontal={md}
28
- ref={ref}
29
- style={{ position: 'relative' }}
30
- width={'100%'}
23
+ <Flexbox
24
+ height={'100%'}
25
+ horizontal={md}
26
+ ref={ref}
27
+ style={{ position: 'relative' }}
28
+ width={'100%'}
29
+ >
30
+ {md ? (
31
+ <SideBar>{category}</SideBar>
32
+ ) : (
33
+ <Header getContainer={() => ref.current} title={<>{t(`tab.${activeKey}`)}</>}>
34
+ {category}
35
+ </Header>
36
+ )}
37
+ <SettingContainer
38
+ addonAfter={<Footer />}
39
+ style={{
40
+ paddingBlock: 24,
41
+ paddingInline: 32,
42
+ }}
31
43
  >
32
- {md ? (
33
- <SideBar>{category}</SideBar>
34
- ) : (
35
- <Header getContainer={() => ref.current} title={<>{t(`tab.${activeKey}`)}</>}>
36
- {category}
37
- </Header>
38
- )}
39
- <SettingContainer
40
- addonAfter={<Footer />}
41
- style={{
42
- paddingBlock: 24,
43
- paddingInline: 32,
44
- }}>{children}</SettingContainer>
45
- </Flexbox>
46
- <InitClientDB />
47
- </>
44
+ {children}
45
+ </SettingContainer>
46
+ </Flexbox>
48
47
  );
49
48
  });
50
49
 
@@ -1,5 +1,4 @@
1
1
  import MobileContentLayout from '@/components/server/MobileNavLayout';
2
- import InitClientDB from '@/features/InitClientDB';
3
2
  import Footer from '@/features/Setting/Footer';
4
3
 
5
4
  import { LayoutProps } from '../type';
@@ -7,14 +6,11 @@ import Header from './Header';
7
6
 
8
7
  const Layout = ({ children }: LayoutProps) => {
9
8
  return (
10
- <>
11
- <MobileContentLayout header={<Header />}>
12
- {children}
13
- <div style={{ flex: 1 }} />
14
- <Footer />
15
- </MobileContentLayout>
16
- <InitClientDB />
17
- </>
9
+ <MobileContentLayout header={<Header />}>
10
+ {children}
11
+ <div style={{ flex: 1 }} />
12
+ <Footer />
13
+ </MobileContentLayout>
18
14
  );
19
15
  };
20
16
 
@@ -5,7 +5,6 @@ import { parseAsStringEnum, useQueryState } from 'nuqs';
5
5
  import { memo, useRef } from 'react';
6
6
  import { Flexbox } from 'react-layout-kit';
7
7
 
8
- import InitClientDB from '@/features/InitClientDB';
9
8
  import SettingContainer from '@/features/Setting/SettingContainer';
10
9
  import { SettingsTabs } from '@/store/global/initialState';
11
10
 
@@ -43,7 +42,6 @@ const Layout = memo<LayoutProps>((props) => {
43
42
  <SettingContainer maxWidth={'none'}>
44
43
  <SettingsContent activeTab={activeTab} mobile={false} showLLM={showLLM} />
45
44
  </SettingContainer>
46
- <InitClientDB />
47
45
  </Flexbox>
48
46
  );
49
47
  });
@@ -3,7 +3,6 @@
3
3
  import { useQueryState } from 'nuqs';
4
4
 
5
5
  import MobileContentLayout from '@/components/server/MobileNavLayout';
6
- import InitClientDB from '@/features/InitClientDB';
7
6
  import Footer from '@/features/Setting/Footer';
8
7
  import { SettingsTabs } from '@/store/global/initialState';
9
8
 
@@ -19,7 +18,6 @@ const Layout = () => {
19
18
  <MobileContentLayout header={<Header />}>
20
19
  <SettingsContent activeTab={activeTab} mobile={true} />
21
20
  <Footer />
22
- <InitClientDB />
23
21
  </MobileContentLayout>
24
22
  );
25
23
  };
@@ -1,11 +1,11 @@
1
1
  import { ProviderCombine, ProviderIcon } from '@lobehub/icons';
2
2
  import { Avatar, Text } from '@lobehub/ui';
3
3
  import { Divider, Skeleton } from 'antd';
4
- import Link from 'next/link';
5
4
  import { memo } from 'react';
6
5
  import { useTranslation } from 'react-i18next';
7
6
  import { Flexbox } from 'react-layout-kit';
8
7
 
8
+ import Link from '@/components/Link';
9
9
  import { AiProviderListItem } from '@/types/aiProvider';
10
10
 
11
11
  import EnableSwitch from './EnableSwitch';
@@ -1,10 +1 @@
1
- import { isServerMode } from '@/const/version';
2
-
3
- import Client from './Client';
4
- import Server from './Server';
5
-
6
- const ScreenLoading = () => (isServerMode ? <Server /> : <Client />);
7
-
8
- ScreenLoading.displayName = 'ScreenLoading';
9
-
10
- export default ScreenLoading;
1
+ export { default } from './Server';
@@ -0,0 +1,12 @@
1
+ import NextLink, { LinkProps as NextLinkProps } from 'next/link';
2
+ import React, { memo } from 'react';
3
+
4
+ interface LinkProps extends NextLinkProps {
5
+ children?: React.ReactNode | undefined;
6
+ }
7
+
8
+ const Link = memo<LinkProps>((props) => {
9
+ return <NextLink {...props} prefetch={false} />;
10
+ });
11
+
12
+ export default Link;
package/src/envs/app.ts CHANGED
@@ -2,8 +2,6 @@
2
2
  import { createEnv } from '@t3-oss/env-nextjs';
3
3
  import { z } from 'zod';
4
4
 
5
- import { isServerMode } from '@/const/version';
6
-
7
5
  declare global {
8
6
  // eslint-disable-next-line @typescript-eslint/no-namespace
9
7
  namespace NodeJS {
@@ -16,12 +14,11 @@ const isInVercel = process.env.VERCEL === '1';
16
14
 
17
15
  const vercelUrl = `https://${process.env.VERCEL_URL}`;
18
16
 
19
- const APP_URL = process.env.APP_URL ? process.env.APP_URL : isInVercel ? vercelUrl : undefined;
20
-
21
- // only throw error in server mode and server side
22
- if (typeof window === 'undefined' && isServerMode && !APP_URL) {
23
- throw new Error('`APP_URL` is required in server mode');
24
- }
17
+ const APP_URL = process.env.APP_URL
18
+ ? process.env.APP_URL
19
+ : isInVercel
20
+ ? vercelUrl
21
+ : 'http://localhost:3010';
25
22
 
26
23
  const ASSISTANT_INDEX_URL = 'https://registry.npmmirror.com/@lobehub/agents-index/v1/files/public';
27
24
 
@@ -9,21 +9,32 @@ import { Center } from 'react-layout-kit';
9
9
 
10
10
  import DataStyleModal from '@/components/DataStyleModal';
11
11
  import { importService } from '@/services/import';
12
- import { ImportResult, ImportResults } from '@/services/import/_deprecated';
13
12
  import { useChatStore } from '@/store/chat';
14
13
  import { useSessionStore } from '@/store/session';
15
14
  import { ImportPgDataStructure } from '@/types/export';
16
- import { ConfigFile } from '@/types/exportConfig';
17
- import { ErrorShape, FileUploadState, ImportStage, OnImportCallbacks } from '@/types/importer';
15
+ import { ErrorShape, FileUploadState, ImportStage } from '@/types/importer';
18
16
 
19
17
  import ImportError from './Error';
20
18
  import { FileUploading } from './FileUploading';
21
19
  import ImportPreviewModal from './ImportDetail';
22
20
  import DataLoading from './Loading';
23
21
  import SuccessResult from './SuccessResult';
24
- import { importConfigFile } from './_deprecated';
25
22
  import { parseConfigFile } from './config';
26
23
 
24
+ export interface ImportResult {
25
+ added: number;
26
+ errors: number;
27
+ skips: number;
28
+ updated?: number;
29
+ }
30
+ export interface ImportResults {
31
+ messages?: ImportResult;
32
+ sessionGroups?: ImportResult;
33
+ sessions?: ImportResult;
34
+ topics?: ImportResult;
35
+ type?: string;
36
+ }
37
+
27
38
  const useStyles = createStyles(({ css }) => ({
28
39
  children: css`
29
40
  &::before {
@@ -157,62 +168,6 @@ const DataImporter = memo<DataImporterProps>(({ children, onFinishImport }) => {
157
168
  const config = await parseConfigFile(file);
158
169
  if (!config) return false;
159
170
 
160
- if (!('schemaHash' in config)) {
161
- // TODO: remove in V2
162
- await importConfigFile(file, async (config) => {
163
- setImportState(ImportStage.Preparing);
164
- console.log(config);
165
-
166
- const importConfigState = async (
167
- config: ConfigFile,
168
- callbacks?: OnImportCallbacks,
169
- ): Promise<void> => {
170
- if (config.exportType === 'settings') {
171
- await importService.importSettings(config.state.settings);
172
- callbacks?.onStageChange?.(ImportStage.Success);
173
- return;
174
- }
175
-
176
- if (config.exportType === 'all') {
177
- await importService.importSettings(config.state.settings);
178
- }
179
-
180
- await importService.importData(
181
- {
182
- messages: (config.state as any).messages || [],
183
- sessionGroups: (config.state as any).sessionGroups || [],
184
- sessions: (config.state as any).sessions || [],
185
- topics: (config.state as any).topics || [],
186
- version: config.version,
187
- },
188
- callbacks,
189
- );
190
- };
191
-
192
- await importConfigState(config, {
193
- onError: (error) => {
194
- setImportError(error);
195
- },
196
- onFileUploading: (state) => {
197
- setUploadingState(state);
198
- },
199
- onStageChange: (stage) => {
200
- setImportState(stage);
201
- },
202
- onSuccess: (data, duration) => {
203
- if (data) setImportResults(data);
204
- setDuration(duration);
205
- },
206
- });
207
-
208
- await refreshSessions();
209
- await refreshMessages();
210
- await refreshTopics();
211
- });
212
-
213
- return false;
214
- }
215
-
216
171
  setImportPgData(config);
217
172
  setShowImportModal(true);
218
173
 
@@ -25,7 +25,8 @@ export const useTableColumns = (tableName?: string) => {
25
25
  export const usePgTable = (tableName?: string) => {
26
26
  const isDBInited = useGlobalStore(systemStatusSelectors.isDBInited);
27
27
 
28
- return useSWR(isDBInited && tableName ? FETCH_TABLE_DATA_KEY(tableName) : null, ([, table]) =>
29
- tableViewerService.getTableData(table),
28
+ return useSWR(
29
+ isDBInited && tableName ? FETCH_TABLE_DATA_KEY(tableName) : null,
30
+ ([, table]) => tableViewerService.getTableData(table) as any,
30
31
  );
31
32
  };