@lobehub/chat 1.77.5 → 1.77.7

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 (73) hide show
  1. package/.github/scripts/pr-comment.js +80 -0
  2. package/.github/scripts/pr-release-body.js +59 -0
  3. package/.github/workflows/release-desktop.yml +331 -0
  4. package/.github/workflows/test.yml +1 -1
  5. package/CHANGELOG.md +50 -0
  6. package/changelog/v1.json +18 -0
  7. package/next.config.ts +16 -11
  8. package/package.json +92 -89
  9. package/packages/electron-client-ipc/README.md +48 -0
  10. package/packages/electron-client-ipc/package.json +7 -0
  11. package/packages/electron-client-ipc/src/events/devtools.ts +6 -0
  12. package/packages/electron-client-ipc/src/events/index.ts +13 -0
  13. package/packages/electron-client-ipc/src/index.ts +2 -0
  14. package/packages/electron-client-ipc/src/types/dispatch.ts +10 -0
  15. package/packages/electron-client-ipc/src/types/index.ts +1 -0
  16. package/packages/electron-server-ipc/README.md +1 -1
  17. package/pnpm-workspace.yaml +1 -0
  18. package/scripts/setup-test-postgres-db.sh +21 -0
  19. package/src/app/desktop/devtools/page.tsx +89 -0
  20. package/src/app/desktop/layout.tsx +31 -0
  21. package/src/app/layout.tsx +11 -0
  22. package/src/app/not-found.tsx +1 -0
  23. package/src/const/desktop.ts +1 -0
  24. package/src/const/version.ts +2 -0
  25. package/src/database/client/db.ts +3 -10
  26. package/src/database/core/db-adaptor.ts +20 -2
  27. package/src/database/models/__tests__/aiProvider.test.ts +2 -0
  28. package/src/database/models/__tests__/message.test.ts +97 -26
  29. package/src/database/models/__tests__/session.test.ts +2 -0
  30. package/src/database/models/drizzleMigration.ts +15 -0
  31. package/src/database/models/message.ts +10 -5
  32. package/src/database/models/session.ts +8 -0
  33. package/src/database/models/user.ts +10 -1
  34. package/src/database/server/index.ts +1 -1
  35. package/src/features/DevPanel/features/FloatPanel.tsx +23 -6
  36. package/src/features/User/UserPanel/index.tsx +10 -6
  37. package/src/libs/trpc/async/index.ts +11 -1
  38. package/src/libs/trpc/lambda/index.ts +1 -0
  39. package/src/libs/trpc/lambda/serverDatabase.ts +10 -0
  40. package/src/libs/trpc/middleware/userAuth.ts +10 -0
  41. package/src/server/routers/async/file.ts +4 -5
  42. package/src/server/routers/async/ragEval.ts +3 -4
  43. package/src/server/routers/lambda/_template.ts +3 -5
  44. package/src/server/routers/lambda/agent.ts +8 -8
  45. package/src/server/routers/lambda/aiModel.ts +5 -5
  46. package/src/server/routers/lambda/aiProvider.test.ts +0 -2
  47. package/src/server/routers/lambda/aiProvider.ts +5 -5
  48. package/src/server/routers/lambda/chunk.ts +18 -15
  49. package/src/server/routers/lambda/exporter.ts +4 -4
  50. package/src/server/routers/lambda/file.ts +5 -5
  51. package/src/server/routers/lambda/importer.ts +3 -3
  52. package/src/server/routers/lambda/knowledgeBase.ts +3 -3
  53. package/src/server/routers/lambda/message.ts +5 -3
  54. package/src/server/routers/lambda/plugin.ts +5 -3
  55. package/src/server/routers/lambda/ragEval.ts +17 -14
  56. package/src/server/routers/lambda/session.ts +6 -4
  57. package/src/server/routers/lambda/sessionGroup.ts +3 -3
  58. package/src/server/routers/lambda/thread.ts +4 -4
  59. package/src/server/routers/lambda/topic.ts +5 -3
  60. package/src/server/routers/lambda/user.ts +7 -7
  61. package/src/server/routers/tools/__tests__/search.test.ts +1 -0
  62. package/src/server/services/nextAuthUser/index.test.ts +1 -2
  63. package/src/server/translation.test.ts +72 -52
  64. package/src/server/translation.ts +2 -11
  65. package/src/services/electron/devtools.ts +9 -0
  66. package/src/styles/electron.ts +14 -0
  67. package/src/tools/web-browsing/Portal/Search/ResultList/SearchItem/index.tsx +3 -8
  68. package/src/tools/web-browsing/Render/Search/SearchResult/ShowMore.tsx +2 -4
  69. package/src/types/electron.ts +11 -0
  70. package/src/utils/electron/dispatch.ts +10 -0
  71. package/tsconfig.json +6 -6
  72. package/vitest.config.ts +3 -1
  73. package/vitest.server.config.ts +7 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "1.77.5",
3
+ "version": "1.77.7",
4
4
  "description": "Lobe Chat - an open-source, high-performance chatbot 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",
@@ -35,6 +35,7 @@
35
35
  "build-sitemap": "tsx ./scripts/buildSitemapIndex/index.ts",
36
36
  "build:analyze": "ANALYZE=true next build",
37
37
  "build:docker": "DOCKER=true next build && npm run build-sitemap",
38
+ "build:electron": "NODE_OPTIONS=--max-old-space-size=6144 NEXT_PUBLIC_IS_DESKTOP_APP=1 next build ",
38
39
  "db:generate": "drizzle-kit generate && npm run db:generate-client && npm run workflow:dbml",
39
40
  "db:generate-client": "tsx ./scripts/migrateClientDB/compile-migrations.ts",
40
41
  "db:migrate": "MIGRATION_DB=1 tsx ./scripts/migrateServerDB/index.ts",
@@ -107,53 +108,55 @@
107
108
  ]
108
109
  },
109
110
  "dependencies": {
110
- "@ant-design/icons": "^5.5.2",
111
- "@ant-design/pro-components": "^2.8.3",
111
+ "@ant-design/icons": "^5.6.1",
112
+ "@ant-design/pro-components": "^2.8.7",
112
113
  "@anthropic-ai/sdk": "^0.39.0",
113
114
  "@auth/core": "^0.38.0",
114
- "@aws-sdk/client-bedrock-runtime": "^3.723.0",
115
- "@aws-sdk/client-s3": "^3.723.0",
116
- "@aws-sdk/s3-request-presigner": "^3.723.0",
115
+ "@aws-sdk/client-bedrock-runtime": "^3.779.0",
116
+ "@aws-sdk/client-s3": "^3.779.0",
117
+ "@aws-sdk/s3-request-presigner": "^3.779.0",
117
118
  "@azure-rest/ai-inference": "1.0.0-beta.5",
118
119
  "@azure/core-auth": "^1.9.0",
119
- "@cfworker/json-schema": "^4.1.0",
120
- "@clerk/localizations": "^3.9.6",
121
- "@clerk/nextjs": "^6.10.6",
122
- "@clerk/themes": "^2.2.4",
123
- "@codesandbox/sandpack-react": "^2.19.10",
120
+ "@cfworker/json-schema": "^4.1.1",
121
+ "@clerk/localizations": "^3.13.4",
122
+ "@clerk/nextjs": "^6.12.12",
123
+ "@clerk/themes": "^2.2.26",
124
+ "@codesandbox/sandpack-react": "^2.20.0",
124
125
  "@cyntler/react-doc-viewer": "^1.17.0",
125
126
  "@electric-sql/pglite": "0.2.17",
126
- "@google-cloud/vertexai": "^1.9.2",
127
+ "@google-cloud/vertexai": "^1.9.3",
127
128
  "@google/generative-ai": "^0.24.0",
128
129
  "@huggingface/inference": "^2.8.1",
129
130
  "@icons-pack/react-simple-icons": "9.6.0",
130
131
  "@khmyznikov/pwa-install": "0.3.9",
131
- "@langchain/community": "^0.3.37",
132
+ "@langchain/community": "^0.3.38",
133
+ "@lobechat/electron-client-ipc": "workspace:*",
134
+ "@lobechat/electron-server-ipc": "workspace:*",
132
135
  "@lobechat/web-crawler": "workspace:*",
133
136
  "@lobehub/charts": "^1.12.0",
134
137
  "@lobehub/chat-plugin-sdk": "^1.32.4",
135
138
  "@lobehub/chat-plugins-gateway": "^1.9.0",
136
- "@lobehub/icons": "^1.73.1",
137
- "@lobehub/tts": "^1.28.0",
138
- "@lobehub/ui": "^1.169.2",
139
+ "@lobehub/icons": "^1.95.0",
140
+ "@lobehub/tts": "^1.28.3",
141
+ "@lobehub/ui": "^1.170.8",
139
142
  "@neondatabase/serverless": "^1.0.0",
140
143
  "@next/third-parties": "15.2.3",
141
144
  "@react-spring/web": "^9.7.5",
142
- "@sentry/nextjs": "^7.120.2",
143
- "@serwist/next": "^9.0.11",
145
+ "@sentry/nextjs": "^7.120.3",
146
+ "@serwist/next": "^9.0.12",
144
147
  "@t3-oss/env-nextjs": "^0.12.0",
145
- "@tanstack/react-query": "^5.62.16",
146
- "@trpc/client": "next",
147
- "@trpc/next": "next",
148
- "@trpc/react-query": "next",
149
- "@trpc/server": "next",
150
- "@vercel/analytics": "^1.4.1",
148
+ "@tanstack/react-query": "^5.71.3",
149
+ "@trpc/client": "^11.0.1",
150
+ "@trpc/next": "^11.0.1",
151
+ "@trpc/react-query": "^11.0.1",
152
+ "@trpc/server": "^11.0.1",
153
+ "@vercel/analytics": "^1.5.0",
151
154
  "@vercel/edge-config": "^1.4.0",
152
- "@vercel/functions": "^2",
153
- "@vercel/speed-insights": "^1.1.0",
155
+ "@vercel/functions": "^2.0.0",
156
+ "@vercel/speed-insights": "^1.2.0",
154
157
  "ahooks": "^3.8.4",
155
158
  "ai": "^3.4.33",
156
- "antd": "^5.24.4",
159
+ "antd": "^5.24.6",
157
160
  "antd-style": "^3.7.1",
158
161
  "brotli-wasm": "^3.0.1",
159
162
  "chroma-js": "^3.1.2",
@@ -166,74 +169,74 @@
166
169
  "drizzle-zod": "^0.5.1",
167
170
  "epub2": "^3.0.2",
168
171
  "fast-deep-equal": "^3.1.3",
169
- "file-type": "^20.0.0",
170
- "framer-motion": "^12.0.0",
171
- "gpt-tokenizer": "^2.8.1",
172
+ "file-type": "^20.4.1",
173
+ "framer-motion": "^12.6.3",
174
+ "gpt-tokenizer": "^2.9.0",
172
175
  "html-to-text": "^9.0.5",
173
- "i18next": "^24.2.1",
174
- "i18next-browser-languagedetector": "^8.0.2",
176
+ "i18next": "^24.2.3",
177
+ "i18next-browser-languagedetector": "^8.0.4",
175
178
  "i18next-resources-to-backend": "^1.2.1",
176
179
  "idb-keyval": "^6.2.1",
177
180
  "immer": "^10.1.1",
178
181
  "jose": "^5.10.0",
179
182
  "js-sha256": "^0.11.0",
180
183
  "jsonl-parse-stringify": "^1.0.3",
181
- "langchain": "^0.3.10",
184
+ "langchain": "^0.3.19",
182
185
  "langfuse": "3.29.1",
183
186
  "langfuse-core": "3.29.1",
184
187
  "lodash-es": "^4.17.21",
185
188
  "lucide-react": "^0.485.0",
186
189
  "mammoth": "^1.9.0",
187
190
  "mdast-util-to-markdown": "^2.1.2",
188
- "modern-screenshot": "^4.5.5",
189
- "nanoid": "^5.0.9",
191
+ "modern-screenshot": "^4.6.0",
192
+ "nanoid": "^5.1.5",
190
193
  "next": "15.2.3",
191
194
  "next-auth": "beta",
192
195
  "next-mdx-remote": "^5.0.0",
193
- "nextjs-toploader": "^3.7.15",
196
+ "nextjs-toploader": "^3.8.16",
194
197
  "numeral": "^2.0.6",
195
198
  "nuqs": "^2.4.1",
196
199
  "officeparser": "^5.1.1",
197
- "ollama": "^0.5.11",
198
- "openai": "^4.77.3",
200
+ "ollama": "^0.5.14",
201
+ "openai": "^4.91.1",
199
202
  "openapi-fetch": "^0.9.8",
200
203
  "partial-json": "^0.1.7",
201
204
  "pdf-parse": "^1.1.1",
202
205
  "pdfjs-dist": "4.8.69",
203
- "pg": "^8.13.1",
206
+ "pg": "^8.14.1",
204
207
  "pino": "^9.6.0",
205
208
  "plaiceholder": "^3.0.0",
206
209
  "polished": "^4.3.1",
207
- "posthog-js": "^1.205.0",
210
+ "posthog-js": "^1.234.6",
208
211
  "pwa-install-handler": "^2.6.2",
209
212
  "query-string": "^9.1.1",
210
213
  "random-words": "^2.0.1",
211
- "react": "^19.0.0",
212
- "react-confetti": "^6.2.2",
213
- "react-dom": "^19.0.0",
214
+ "react": "^19.1.0",
215
+ "react-confetti": "^6.4.0",
216
+ "react-dom": "^19.1.0",
214
217
  "react-fast-marquee": "^1.6.5",
215
218
  "react-hotkeys-hook": "^4.6.1",
216
- "react-i18next": "^15.4.0",
219
+ "react-i18next": "^15.4.1",
217
220
  "react-layout-kit": "^1.9.1",
218
221
  "react-lazy-load": "^4.0.1",
219
222
  "react-pdf": "^9.2.1",
220
- "react-rnd": "^10.4.14",
221
- "react-scan": "^0.3.0",
222
- "react-virtuoso": "^4.12.3",
223
+ "react-rnd": "^10.5.2",
224
+ "react-scan": "^0.3.3",
225
+ "react-virtuoso": "^4.12.6",
223
226
  "react-wrap-balancer": "^1.1.1",
224
227
  "remark": "^15.0.1",
225
- "remark-gfm": "^4.0.0",
228
+ "remark-gfm": "^4.0.1",
226
229
  "remark-html": "^16.0.1",
227
230
  "request-filtering-agent": "^2.0.1",
228
- "resolve-accept-language": "^3.1.10",
231
+ "resolve-accept-language": "^3.1.11",
229
232
  "rtl-detect": "^1.1.2",
230
- "semver": "^7.6.3",
233
+ "semver": "^7.7.1",
231
234
  "sharp": "^0.33.5",
232
235
  "shiki": "^3.2.1",
233
236
  "stripe": "^16.12.0",
234
237
  "superjson": "^2.2.2",
235
- "svix": "^1.59.1",
236
- "swr": "^2.3.0",
238
+ "svix": "^1.63.0",
239
+ "swr": "^2.3.3",
237
240
  "systemjs": "^6.15.1",
238
241
  "ts-md5": "^1.3.1",
239
242
  "ua-parser-js": "^1.0.40",
@@ -241,93 +244,93 @@
241
244
  "url-join": "^5.0.0",
242
245
  "use-merge-value": "^1.2.0",
243
246
  "utility-types": "^3.11.0",
244
- "uuid": "^11.0.4",
245
- "ws": "^8.18.0",
247
+ "uuid": "^11.1.0",
248
+ "ws": "^8.18.1",
246
249
  "y-protocols": "^1.0.6",
247
250
  "y-webrtc": "^10.3.0",
248
- "yaml": "^2.7.0",
249
- "yjs": "^13.6.21",
250
- "zod": "^3.24.1",
251
+ "yaml": "^2.7.1",
252
+ "yjs": "^13.6.24",
253
+ "zod": "^3.24.2",
251
254
  "zustand": "^5.0.3",
252
- "zustand-utils": "^2"
255
+ "zustand-utils": "^2.1.0"
253
256
  },
254
257
  "devDependencies": {
255
- "@commitlint/cli": "^19.6.1",
258
+ "@commitlint/cli": "^19.8.0",
256
259
  "@edge-runtime/vm": "^5.0.0",
257
- "@huggingface/tasks": "^0.15.0",
260
+ "@huggingface/tasks": "^0.15.9",
258
261
  "@lobehub/i18n-cli": "^1.20.3",
259
- "@lobehub/lint": "^1.25.5",
262
+ "@lobehub/lint": "^1.26.1",
260
263
  "@lobehub/seo-cli": "^1.4.3",
261
264
  "@next/bundle-analyzer": "15.2.3",
262
265
  "@next/eslint-plugin-next": "15.2.3",
263
266
  "@peculiar/webcrypto": "^1.5.0",
264
267
  "@semantic-release/exec": "^6.0.3",
265
268
  "@testing-library/jest-dom": "^6.6.3",
266
- "@testing-library/react": "^16.1.0",
269
+ "@testing-library/react": "^16.3.0",
267
270
  "@testing-library/user-event": "^14.6.1",
268
- "@types/chroma-js": "^3.1.0",
271
+ "@types/chroma-js": "^3.1.1",
269
272
  "@types/crypto-js": "^4.2.2",
270
273
  "@types/debug": "^4.1.12",
271
- "@types/diff": "^7.0.0",
274
+ "@types/diff": "^7.0.2",
272
275
  "@types/fs-extra": "^11.0.4",
273
276
  "@types/ip": "^1.1.3",
274
277
  "@types/json-schema": "^7.0.15",
275
- "@types/lodash": "^4.17.14",
278
+ "@types/lodash": "^4.17.16",
276
279
  "@types/lodash-es": "^4.17.12",
277
- "@types/node": "^22.10.5",
280
+ "@types/node": "^22.13.17",
278
281
  "@types/numeral": "^2.0.5",
279
- "@types/pg": "^8.11.10",
280
- "@types/react": "^19.0.10",
281
- "@types/react-dom": "^19.0.4",
282
+ "@types/pg": "^8.11.11",
283
+ "@types/react": "^19.1.0",
284
+ "@types/react-dom": "^19.1.1",
282
285
  "@types/rtl-detect": "^1.0.3",
283
- "@types/semver": "^7.5.8",
284
- "@types/systemjs": "^6.15.1",
286
+ "@types/semver": "^7.7.0",
287
+ "@types/systemjs": "^6.15.3",
285
288
  "@types/ua-parser-js": "^0.7.39",
286
289
  "@types/unist": "^3.0.3",
287
290
  "@types/uuid": "^10.0.0",
288
- "@types/ws": "^8.5.13",
289
- "@vitest/coverage-v8": "^3.0.9",
291
+ "@types/ws": "^8.18.1",
292
+ "@vitest/coverage-v8": "^3.1.1",
290
293
  "ajv-keywords": "^5.1.0",
291
- "commitlint": "^19.6.1",
292
- "consola": "^3.3.3",
294
+ "commitlint": "^19.8.0",
295
+ "consola": "^3.4.2",
293
296
  "crypto-js": "^4.2.0",
294
297
  "dbdocs": "^0.14.3",
295
298
  "dotenv": "^16.4.7",
296
299
  "dpdm-fast": "^1.0.7",
297
300
  "drizzle-dbml-generator": "^0.10.0",
298
- "drizzle-kit": "^0.30.1",
301
+ "drizzle-kit": "^0.30.6",
299
302
  "eslint": "^8.57.1",
300
- "eslint-plugin-mdx": "^3.1.5",
303
+ "eslint-plugin-mdx": "^3.3.1",
301
304
  "fake-indexeddb": "^6.0.0",
302
- "fs-extra": "^11.2.0",
303
- "glob": "^11.0.0",
305
+ "fs-extra": "^11.3.0",
306
+ "glob": "^11.0.1",
304
307
  "gray-matter": "^4.0.3",
305
- "happy-dom": "^17.0.0",
308
+ "happy-dom": "^17.4.4",
306
309
  "husky": "^9.1.7",
307
310
  "just-diff": "^6.0.2",
308
- "lint-staged": "^15.3.0",
311
+ "lint-staged": "^15.5.0",
309
312
  "lodash": "^4.17.21",
310
313
  "markdown-table": "^3.0.4",
311
314
  "markdown-to-txt": "^2.0.1",
312
315
  "mime": "^4.0.6",
313
316
  "node-fetch": "^3.3.2",
314
- "node-gyp": "^11.0.0",
315
- "openapi-typescript": "^7.5.2",
317
+ "node-gyp": "^11.2.0",
318
+ "openapi-typescript": "^7.6.1",
316
319
  "p-map": "^7.0.3",
317
- "prettier": "^3.4.2",
320
+ "prettier": "^3.5.3",
318
321
  "remark-cli": "^12.0.1",
319
322
  "remark-frontmatter": "^5.0.0",
320
323
  "remark-mdx": "^3.1.0",
321
324
  "remark-parse": "^11.0.0",
322
325
  "semantic-release": "^21.1.2",
323
- "serwist": "^9.0.11",
326
+ "serwist": "^9.0.12",
324
327
  "stylelint": "^15.11.0",
325
- "tsx": "^4.19.2",
326
- "typescript": "^5.7.2",
328
+ "tsx": "^4.19.3",
329
+ "typescript": "^5.8.2",
327
330
  "unified": "^11.0.5",
328
331
  "unist-util-visit": "^5.0.0",
329
- "vite": "^5.4.11",
330
- "vitest": "^3.0.9",
332
+ "vite": "^5.4.16",
333
+ "vitest": "^3.1.1",
331
334
  "vitest-canvas-mock": "^0.3.3"
332
335
  },
333
336
  "packageManager": "pnpm@9.15.9",
@@ -0,0 +1,48 @@
1
+ # @lobechat/electron-client-ipc
2
+
3
+ 这个包是 LobeChat 在 Electron 环境中用于处理 IPC(进程间通信)的客户端工具包。
4
+
5
+ ## 介绍
6
+
7
+ 在 Electron 应用中,IPC(进程间通信)是连接主进程(Main Process)、渲染进程(Renderer Process)以及 NextJS 进程的桥梁。为了更好地组织和管理这些通信,我们将 IPC 相关的代码分成了两个包:
8
+
9
+ - `@lobechat/electron-client-ipc`:**客户端 IPC 包**
10
+ - `@lobechat/electron-server-ipc`:**服务端 IPC 包**
11
+
12
+ ## 主要区别
13
+
14
+ ### electron-client-ipc(本包)
15
+
16
+ - 运行环境:在渲染进程(Renderer Process)中运行
17
+ - 主要职责:
18
+ - 提供渲染进程调用主进程方法的接口定义
19
+ - 封装 `ipcRenderer.invoke` 相关方法
20
+ - 处理与主进程的通信请求
21
+
22
+ ### electron-server-ipc
23
+
24
+ - 运行环境:在 Electron 主进程和 Next.js 服务端进程中运行
25
+ - 主要职责:
26
+ - 提供基于 Socket 的 IPC 通信机制
27
+ - 实现服务端(ElectronIPCServer)和客户端(ElectronIpcClient)通信组件
28
+ - 处理跨进程的请求和响应
29
+ - 提供自动重连和错误处理机制
30
+ - 确保类型安全的 API 调用
31
+
32
+ ## 使用场景
33
+
34
+ 当渲染进程需要:
35
+
36
+ - 访问系统 API
37
+ - 进行文件操作
38
+ - 调用主进程特定功能
39
+
40
+ 时,都需要通过 `electron-client-ipc` 包提供的方法来发起请求。
41
+
42
+ ## 技术说明
43
+
44
+ 这种分包设计遵循了关注点分离原则,使得:
45
+
46
+ - IPC 通信接口清晰可维护
47
+ - 客户端和服务端代码解耦
48
+ - TypeScript 类型定义共享,确保类型安全
@@ -0,0 +1,7 @@
1
+ {
2
+ "name": "@lobechat/electron-client-ipc",
3
+ "version": "1.0.0",
4
+ "private": true,
5
+ "main": "src/index.ts",
6
+ "types": "src/index.ts"
7
+ }
@@ -0,0 +1,6 @@
1
+ export interface DevtoolsDispatchEvents {
2
+ /**
3
+ * open the LobeHub Devtools
4
+ */
5
+ openDevtools: () => void;
6
+ }
@@ -0,0 +1,13 @@
1
+ import { DevtoolsDispatchEvents } from './devtools';
2
+
3
+ /**
4
+ * renderer -> main dispatch events
5
+ */
6
+ // eslint-disable-next-line @typescript-eslint/no-empty-interface
7
+ export interface ClientDispatchEvents extends DevtoolsDispatchEvents {}
8
+
9
+ export type ClientDispatchEventKey = keyof ClientDispatchEvents;
10
+
11
+ export type ClientEventReturnType<T extends ClientDispatchEventKey> = ReturnType<
12
+ ClientDispatchEvents[T]
13
+ >;
@@ -0,0 +1,2 @@
1
+ export * from './events';
2
+ export * from './types';
@@ -0,0 +1,10 @@
1
+ import type {
2
+ ClientDispatchEventKey,
3
+ ClientDispatchEvents,
4
+ ClientEventReturnType,
5
+ } from '../events';
6
+
7
+ export type DispatchInvoke = <T extends ClientDispatchEventKey>(
8
+ event: T,
9
+ ...data: Parameters<ClientDispatchEvents[T]>
10
+ ) => Promise<ClientEventReturnType<T>>;
@@ -0,0 +1 @@
1
+ export * from './dispatch';
@@ -4,7 +4,7 @@ LobeHub 的 Electron 应用与服务端之间的 IPC(进程间通信)模块
4
4
 
5
5
  ## 📝 简介
6
6
 
7
- `@lobechat/electron-server-ipc` 是 LobeHub 桌面应用的核心组件,负责处理 Electron 进程与 nextjs 服务端之间的通信。它提供了一套简单而健壮的 API,用于在不同进程间传递数据和执行远程方法调用。
7
+ `@lobechat/electron-server-ipc` 是 LobeHub 桌面应用的核心组件,负责处理 Electron 主进程与 nextjs 服务端之间的通信。它提供了一套简单而健壮的 API,用于在不同进程间传递数据和执行远程方法调用。
8
8
 
9
9
  ## 🛠️ 核心功能
10
10
 
@@ -1,3 +1,4 @@
1
1
  packages:
2
2
  - 'packages/**'
3
3
  - '.'
4
+ - '!apps/**'
@@ -0,0 +1,21 @@
1
+ #!/bin/bash
2
+
3
+ # 停止并删除已存在的容器
4
+ docker stop postgres-paradedb 2>/dev/null && docker rm postgres-paradedb 2>/dev/null
5
+
6
+ # 启动pgvector容器
7
+ docker run --name postgres-paradedb \
8
+ -e POSTGRES_PASSWORD=mysecretpassword \
9
+ -e POSTGRES_DB=postgres \
10
+ -p 5432:5432 \
11
+ -d paradedb/paradedb:latest
12
+
13
+ # 等待PostgreSQL启动
14
+ echo "等待PostgreSQL完全启动..."
15
+ sleep 5
16
+
17
+ # 确保postgres用户存在且有适当权限
18
+ docker exec postgres-pgvector psql -U postgres -c "\du"
19
+
20
+ echo "✅ PostgreSQL with paradedb 已成功启动,并配置好了 postgres 用户"
21
+ echo "连接字符串: postgres://postgres:mysecretpassword@localhost:5432/postgres"
@@ -0,0 +1,89 @@
1
+ 'use client';
2
+
3
+ import { ActionIcon, FluentEmoji, SideNav } from '@lobehub/ui';
4
+ import { Cog, DatabaseIcon } from 'lucide-react';
5
+ import { memo, useState } from 'react';
6
+ import { Flexbox } from 'react-layout-kit';
7
+
8
+ import { BRANDING_NAME } from '@/const/branding';
9
+ import PostgresViewer from '@/features/DevPanel/PostgresViewer';
10
+ import SystemInspector from '@/features/DevPanel/SystemInspector';
11
+ import { useStyles } from '@/features/DevPanel/features/FloatPanel';
12
+ import { electronStylish } from '@/styles/electron';
13
+
14
+ const DevTools = memo(() => {
15
+ const { styles, theme, cx } = useStyles();
16
+
17
+ const items = [
18
+ {
19
+ children: <PostgresViewer />,
20
+ icon: <DatabaseIcon size={16} />,
21
+ key: 'Postgres Viewer',
22
+ },
23
+ {
24
+ children: <SystemInspector />,
25
+ icon: <Cog size={16} />,
26
+ key: 'System Status',
27
+ },
28
+ ];
29
+
30
+ const [tab, setTab] = useState<string>(items[0].key);
31
+
32
+ return (
33
+ <Flexbox
34
+ height={'100%'}
35
+ horizontal
36
+ style={{ overflow: 'hidden', position: 'relative' }}
37
+ width={'100%'}
38
+ >
39
+ <SideNav
40
+ avatar={<FluentEmoji emoji={'🧰'} size={24} />}
41
+ bottomActions={[]}
42
+ style={{
43
+ paddingBlock: 32,
44
+ width: 48,
45
+ }}
46
+ topActions={items.map((item) => (
47
+ <ActionIcon
48
+ active={tab === item.key}
49
+ key={item.key}
50
+ onClick={() => setTab(item.key)}
51
+ placement={'right'}
52
+ title={item.key}
53
+ >
54
+ {item.icon}
55
+ </ActionIcon>
56
+ ))}
57
+ />
58
+ <Flexbox height={'100%'} style={{ overflow: 'hidden', position: 'relative' }} width={'100%'}>
59
+ <Flexbox
60
+ align={'center'}
61
+ className={cx(`panel-drag-handle`, styles.header, electronStylish.draggable)}
62
+ horizontal
63
+ justify={'center'}
64
+ >
65
+ <Flexbox align={'baseline'} gap={6} horizontal>
66
+ <b>{BRANDING_NAME} Dev Tools</b>
67
+ <span style={{ color: theme.colorTextDescription }}>/</span>
68
+ <span style={{ color: theme.colorTextDescription }}>{tab}</span>
69
+ </Flexbox>
70
+ </Flexbox>
71
+ {items.map((item) => (
72
+ <Flexbox
73
+ flex={1}
74
+ height={'100%'}
75
+ key={item.key}
76
+ style={{
77
+ display: tab === item.key ? 'flex' : 'none',
78
+ overflow: 'hidden',
79
+ }}
80
+ >
81
+ {item.children}
82
+ </Flexbox>
83
+ ))}
84
+ </Flexbox>
85
+ </Flexbox>
86
+ );
87
+ });
88
+
89
+ export default DevTools;
@@ -0,0 +1,31 @@
1
+ import { notFound } from 'next/navigation';
2
+ import { NuqsAdapter } from 'nuqs/adapters/next/app';
3
+ import { ReactNode } from 'react';
4
+
5
+ import { isDesktop } from '@/const/version';
6
+ import GlobalLayout from '@/layout/GlobalProvider';
7
+ import { ServerConfigStoreProvider } from '@/store/serverConfig/Provider';
8
+
9
+ interface RootLayoutProps {
10
+ children: ReactNode;
11
+ }
12
+
13
+ const RootLayout = async ({ children }: RootLayoutProps) => {
14
+ if (!isDesktop) return notFound();
15
+
16
+ return (
17
+ <html dir="ltr" suppressHydrationWarning>
18
+ <body>
19
+ <NuqsAdapter>
20
+ <ServerConfigStoreProvider>
21
+ <GlobalLayout appearance={'auto'} isMobile={false} locale={''}>
22
+ {children}
23
+ </GlobalLayout>
24
+ </ServerConfigStoreProvider>
25
+ </NuqsAdapter>
26
+ </body>
27
+ </html>
28
+ );
29
+ };
30
+
31
+ export default RootLayout;
@@ -0,0 +1,11 @@
1
+ import { PropsWithChildren } from 'react';
2
+
3
+ const Layout = ({ children }: PropsWithChildren) => {
4
+ return (
5
+ <html>
6
+ <body>{children}</body>
7
+ </html>
8
+ );
9
+ };
10
+
11
+ export default Layout;
@@ -0,0 +1 @@
1
+ export { default } from '@/components/404';
@@ -0,0 +1 @@
1
+ export const DESKTOP_USER_ID = 'DEFAULT_DESKTOP_USER';
@@ -7,6 +7,8 @@ export const CURRENT_VERSION = pkg.version;
7
7
  export const isServerMode = process.env.NEXT_PUBLIC_SERVICE_MODE === 'server';
8
8
  export const isUsePgliteDB = process.env.NEXT_PUBLIC_CLIENT_DB === 'pglite';
9
9
 
10
+ export const isDesktop = process.env.NEXT_PUBLIC_IS_DESKTOP_APP === '1';
11
+
10
12
  export const isDeprecatedEdition = !isServerMode && !isUsePgliteDB;
11
13
 
12
14
  // @ts-ignore
@@ -167,17 +167,10 @@ export class DatabaseManager {
167
167
  // if hash is the same, no need to migrate
168
168
  if (hash === cacheHash) {
169
169
  try {
170
+ const drizzleMigration = new DrizzleMigrationModel(this.db as any);
171
+
170
172
  // 检查数据库中是否存在表
171
- // 这里使用 pg_tables 系统表查询用户表数量
172
- const tablesResult = await this.db.execute(
173
- sql`
174
- SELECT COUNT(*) as table_count
175
- FROM information_schema.tables
176
- WHERE table_schema = 'public'
177
- `,
178
- );
179
-
180
- const tableCount = parseInt((tablesResult.rows[0] as any).table_count || '0', 10);
173
+ const tableCount = await drizzleMigration.getTableCounts();
181
174
 
182
175
  // 如果表数量大于0,则认为数据库已正确初始化
183
176
  if (tableCount > 0) {