@lobehub/chat 1.84.5 → 1.84.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 (63) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/apps/desktop/Development.md +466 -18
  3. package/apps/desktop/README.md +60 -0
  4. package/changelog/v1.json +18 -0
  5. package/locales/ar/error.json +4 -1
  6. package/locales/ar/plugin.json +8 -0
  7. package/locales/bg-BG/error.json +4 -1
  8. package/locales/bg-BG/plugin.json +8 -0
  9. package/locales/de-DE/error.json +4 -1
  10. package/locales/de-DE/plugin.json +8 -0
  11. package/locales/en-US/error.json +4 -1
  12. package/locales/en-US/plugin.json +8 -0
  13. package/locales/es-ES/error.json +4 -1
  14. package/locales/es-ES/plugin.json +8 -0
  15. package/locales/fa-IR/error.json +4 -1
  16. package/locales/fa-IR/plugin.json +8 -0
  17. package/locales/fr-FR/error.json +4 -1
  18. package/locales/fr-FR/plugin.json +8 -0
  19. package/locales/it-IT/error.json +4 -1
  20. package/locales/it-IT/plugin.json +8 -0
  21. package/locales/ja-JP/error.json +4 -1
  22. package/locales/ja-JP/plugin.json +8 -0
  23. package/locales/ko-KR/error.json +4 -1
  24. package/locales/ko-KR/plugin.json +8 -0
  25. package/locales/nl-NL/error.json +4 -1
  26. package/locales/nl-NL/plugin.json +8 -0
  27. package/locales/pl-PL/error.json +4 -1
  28. package/locales/pl-PL/plugin.json +8 -0
  29. package/locales/pt-BR/error.json +4 -1
  30. package/locales/pt-BR/plugin.json +8 -0
  31. package/locales/ru-RU/error.json +4 -1
  32. package/locales/ru-RU/plugin.json +8 -0
  33. package/locales/tr-TR/error.json +4 -1
  34. package/locales/tr-TR/plugin.json +8 -0
  35. package/locales/vi-VN/error.json +4 -1
  36. package/locales/vi-VN/plugin.json +8 -0
  37. package/locales/zh-CN/error.json +3 -0
  38. package/locales/zh-CN/plugin.json +8 -0
  39. package/locales/zh-TW/error.json +4 -1
  40. package/locales/zh-TW/plugin.json +8 -0
  41. package/package.json +1 -1
  42. package/src/app/[variants]/(main)/repos/[id]/_layout/Desktop/index.tsx +2 -7
  43. package/src/app/[variants]/(main)/repos/[id]/_layout/Mobile.tsx +2 -12
  44. package/src/app/[variants]/(main)/repos/[id]/_layout/type.ts +0 -1
  45. package/src/app/[variants]/(main)/repos/[id]/features/Menu/index.tsx +18 -0
  46. package/src/app/[variants]/(main)/repos/[id]/page.tsx +16 -3
  47. package/src/app/[variants]/(main)/settings/provider/(detail)/[id]/page.tsx +2 -2
  48. package/src/config/aiModels/openrouter.ts +134 -18
  49. package/src/features/PluginDevModal/MCPManifestForm/index.tsx +28 -7
  50. package/src/features/PluginDevModal/PluginPreview/ApiVisualizer.tsx +12 -4
  51. package/src/features/PluginDevModal/PluginPreview/EmptyState.tsx +2 -3
  52. package/src/libs/mcp/types.ts +1 -1
  53. package/src/libs/trpc/client/helpers/desktopRemoteRPCFetch.ts +1 -1
  54. package/src/locales/default/error.ts +3 -0
  55. package/src/locales/default/plugin.ts +8 -0
  56. package/src/server/routers/desktop/mcp.ts +10 -1
  57. package/src/server/routers/tools/mcp.ts +11 -1
  58. package/src/server/services/mcp/index.ts +35 -12
  59. package/src/services/mcp.ts +14 -3
  60. package/src/types/tool/plugin.ts +12 -2
  61. package/src/app/[variants]/(main)/repos/[id]/@menu/default.tsx +0 -33
  62. /package/src/app/[variants]/(main)/repos/[id]/{@menu → features/Menu}/Head/index.tsx +0 -0
  63. /package/src/app/[variants]/(main)/repos/[id]/{@menu → features/Menu}/Menu/index.tsx +0 -0
package/CHANGELOG.md CHANGED
@@ -2,6 +2,57 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ### [Version 1.84.7](https://github.com/lobehub/lobe-chat/compare/v1.84.6...v1.84.7)
6
+
7
+ <sup>Released on **2025-04-29**</sup>
8
+
9
+ #### 🐛 Bug Fixes
10
+
11
+ - **misc**: Fix custom provider and knowledge base crash.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### What's fixed
19
+
20
+ - **misc**: Fix custom provider and knowledge base crash, closes [#7645](https://github.com/lobehub/lobe-chat/issues/7645) ([2cbc179](https://github.com/lobehub/lobe-chat/commit/2cbc179))
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
+
30
+ ### [Version 1.84.6](https://github.com/lobehub/lobe-chat/compare/v1.84.5...v1.84.6)
31
+
32
+ <sup>Released on **2025-04-29**</sup>
33
+
34
+ #### 💄 Styles
35
+
36
+ - **misc**: Fix OpenRouter models config, improve mcp stdio custom field.
37
+
38
+ <br/>
39
+
40
+ <details>
41
+ <summary><kbd>Improvements and Fixes</kbd></summary>
42
+
43
+ #### Styles
44
+
45
+ - **misc**: Fix OpenRouter models config, closes [#7638](https://github.com/lobehub/lobe-chat/issues/7638) ([15171dd](https://github.com/lobehub/lobe-chat/commit/15171dd))
46
+ - **misc**: Improve mcp stdio custom field, closes [#7632](https://github.com/lobehub/lobe-chat/issues/7632) ([71683b7](https://github.com/lobehub/lobe-chat/commit/71683b7))
47
+
48
+ </details>
49
+
50
+ <div align="right">
51
+
52
+ [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
53
+
54
+ </div>
55
+
5
56
  ### [Version 1.84.5](https://github.com/lobehub/lobe-chat/compare/v1.84.4...v1.84.5)
6
57
 
7
58
  <sup>Released on **2025-04-29**</sup>
@@ -1,12 +1,101 @@
1
- ## Menu 实现框架
1
+ ## 核心框架组件目录架构
2
+
3
+ ### 主进程核心组件
4
+
5
+ ```
6
+ apps/desktop/src/main/
7
+ ├── core/ // 核心功能
8
+ │ ├── App.ts // 应用核心类,整合所有管理器
9
+ │ ├── Browser.ts // 浏览器窗口类
10
+ │ ├── BrowserManager.ts // 浏览器窗口管理
11
+ │ ├── I18nManager.ts // 国际化管理
12
+ │ ├── IoCContainer.ts // 依赖注入容器
13
+ │ ├── MenuManager.ts // 菜单管理核心类,负责选择和协调平台实现
14
+ │ ├── ShortcutManager.ts // 快捷键管理
15
+ │ ├── StoreManager.ts // 存储管理
16
+ │ └── UpdaterManager.ts // 更新管理
17
+ ├── controllers/ // 控制器层,处理渲染进程调用
18
+ │ ├── AuthCtr.ts // 认证控制器
19
+ │ ├── BrowserWindowsCtr.ts // 浏览器窗口控制器
20
+ │ ├── DevtoolsCtr.ts // 开发工具控制器
21
+ │ ├── LocalFileCtr.ts // 本地文件控制器
22
+ │ ├── MenuCtr.ts // 菜单控制器
23
+ │ ├── RemoteServerConfigCtr.ts // 远程服务器配置控制器
24
+ │ ├── RemoteServerSyncCtr.ts // 远程服务器同步控制器
25
+ │ ├── ShortcutCtr.ts // 快捷键控制器
26
+ │ ├── SystemCtr.ts // 系统控制器
27
+ │ ├── UpdaterCtr.ts // 更新控制器
28
+ │ ├── UploadFileCtr.ts // 文件上传控制器
29
+ │ └── index.ts // 控制器导出
30
+ ├── services/ // 服务层
31
+ │ ├── fileSearchSrv.ts // 文件搜索服务
32
+ │ ├── fileSrv.ts // 文件服务
33
+ │ └── index.ts // 服务导出
34
+ ├── modules/ // 功能模块
35
+ │ ├── fileSearch/ // 文件搜索模块
36
+ │ └── updater/ // 更新模块
37
+ ├── menus/ // 菜单实现目录
38
+ │ ├── index.ts // 导出平台实现和接口
39
+ │ ├── types.ts // 定义菜单平台接口 IMenuPlatform
40
+ │ └── impl/ // 平台特定实现目录
41
+ │ ├── BaseMenuPlatform.ts // 基础平台类,注入App
42
+ │ ├── DarwinMenu.ts // macOS 充血模型实现
43
+ │ ├── WindowsMenu.ts // Windows 充血模型实现
44
+ │ └── LinuxMenu.ts // Linux 充血模型实现
45
+ ├── shortcuts/ // 快捷键实现
46
+ │ ├── config.ts // 快捷键配置
47
+ │ └── index.ts // 快捷键导出
48
+ ├── utils/ // 工具函数
49
+ │ ├── file-system.ts // 文件系统工具
50
+ │ ├── logger.ts // 日志工具
51
+ │ └── next-electron-rsc.ts // Next.js Electron RSC 工具
52
+ ├── types/ // 类型定义
53
+ │ ├── fileSearch.ts // 文件搜索类型
54
+ │ └── store.ts // 存储类型
55
+ ├── const/ // 常量定义
56
+ │ ├── dir.ts // 目录常量
57
+ │ ├── env.ts // 环境常量
58
+ │ └── store.ts // 存储常量
59
+ ├── locales/ // 国际化资源
60
+ │ ├── index.ts // 导出 i18n 相关功能
61
+ │ ├── resources.ts // 资源加载逻辑
62
+ │ └── default/ // 默认中文翻译源文件
63
+ │ ├── index.ts // 导出所有翻译
64
+ │ ├── menu.ts // 菜单翻译
65
+ │ ├── dialog.ts // 对话框翻译
66
+ │ └── common.ts // 通用翻译
67
+ └── index.ts // 主进程入口文件
68
+ ```
69
+
70
+ ### 预加载脚本
71
+
72
+ ```
73
+ apps/desktop/src/preload/
74
+ ├── index.ts // 预加载脚本入口
75
+ └── apis/ // 预加载 API
76
+ └── ... // 各种 API 实现
77
+ ```
78
+
79
+ ### 共享代码
80
+
81
+ ```
82
+ apps/desktop/src/common/
83
+ ├── constants/ // 共享常量
84
+ ├── types/ // 共享类型
85
+ └── utils/ // 共享工具函数
86
+ ```
87
+
88
+ ## 功能模块实现
89
+
90
+ ### 菜单实现框架
2
91
 
3
92
  ```
4
93
  apps/desktop/src/main/
5
94
  ├── core/
6
95
  │ ├── App.ts // 应用核心类
7
96
  │ ├── BrowserManager.ts // 浏览器窗口管理
8
- │ └── MenuManager.ts // 新增:菜单管理核心类,负责选择和协调平台实现
9
- ├── menus/ // 新增:菜单实现目录
97
+ │ └── MenuManager.ts // 菜单管理核心类,负责选择和协调平台实现
98
+ ├── menus/ // 菜单实现目录
10
99
  │ ├── index.ts // 导出平台实现和接口
11
100
  │ ├── types.ts // 定义菜单平台接口 IMenuPlatform
12
101
  │ └── impl/ // 平台特定实现目录
@@ -18,30 +107,389 @@ apps/desktop/src/main/
18
107
  │ └── MenuCtr.ts // 菜单控制器,处理渲染进程调用
19
108
  ```
20
109
 
21
- ## i18n
110
+ ### 国际化 (i18n) 实现
22
111
 
23
- src/main/
112
+ ```
113
+ apps/desktop/src/main/
24
114
  ├── core/
25
- ├── I18nManager.ts //i18n 管理器
26
- └── App.ts // 应用主类,集成 i18n
115
+ ├── I18nManager.ts // i18n 管理器
116
+ └── App.ts // 应用主类,集成 i18n
27
117
  ├── locales/
28
- ├── index.ts // 导出 i18n 相关功能
29
- ├── resources.ts // 资源加载逻辑
30
- └── default/ // 默认中文翻译源文件
31
- ├── index.ts // 导出所有翻译
32
- ├── menu.ts // 菜单翻译
33
- ├── dialog.ts // 对话框翻译
34
- └── common.ts // 通用翻译
118
+ ├── index.ts // 导出 i18n 相关功能
119
+ ├── resources.ts // 资源加载逻辑
120
+ └── default/ // 默认中文翻译源文件
121
+ ├── index.ts // 导出所有翻译
122
+ ├── menu.ts // 菜单翻译
123
+ ├── dialog.ts // 对话框翻译
124
+ └── common.ts // 通用翻译
125
+ ```
35
126
 
36
- 主进程 i18n 国际化管理
37
- 使用方式:
127
+ 主进程 i18n 国际化管理使用方式:
38
128
 
39
129
  1. 直接导入 i18nManager 实例:
130
+
131
+ ```typescript
40
132
  import i18nManager from '@/locales';
133
+ ```
41
134
 
42
135
  2. 使用翻译函数:
43
- import {t} from '@/locales';
44
- const translated = t ('key');
136
+
137
+ ```typescript
138
+ import { t } from '@/locales';
139
+
140
+ const translated = t('key');
141
+ ```
45
142
 
46
143
  3. 添加新翻译:
47
144
  在 locales/default/ 目录下添加翻译源文件
145
+
146
+ ## 核心模块详细说明
147
+
148
+ ### 认证模块 (Auth)
149
+
150
+ 认证模块负责处理用户身份验证和授权流程,主要包括:
151
+
152
+ 1. **AuthCtr 控制器**:实现 OAuth 授权流程
153
+ - 请求授权:打开浏览器进行 OAuth 认证
154
+ - 处理回调:接收授权码并交换访问令牌
155
+ - 令牌刷新:自动刷新过期的访问令牌
156
+ - 事件广播:向渲染进程通知授权状态变化
157
+
158
+ ```typescript
159
+ // 认证流程示例
160
+ @ipcClientEvent('requestAuthorization')
161
+ async requestAuthorization(config: DataSyncConfig) {
162
+ // 生成状态参数防止 CSRF 攻击
163
+ this.authRequestState = crypto.randomBytes(16).toString('hex');
164
+
165
+ // 构建授权 URL
166
+ const authUrl = new URL('/oidc/auth', remoteUrl);
167
+ authUrl.search = querystring.stringify({
168
+ client_id: 'lobe-chat',
169
+ response_type: 'code',
170
+ redirect_uri: `${protocolPrefix}://auth/callback`,
171
+ scope: 'openid profile',
172
+ state: this.authRequestState,
173
+ });
174
+
175
+ // 在默认浏览器中打开授权 URL
176
+ await shell.openExternal(authUrl.toString());
177
+ }
178
+ ```
179
+
180
+ 2. **桌面端特定认证**:
181
+ - 在桌面应用中使用固定的用户 ID
182
+ - 支持与 Clerk 和 NextAuth 等认证系统集成
183
+
184
+ ### 存储模块 (Store)
185
+
186
+ 存储模块使用 electron-store 实现持久化数据存储:
187
+
188
+ 1. **StoreManager 类**:
189
+ - 提供统一的存储接口
190
+ - 支持类型安全的存取操作
191
+ - 管理应用配置和用户数据
192
+
193
+ ```typescript
194
+ // 存储管理器使用示例
195
+ export class StoreManager {
196
+ private store: Store<ElectronMainStore>;
197
+
198
+ // 获取配置项
199
+ get<K extends StoreKey>(key: K, defaultValue?: ElectronMainStore[K]): ElectronMainStore[K] {
200
+ return this.store.get(key, defaultValue as any);
201
+ }
202
+
203
+ // 设置配置项
204
+ set<K extends StoreKey>(key: K, value: ElectronMainStore[K]): void {
205
+ this.store.set(key, value);
206
+ }
207
+
208
+ // 删除配置项
209
+ delete(key: StoreKey): void {
210
+ this.store.delete(key);
211
+ }
212
+ }
213
+ ```
214
+
215
+ 2. **存储用途**:
216
+ - 窗口状态保存
217
+ - 用户偏好设置
218
+ - 认证令牌存储
219
+ - 快捷键配置
220
+ - 国际化语言设置
221
+
222
+ ### 快捷键模块 (Shortcuts)
223
+
224
+ 快捷键模块管理全局键盘快捷键:
225
+
226
+ 1. **ShortcutManager 类**:
227
+ - 注册和管理全局快捷键
228
+ - 支持自定义快捷键配置
229
+ - 提供快捷键状态查询
230
+
231
+ ```typescript
232
+ // 快捷键管理器示例
233
+ export class ShortcutManager {
234
+ private shortcuts: Map<string, () => void> = new Map();
235
+ private shortcutsConfig: Record<string, string> = {};
236
+
237
+ // 注册快捷键
238
+ registerShortcut(accelerator: string, callback: () => void): boolean {
239
+ const success = globalShortcut.register(accelerator, callback);
240
+ if (success) {
241
+ this.shortcuts.set(accelerator, callback);
242
+ }
243
+ return success;
244
+ }
245
+
246
+ // 更新快捷键配置
247
+ updateShortcutConfig(id: string, accelerator: string): boolean {
248
+ this.shortcutsConfig[id] = accelerator;
249
+ this.saveShortcutsConfig();
250
+ this.registerConfiguredShortcuts();
251
+ return true;
252
+ }
253
+ }
254
+ ```
255
+
256
+ 2. **快捷键装饰器**:
257
+ - 使用 `@shortcut` 装饰器简化快捷键注册
258
+ - 通过 IoC 容器管理快捷键映射
259
+
260
+ ### 控制框架 (Control Framework)
261
+
262
+ 控制框架实现了主进程和渲染进程之间的通信:
263
+
264
+ 1. **ControllerModule 基类**:
265
+ - 所有控制器的基础类
266
+ - 提供生命周期钩子 (beforeAppReady, afterAppReady)
267
+ - 注入 App 实例
268
+
269
+ ```typescript
270
+ // 控制器基类和装饰器
271
+ export class ControllerModule implements IControllerModule {
272
+ constructor(public app: App) {
273
+ this.app = app;
274
+ }
275
+ }
276
+
277
+ // IPC 客户端事件装饰器
278
+ export const ipcClientEvent = (method: keyof ClientDispatchEvents) =>
279
+ ipcDecorator(method, 'client');
280
+
281
+ // IPC 服务器事件装饰器
282
+ export const ipcServerEvent = (method: keyof ServerDispatchEvents) =>
283
+ ipcDecorator(method, 'server');
284
+ ```
285
+
286
+ 2. **IoC 容器**:
287
+ - 依赖注入容器管理控制器实例
288
+ - 注册和解析 IPC 事件处理程序
289
+ - 管理快捷键和控制器方法的映射
290
+
291
+ ### 服务逻辑 (Service Logic)
292
+
293
+ 服务层提供业务逻辑实现:
294
+
295
+ 1. **ServiceModule 基类**:
296
+ - 所有服务的基础类
297
+ - 注入 App 实例
298
+ - 提供业务逻辑封装
299
+
300
+ ```typescript
301
+ // 服务模块基类
302
+ export class ServiceModule {
303
+ constructor(public app: App) {
304
+ this.app = app;
305
+ }
306
+ }
307
+ ```
308
+
309
+ 2. **服务实现**:
310
+ - fileSearchSrv:文件搜索服务
311
+ - fileSrv:文件操作服务
312
+
313
+ ### 数据存储 (Electron Settings)
314
+
315
+ Electron Settings 基于 electron-store 实现,提供类型安全的数据存储:
316
+
317
+ 1. **存储配置**:
318
+ - 使用 JSON 文件存储配置
319
+ - 支持默认值设置
320
+ - 自动创建存储目录
321
+
322
+ ```typescript
323
+ // 存储初始化
324
+ this.store = new Store<ElectronMainStore>({
325
+ defaults: STORE_DEFAULTS,
326
+ name: STORE_NAME,
327
+ });
328
+
329
+ // 确保存储目录存在
330
+ const storagePath = this.store.get('storagePath');
331
+ makeSureDirExist(storagePath);
332
+ ```
333
+
334
+ 2. **存储操作**:
335
+ - 类型安全的 get/set 方法
336
+ - 支持删除和清除操作
337
+ - 提供存储编辑器功能
338
+
339
+ ### 主进程和渲染进程通信 (Main-Renderer Communication)
340
+
341
+ 主进程和渲染进程通信基于 Electron IPC 机制:
342
+
343
+ 1. **IPC 事件处理**:
344
+ - 使用装饰器注册 IPC 事件处理程序
345
+ - 支持客户端事件和服务器事件
346
+ - 自动映射控制器方法到 IPC 事件
347
+
348
+ ```typescript
349
+ // IPC 事件初始化
350
+ private initializeIPCEvents() {
351
+ // 注册客户端事件处理程序
352
+ this.ipcClientEventMap.forEach((eventInfo, key) => {
353
+ ipcMain.handle(key, async (e, ...data) => {
354
+ return await eventInfo.controller[eventInfo.methodName](...data);
355
+ });
356
+ });
357
+
358
+ // 注册服务器事件处理程序
359
+ const ipcServerEvents = {} as ElectronIPCEventHandler;
360
+ this.ipcServerEventMap.forEach((eventInfo, key) => {
361
+ ipcServerEvents[key] = async (payload) => {
362
+ return await eventInfo.controller[eventInfo.methodName](payload);
363
+ };
364
+ });
365
+
366
+ // 创建 IPC 服务器
367
+ this.ipcServer = new ElectronIPCServer(name, ipcServerEvents);
368
+ }
369
+ ```
370
+
371
+ 2. **事件广播**:
372
+ - 主进程向渲染进程广播事件
373
+ - 支持向所有窗口或特定窗口发送消息
374
+
375
+ ### 日志系统 (Logging)
376
+
377
+ 日志系统提供统一的日志记录接口:
378
+
379
+ 1. **日志工具**:
380
+ - 基于 debug 和 electron-log 实现
381
+ - 支持不同日志级别 (debug, info, warn, error, verbose)
382
+ - 根据环境自动调整日志行为
383
+
384
+ ```typescript
385
+ // 创建日志记录器
386
+ export const createLogger = (namespace: string) => {
387
+ const debugLogger = debug(namespace);
388
+
389
+ return {
390
+ debug: (message, ...args) => {
391
+ debugLogger(message, ...args);
392
+ },
393
+ error: (message, ...args) => {
394
+ if (process.env.NODE_ENV === 'production') {
395
+ electronLog.error(message, ...args);
396
+ }
397
+ debugLogger(`ERROR: ${message}`, ...args);
398
+ },
399
+ // 其他日志级别...
400
+ };
401
+ };
402
+ ```
403
+
404
+ 2. **日志配置**:
405
+ - 开发环境显示详细日志
406
+ - 生产环境记录到文件
407
+ - 支持命名空间隔离日志
408
+
409
+ ### 自动更新 (Auto Updates)
410
+
411
+ 自动更新模块基于 electron-updater 实现:
412
+
413
+ 1. **UpdaterManager 类**:
414
+ - 检查更新
415
+ - 下载更新
416
+ - 安装更新
417
+ - 支持立即安装或下次启动安装
418
+
419
+ ```typescript
420
+ // 更新管理器示例
421
+ export class UpdaterManager {
422
+ // 检查更新
423
+ public checkForUpdates = async ({ manual = false }: { manual?: boolean } = {}) => {
424
+ if (this.checking || this.downloading) return;
425
+
426
+ this.checking = true;
427
+ this.isManualCheck = manual;
428
+
429
+ try {
430
+ await autoUpdater.checkForUpdates();
431
+ } catch (error) {
432
+ logger.error('Error checking for updates:', error.message);
433
+ } finally {
434
+ this.checking = false;
435
+ }
436
+ };
437
+
438
+ // 下载更新
439
+ public downloadUpdate = async (manual: boolean = false) => {
440
+ if (this.downloading || !this.updateAvailable) return;
441
+
442
+ this.downloading = true;
443
+
444
+ try {
445
+ await autoUpdater.downloadUpdate();
446
+ } catch (error) {
447
+ this.downloading = false;
448
+ logger.error('Error downloading update:', error);
449
+ }
450
+ };
451
+ }
452
+ ```
453
+
454
+ 2. **更新配置**:
455
+ - 支持多渠道发布 (stable, beta, nightly)
456
+ - 自动检查更新
457
+ - 更新事件通知
458
+
459
+ ## 桌面端架构图
460
+
461
+ ```
462
+ ┌─────────────────────────────────────────────────────────────────┐
463
+ │ Electron Application │
464
+ ├─────────────────────────────────────────────────────────────────┤
465
+ │ │
466
+ │ ┌─────────────────┐ ┌──────────────────────────┐ │
467
+ │ │ Main Process │ │ Renderer Process │ │
468
+ │ │ │ │ │ │
469
+ │ │ ┌─────────────┐│ │ ┌────────────────────┐ │ │
470
+ │ │ │ Core ││ │ │ │ │ │
471
+ │ │ │ Managers ││ │ │ │ │ │
472
+ │ │ └─────────────┘│ │ │ Next.js App │ │ │
473
+ │ │ │ │ │ │ │ │ │
474
+ │ │ ┌─────▼─────┐ │ │ │ │ │ │
475
+ │ │ │Controllers│ │◄──────────┼──┤ │ │ │
476
+ │ │ └─────┬─────┘ │ IPC │ └────────────────────┘ │ │
477
+ │ │ │ │Communication │ │
478
+ │ │ ┌─────▼─────┐ │ │ │ │
479
+ │ │ │ Services │ │ │ │ │
480
+ │ │ └─────┬─────┘ │ │ │ │
481
+ │ │ │ │ │ │ │
482
+ │ │ ┌─────▼─────┐ │ │ │ │
483
+ │ │ │ Modules │ │ │ │ │
484
+ │ │ └───────────┘ │ │ │ │
485
+ │ │ │ │ │ │
486
+ │ └─────────────────┘ └──────────────────────────┘ │
487
+ │ │
488
+ │ ┌───────────────────┐ │
489
+ │ │ Preload Script │ │
490
+ │ │ (Bridge between │ │
491
+ │ │ Main & Renderer) │ │
492
+ │ └───────────────────┘ │
493
+ │ │
494
+ └─────────────────────────────────────────────────────────────────┘
495
+ ```
@@ -0,0 +1,60 @@
1
+ # LobeHub Desktop Application
2
+
3
+ LobeHub Desktop 是 [LobeChat](https://github.com/lobehub/lobe-chat) 的跨平台桌面应用程序,使用 Electron 构建,提供了更加原生的桌面体验和功能。
4
+
5
+ ## 功能特点
6
+
7
+ - **跨平台支持**:支持 macOS (Intel/Apple Silicon)、Windows 和 Linux 系统
8
+ - **自动更新**:内置更新机制,确保您始终使用最新版本
9
+ - **多语言支持**:完整的国际化支持,包括中文、英文等多种语言
10
+ - **原生集成**:与操作系统深度集成,提供原生菜单、快捷键和通知
11
+ - **安全可靠**:macOS 版本经过公证,确保安全性
12
+ - **多渠道发布**:提供稳定版、测试版和每日构建版本
13
+
14
+ ## 开发环境设置
15
+
16
+ ### 前提条件
17
+
18
+ - Node.js 22+
19
+ - pnpm 10+
20
+
21
+ ### 安装依赖
22
+
23
+ ```bash
24
+ pnpm install-isolated
25
+ ```
26
+
27
+ ### 开发模式运行
28
+
29
+ ```bash
30
+ pnpm electron:dev
31
+ ```
32
+
33
+ ### 构建应用
34
+
35
+ 构建所有平台:
36
+
37
+ ```bash
38
+ pnpm build
39
+ ```
40
+
41
+ 构建特定平台:
42
+
43
+ ```bash
44
+ # macOS
45
+ pnpm build:mac
46
+
47
+ # Windows
48
+ pnpm build:win
49
+
50
+ # Linux
51
+ pnpm build:linux
52
+ ```
53
+
54
+ ## 发布渠道
55
+
56
+ 应用提供三个发布渠道:
57
+
58
+ - **稳定版**:经过充分测试的正式版本
59
+ - **测试版 (Beta)**:预发布版本,包含即将发布的新功能
60
+ - **每日构建版 (Nightly)**:包含最新开发进展的构建版本
package/changelog/v1.json CHANGED
@@ -1,4 +1,22 @@
1
1
  [
2
+ {
3
+ "children": {
4
+ "fixes": [
5
+ "Fix custom provider and knowledge base crash."
6
+ ]
7
+ },
8
+ "date": "2025-04-29",
9
+ "version": "1.84.7"
10
+ },
11
+ {
12
+ "children": {
13
+ "improvements": [
14
+ "Fix OpenRouter models config, improve mcp stdio custom field."
15
+ ]
16
+ },
17
+ "date": "2025-04-29",
18
+ "version": "1.84.6"
19
+ },
2
20
  {
3
21
  "children": {
4
22
  "improvements": [
@@ -66,6 +66,7 @@
66
66
  "429": "عذرًا، طلبك كثير جدًا والخادم متعب قليلاً، يرجى المحاولة مرة أخرى لاحقًا",
67
67
  "431": "عذرًا، حقول رأس الطلب الخاصة بك كبيرة جدًا والخادم غير قادر على معالجتها",
68
68
  "451": "عذرًا، بسبب الأسباب القانونية، يرفض الخادم توفير هذا المورد",
69
+ "499": "نعتذر، تم قطع طلبك بشكل غير متوقع أثناء معالجته على الخادم، قد يكون ذلك بسبب إلغاء العملية من قبلك أو بسبب عدم استقرار الاتصال بالشبكة. يرجى التحقق من حالة الشبكة ثم إعادة المحاولة.",
69
70
  "500": "عذرًا، يبدو أن الخادم واجه بعض الصعوبات ولا يمكنه حاليًا استكمال طلبك، يرجى المحاولة مرة أخرى لاحقًا",
70
71
  "501": "عذرًا، لا يعرف الخادم كيفية معالجة هذا الطلب، يرجى التأكد من صحة العملية الخاصة بك",
71
72
  "502": "عذرًا، يبدو أن الخادم قد ضل الطريق ولا يمكنه حاليًا تقديم الخدمة، يرجى المحاولة مرة أخرى لاحقًا",
@@ -76,7 +77,9 @@
76
77
  "507": "عذرًا، لا يوجد مساحة تخزين كافية على الخادم لمعالجة طلبك، يرجى المحاولة مرة أخرى لاحقًا",
77
78
  "509": "عذرًا، لقد استنفد الخادم النطاق الترددي، يرجى المحاولة مرة أخرى لاحقًا",
78
79
  "510": "عذرًا، لا يدعم الخادم الوظائف الإضافية المطلوبة، يرجى الاتصال بالمسؤول",
79
- "524": "عذرًا، انتهت مهلة الخادم أثناء الانتظار للرد، قد يكون ذلك بسبب بطء الاستجابة، يرجى المحاولة مرة أخرى لاحقًا",
80
+ "520": "نعتذر، واجه الخادم مشكلة غير متوقعة، مما أدى إلى عدم القدرة على إكمال طلبك. يرجى المحاولة لاحقًا، نحن نعمل على حل هذه المشكلة.",
81
+ "522": "نعتذر، انتهت مهلة الاتصال بالخادم، ولم يتمكن من الاستجابة لطلبك في الوقت المناسب. قد يكون ذلك بسبب عدم استقرار الشبكة أو أن الخادم غير متاح مؤقتًا. يرجى المحاولة لاحقًا، نحن نبذل جهدًا لاستعادة الخدمة.",
82
+ "524": "نعتذر، انتهت مهلة الخادم أثناء انتظار الرد، قد يكون ذلك بسبب بطء الاستجابة، يرجى المحاولة لاحقًا.",
80
83
  "AgentRuntimeError": "حدث خطأ في تشغيل نموذج Lobe اللغوي، يرجى التحقق من المعلومات التالية أو إعادة المحاولة",
81
84
  "ConnectionCheckFailed": "الاستجابة فارغة، يرجى التحقق من أن عنوان وكيل الـ API لا ينتهي بـ `/v1`",
82
85
  "CreateMessageError": "عذرًا، لم يتم إرسال الرسالة بشكل صحيح، يرجى نسخ المحتوى وإعادة إرساله، بعد تحديث الصفحة لن يتم الاحتفاظ بهذه الرسالة",