@lobehub/chat 1.82.10 → 1.83.0

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 (195) hide show
  1. package/.env.desktop +1 -2
  2. package/.github/workflows/{release-desktop.yml → desktop-pr-build.yml} +59 -137
  3. package/.github/workflows/release-desktop-beta.yml +196 -0
  4. package/CHANGELOG.md +25 -0
  5. package/apps/desktop/.i18nrc.js +31 -0
  6. package/apps/desktop/Development.md +47 -0
  7. package/apps/desktop/README.md +6 -0
  8. package/apps/desktop/build/Icon-beta.icns +0 -0
  9. package/apps/desktop/build/Icon-nightly.icns +0 -0
  10. package/apps/desktop/build/Icon.icns +0 -0
  11. package/apps/desktop/build/entitlements.mac.plist +12 -0
  12. package/apps/desktop/build/favicon.ico +0 -0
  13. package/apps/desktop/build/icon-beta.png +0 -0
  14. package/apps/desktop/build/icon-dev.png +0 -0
  15. package/apps/desktop/build/icon-nightly.ico +0 -0
  16. package/apps/desktop/build/icon-nightly.png +0 -0
  17. package/apps/desktop/build/icon.ico +0 -0
  18. package/apps/desktop/build/icon.png +0 -0
  19. package/apps/desktop/dev-app-update.yml +6 -0
  20. package/apps/desktop/electron-builder.js +92 -0
  21. package/apps/desktop/electron.vite.config.ts +40 -0
  22. package/apps/desktop/package.json +72 -0
  23. package/apps/desktop/pnpm-workspace.yaml +5 -0
  24. package/apps/desktop/resources/error.html +136 -0
  25. package/apps/desktop/resources/locales/ar/common.json +32 -0
  26. package/apps/desktop/resources/locales/ar/dialog.json +31 -0
  27. package/apps/desktop/resources/locales/ar/menu.json +70 -0
  28. package/apps/desktop/resources/locales/bg-BG/common.json +32 -0
  29. package/apps/desktop/resources/locales/bg-BG/dialog.json +31 -0
  30. package/apps/desktop/resources/locales/bg-BG/menu.json +70 -0
  31. package/apps/desktop/resources/locales/de-DE/common.json +32 -0
  32. package/apps/desktop/resources/locales/de-DE/dialog.json +31 -0
  33. package/apps/desktop/resources/locales/de-DE/menu.json +70 -0
  34. package/apps/desktop/resources/locales/en-US/common.json +32 -0
  35. package/apps/desktop/resources/locales/en-US/dialog.json +31 -0
  36. package/apps/desktop/resources/locales/en-US/menu.json +70 -0
  37. package/apps/desktop/resources/locales/es-ES/common.json +32 -0
  38. package/apps/desktop/resources/locales/es-ES/dialog.json +31 -0
  39. package/apps/desktop/resources/locales/es-ES/menu.json +70 -0
  40. package/apps/desktop/resources/locales/fa-IR/common.json +32 -0
  41. package/apps/desktop/resources/locales/fa-IR/dialog.json +31 -0
  42. package/apps/desktop/resources/locales/fa-IR/menu.json +70 -0
  43. package/apps/desktop/resources/locales/fr-FR/common.json +32 -0
  44. package/apps/desktop/resources/locales/fr-FR/dialog.json +31 -0
  45. package/apps/desktop/resources/locales/fr-FR/menu.json +70 -0
  46. package/apps/desktop/resources/locales/it-IT/common.json +32 -0
  47. package/apps/desktop/resources/locales/it-IT/dialog.json +31 -0
  48. package/apps/desktop/resources/locales/it-IT/menu.json +70 -0
  49. package/apps/desktop/resources/locales/ja-JP/common.json +32 -0
  50. package/apps/desktop/resources/locales/ja-JP/dialog.json +31 -0
  51. package/apps/desktop/resources/locales/ja-JP/menu.json +70 -0
  52. package/apps/desktop/resources/locales/ko-KR/common.json +32 -0
  53. package/apps/desktop/resources/locales/ko-KR/dialog.json +31 -0
  54. package/apps/desktop/resources/locales/ko-KR/menu.json +70 -0
  55. package/apps/desktop/resources/locales/nl-NL/common.json +32 -0
  56. package/apps/desktop/resources/locales/nl-NL/dialog.json +31 -0
  57. package/apps/desktop/resources/locales/nl-NL/menu.json +70 -0
  58. package/apps/desktop/resources/locales/pl-PL/common.json +32 -0
  59. package/apps/desktop/resources/locales/pl-PL/dialog.json +31 -0
  60. package/apps/desktop/resources/locales/pl-PL/menu.json +70 -0
  61. package/apps/desktop/resources/locales/pt-BR/common.json +32 -0
  62. package/apps/desktop/resources/locales/pt-BR/dialog.json +31 -0
  63. package/apps/desktop/resources/locales/pt-BR/menu.json +70 -0
  64. package/apps/desktop/resources/locales/ru-RU/common.json +32 -0
  65. package/apps/desktop/resources/locales/ru-RU/dialog.json +31 -0
  66. package/apps/desktop/resources/locales/ru-RU/menu.json +70 -0
  67. package/apps/desktop/resources/locales/tr-TR/common.json +32 -0
  68. package/apps/desktop/resources/locales/tr-TR/dialog.json +31 -0
  69. package/apps/desktop/resources/locales/tr-TR/menu.json +70 -0
  70. package/apps/desktop/resources/locales/vi-VN/common.json +32 -0
  71. package/apps/desktop/resources/locales/vi-VN/dialog.json +31 -0
  72. package/apps/desktop/resources/locales/vi-VN/menu.json +70 -0
  73. package/apps/desktop/resources/locales/zh-CN/common.json +32 -0
  74. package/apps/desktop/resources/locales/zh-CN/dialog.json +31 -0
  75. package/apps/desktop/resources/locales/zh-CN/menu.json +70 -0
  76. package/apps/desktop/resources/locales/zh-TW/common.json +32 -0
  77. package/apps/desktop/resources/locales/zh-TW/dialog.json +31 -0
  78. package/apps/desktop/resources/locales/zh-TW/menu.json +70 -0
  79. package/apps/desktop/resources/splash.html +88 -0
  80. package/apps/desktop/scripts/i18nWorkflow/const.ts +18 -0
  81. package/apps/desktop/scripts/i18nWorkflow/genDefaultLocale.ts +35 -0
  82. package/apps/desktop/scripts/i18nWorkflow/genDiff.ts +57 -0
  83. package/apps/desktop/scripts/i18nWorkflow/index.ts +35 -0
  84. package/apps/desktop/scripts/i18nWorkflow/utils.ts +54 -0
  85. package/apps/desktop/scripts/pglite-server.ts +14 -0
  86. package/apps/desktop/src/common/routes.ts +78 -0
  87. package/apps/desktop/src/main/appBrowsers.ts +47 -0
  88. package/apps/desktop/src/main/const/dir.ts +29 -0
  89. package/apps/desktop/src/main/const/env.ts +3 -0
  90. package/apps/desktop/src/main/const/store.ts +22 -0
  91. package/apps/desktop/src/main/controllers/AuthCtr.ts +390 -0
  92. package/apps/desktop/src/main/controllers/BrowserWindowsCtr.ts +95 -0
  93. package/apps/desktop/src/main/controllers/DevtoolsCtr.ts +9 -0
  94. package/apps/desktop/src/main/controllers/LocalFileCtr.ts +380 -0
  95. package/apps/desktop/src/main/controllers/MenuCtr.ts +29 -0
  96. package/apps/desktop/src/main/controllers/RemoteServerConfigCtr.ts +335 -0
  97. package/apps/desktop/src/main/controllers/RemoteServerSyncCtr.ts +321 -0
  98. package/apps/desktop/src/main/controllers/ShortcutCtr.ts +19 -0
  99. package/apps/desktop/src/main/controllers/SystemCtr.ts +93 -0
  100. package/apps/desktop/src/main/controllers/UpdaterCtr.ts +43 -0
  101. package/apps/desktop/src/main/controllers/UploadFileCtr.ts +34 -0
  102. package/apps/desktop/src/main/controllers/_template.ts +9 -0
  103. package/apps/desktop/src/main/controllers/index.ts +58 -0
  104. package/apps/desktop/src/main/core/App.ts +370 -0
  105. package/apps/desktop/src/main/core/Browser.ts +345 -0
  106. package/apps/desktop/src/main/core/BrowserManager.ts +154 -0
  107. package/apps/desktop/src/main/core/I18nManager.ts +185 -0
  108. package/apps/desktop/src/main/core/IoCContainer.ts +12 -0
  109. package/apps/desktop/src/main/core/MenuManager.ts +64 -0
  110. package/apps/desktop/src/main/core/ShortcutManager.ts +173 -0
  111. package/apps/desktop/src/main/core/StoreManager.ts +89 -0
  112. package/apps/desktop/src/main/core/UpdaterManager.ts +321 -0
  113. package/apps/desktop/src/main/index.ts +5 -0
  114. package/apps/desktop/src/main/locales/default/common.ts +34 -0
  115. package/apps/desktop/src/main/locales/default/dialog.ts +33 -0
  116. package/apps/desktop/src/main/locales/default/index.ts +11 -0
  117. package/apps/desktop/src/main/locales/default/menu.ts +72 -0
  118. package/apps/desktop/src/main/locales/resources.ts +35 -0
  119. package/apps/desktop/src/main/menus/impls/BaseMenuPlatform.ts +10 -0
  120. package/apps/desktop/src/main/menus/impls/linux.ts +243 -0
  121. package/apps/desktop/src/main/menus/impls/macOS.ts +360 -0
  122. package/apps/desktop/src/main/menus/impls/windows.ts +226 -0
  123. package/apps/desktop/src/main/menus/index.ts +34 -0
  124. package/apps/desktop/src/main/menus/types.ts +28 -0
  125. package/apps/desktop/src/main/modules/fileSearch/impl/macOS.ts +577 -0
  126. package/apps/desktop/src/main/modules/fileSearch/index.ts +23 -0
  127. package/apps/desktop/src/main/modules/fileSearch/type.ts +27 -0
  128. package/apps/desktop/src/main/modules/updater/configs.ts +22 -0
  129. package/apps/desktop/src/main/modules/updater/utils.ts +33 -0
  130. package/apps/desktop/src/main/services/fileSearchSrv.ts +35 -0
  131. package/apps/desktop/src/main/services/fileSrv.ts +255 -0
  132. package/apps/desktop/src/main/services/index.ts +9 -0
  133. package/apps/desktop/src/main/shortcuts/config.ts +18 -0
  134. package/apps/desktop/src/main/shortcuts/index.ts +1 -0
  135. package/apps/desktop/src/main/types/fileSearch.ts +51 -0
  136. package/apps/desktop/src/main/types/store.ts +14 -0
  137. package/apps/desktop/src/main/utils/file-system.ts +15 -0
  138. package/apps/desktop/src/main/utils/logger.ts +44 -0
  139. package/apps/desktop/src/main/utils/next-electron-rsc.ts +383 -0
  140. package/apps/desktop/src/preload/electronApi.ts +18 -0
  141. package/apps/desktop/src/preload/index.ts +14 -0
  142. package/apps/desktop/src/preload/invoke.ts +10 -0
  143. package/apps/desktop/src/preload/routeInterceptor.ts +162 -0
  144. package/apps/desktop/tsconfig.json +21 -0
  145. package/changelog/v1.json +9 -0
  146. package/package.json +1 -1
  147. package/packages/electron-client-ipc/src/events/remoteServer.ts +11 -4
  148. package/packages/electron-client-ipc/src/types/dataSync.ts +15 -0
  149. package/packages/electron-client-ipc/src/types/index.ts +2 -1
  150. package/packages/electron-client-ipc/src/types/proxyTRPCRequest.ts +21 -0
  151. package/packages/electron-server-ipc/src/const.ts +3 -3
  152. package/packages/electron-server-ipc/src/ipcClient.test.ts +7 -6
  153. package/packages/electron-server-ipc/src/ipcClient.ts +17 -8
  154. package/packages/electron-server-ipc/src/ipcServer.ts +7 -3
  155. package/scripts/electronWorkflow/setDesktopVersion.ts +60 -43
  156. package/src/app/[variants]/(main)/_layout/Desktop/index.tsx +1 -1
  157. package/src/components/Analytics/Desktop.tsx +19 -0
  158. package/src/components/Analytics/index.tsx +3 -0
  159. package/src/database/core/db-adaptor.ts +4 -1
  160. package/src/database/core/electron.ts +317 -0
  161. package/src/{app/[variants]/(main)/_layout/Desktop/ElectronTitlebar/Connection/Mode.tsx → features/ElectronTitlebar/Connection/ConnectionMode.tsx} +24 -21
  162. package/src/{app/[variants]/(main)/_layout/Desktop → features}/ElectronTitlebar/Connection/Option.tsx +3 -5
  163. package/src/{app/[variants]/(main)/_layout/Desktop/ElectronTitlebar/Connection/Sync.tsx → features/ElectronTitlebar/Connection/RemoteStatus.tsx} +10 -7
  164. package/src/{app/[variants]/(main)/_layout/Desktop → features}/ElectronTitlebar/Connection/index.tsx +4 -4
  165. package/src/{app/[variants]/(main)/_layout/Desktop → features}/ElectronTitlebar/UpdateModal.tsx +2 -1
  166. package/src/libs/trpc/client/async.ts +6 -0
  167. package/src/libs/trpc/client/edge.ts +6 -0
  168. package/src/libs/trpc/client/helpers/desktopRemoteRPCFetch.ts +72 -0
  169. package/src/libs/trpc/client/index.ts +1 -0
  170. package/src/libs/trpc/client/lambda.ts +10 -1
  171. package/src/libs/trpc/client/tools.ts +6 -0
  172. package/src/server/globalConfig/index.ts +0 -3
  173. package/src/server/modules/ElectronIPCClient/index.ts +3 -1
  174. package/src/server/routers/desktop/index.ts +2 -0
  175. package/src/server/routers/desktop/mcp.ts +47 -0
  176. package/src/server/routers/lambda/user.ts +38 -23
  177. package/src/server/routers/tools/mcp.ts +0 -6
  178. package/src/services/electron/remoteServer.ts +4 -4
  179. package/src/services/mcp.ts +17 -7
  180. package/src/services/upload.ts +9 -0
  181. package/src/store/chat/slices/aiChat/actions/generateAIChat.ts +11 -2
  182. package/src/store/chat/slices/builtinTool/actions/localFile.ts +110 -53
  183. package/src/store/electron/actions/sync.ts +20 -19
  184. package/src/store/electron/initialState.ts +3 -3
  185. package/src/store/electron/selectors/sync.ts +6 -3
  186. package/src/store/electron/store.ts +2 -0
  187. package/src/store/file/slices/upload/action.ts +11 -3
  188. package/src/store/tool/selectors/tool.ts +10 -1
  189. package/src/utils/fetch/headers.ts +27 -0
  190. package/src/utils/fetch/index.ts +2 -0
  191. package/src/utils/fetch/request.ts +28 -0
  192. package/packages/electron-client-ipc/src/types/remoteServer.ts +0 -8
  193. /package/src/{app/[variants]/(main)/_layout/Desktop → features}/ElectronTitlebar/Connection/Waiting.tsx +0 -0
  194. /package/src/{app/[variants]/(main)/_layout/Desktop → features}/ElectronTitlebar/UpdateNotification.tsx +0 -0
  195. /package/src/{app/[variants]/(main)/_layout/Desktop → features}/ElectronTitlebar/index.tsx +0 -0
package/.env.desktop CHANGED
@@ -3,6 +3,5 @@ APP_URL=http://localhost:3015
3
3
  FEATURE_FLAGS=-check_updates,+pin_list
4
4
  KEY_VAULTS_SECRET=oLXWIiR/AKF+rWaqy9lHkrYgzpATbW3CtJp3UfkVgpE=
5
5
  DATABASE_URL=postgresql://postgres@localhost:5432/postgres
6
- DEFAULT_AGENT_CONFIG="model=qwen2.5;provider=ollama;chatConfig.searchFCModel.provider=ollama;chatConfig.searchFCModel.model=qwen2.5"
7
- SYSTEM_AGENT="default=ollama/qwen2.5"
8
6
  SEARCH_PROVIDERS=search1api
7
+ NEXT_PUBLIC_SERVICE_MODE='server'
@@ -1,9 +1,6 @@
1
- name: Release Desktop
1
+ name: Desktop PR Build
2
2
 
3
3
  on:
4
- # uncomment when official desktop version released
5
- # release:
6
- # types: [published] # 发布 release 时触发构建
7
4
  pull_request:
8
5
  types: [synchronize, labeled, unlabeled] # PR 更新或标签变化时触发
9
6
 
@@ -12,6 +9,9 @@ concurrency:
12
9
  group: ${{ github.ref }}-${{ github.workflow }}
13
10
  cancel-in-progress: true
14
11
 
12
+ # Add default permissions
13
+ permissions: read-all
14
+
15
15
  env:
16
16
  PR_TAG_PREFIX: pr- # PR 构建版本的前缀标识
17
17
 
@@ -19,10 +19,7 @@ jobs:
19
19
  test:
20
20
  name: Code quality check
21
21
  # 添加 PR label 触发条件,只有添加了 Build Desktop 标签的 PR 才会触发构建
22
- if: |
23
- (github.event_name == 'pull_request' &&
24
- contains(github.event.pull_request.labels.*.name, 'Build Desktop')) ||
25
- github.event_name != 'pull_request'
22
+ if: contains(github.event.pull_request.labels.*.name, 'Build Desktop')
26
23
  runs-on: ubuntu-latest # 只在 ubuntu 上运行一次检查
27
24
  steps:
28
25
  - name: Checkout base
@@ -38,7 +35,7 @@ jobs:
38
35
  - name: Setup pnpm
39
36
  uses: pnpm/action-setup@v2
40
37
  with:
41
- version: 8
38
+ version: 9
42
39
 
43
40
  - name: Install deps
44
41
  run: pnpm install
@@ -50,21 +47,14 @@ jobs:
50
47
  env:
51
48
  NODE_OPTIONS: --max-old-space-size=6144
52
49
 
53
- # - name: Test
54
- # run: pnpm run test
55
-
56
50
  version:
57
51
  name: Determine version
58
52
  # 与 test job 相同的触发条件
59
- if: |
60
- (github.event_name == 'pull_request' &&
61
- contains(github.event.pull_request.labels.*.name, 'Build Desktop')) ||
62
- github.event_name != 'pull_request'
53
+ if: contains(github.event.pull_request.labels.*.name, 'Build Desktop')
63
54
  runs-on: ubuntu-latest
64
55
  outputs:
65
56
  # 输出版本信息,供后续 job 使用
66
57
  version: ${{ steps.set_version.outputs.version }}
67
- is_pr_build: ${{ steps.set_version.outputs.is_pr_build }}
68
58
  steps:
69
59
  - uses: actions/checkout@v4
70
60
  with:
@@ -82,32 +72,13 @@ jobs:
82
72
  # 从 apps/desktop/package.json 读取基础版本号
83
73
  base_version=$(node -p "require('./apps/desktop/package.json').version")
84
74
 
85
- if [ "${{ github.event_name }}" == "pull_request" ]; then
86
- # PR 构建:在基础版本号上添加 PR 信息
87
- branch_name="${{ github.head_ref }}"
88
- # 清理分支名,移除非法字符
89
- sanitized_branch=$(echo "${branch_name}" | sed -E 's/[^a-zA-Z0-9_.-]+/-/g')
90
- # 创建特殊的 PR 版本号:基础版本号-PR前缀-分支名-提交哈希
91
- version="${base_version}-${{ env.PR_TAG_PREFIX }}${sanitized_branch}-$(git rev-parse --short HEAD)"
92
- echo "version=${version}" >> $GITHUB_OUTPUT
93
- echo "is_pr_build=true" >> $GITHUB_OUTPUT
94
- echo "📦 Release Version: ${version} (based on base version ${base_version})"
95
-
96
- elif [ "${{ github.event_name }}" == "release" ]; then
97
- # Release 事件直接使用 release tag 作为版本号,去掉可能的 v 前缀
98
- version="${{ github.event.release.tag_name }}"
99
- version="${version#v}"
100
- echo "version=${version}" >> $GITHUB_OUTPUT
101
- echo "is_pr_build=false" >> $GITHUB_OUTPUT
102
- echo "📦 Release Version: ${version}"
103
-
104
- else
105
- # 其他情况(如手动触发)使用 apps/desktop/package.json 的版本号
106
- version="${base_version}"
107
- echo "version=${version}" >> $GITHUB_OUTPUT
108
- echo "is_pr_build=false" >> $GITHUB_OUTPUT
109
- echo "📦 Release Version: ${version}"
110
- fi
75
+ # PR 构建:在基础版本号上添加 PR 信息
76
+ pr_number="${{ github.event.pull_request.number }}"
77
+ ci_build_number="${{ github.run_number }}" # CI 构建编号
78
+ version="${base_version}-nightly.pr${pr_number}.${ci_build_number}"
79
+ echo "version=${version}" >> $GITHUB_OUTPUT
80
+ echo "📦 Release Version: ${version} (based on base version ${base_version})"
81
+
111
82
  env:
112
83
  NODE_OPTIONS: --max-old-space-size=6144
113
84
 
@@ -115,7 +86,6 @@ jobs:
115
86
  - name: Version Summary
116
87
  run: |
117
88
  echo "🚦 Release Version: ${{ steps.set_version.outputs.version }}"
118
- echo "🔄 Is PR Build: ${{ steps.set_version.outputs.is_pr_build }}"
119
89
 
120
90
  build:
121
91
  needs: [version, test]
@@ -137,43 +107,57 @@ jobs:
137
107
  - name: Setup pnpm
138
108
  uses: pnpm/action-setup@v2
139
109
  with:
140
- version: 8
110
+ version: 9
141
111
 
112
+ # node-linker=hoisted 模式将可以确保 asar 压缩可用
142
113
  - name: Install deps
143
- run: pnpm install
114
+ run: pnpm install --node-linker=hoisted
144
115
 
145
116
  - name: Install deps on Desktop
146
117
  run: npm run install-isolated --prefix=./apps/desktop
147
118
 
148
119
  # 设置 package.json 的版本号
149
120
  - name: Set package version
150
- run: npm run workflow:set-desktop-version ${{ needs.version.outputs.version }}
121
+ run: npm run workflow:set-desktop-version ${{ needs.version.outputs.version }} nightly
151
122
 
152
123
  # macOS 构建处理
153
124
  - name: Build artifact on macOS
154
125
  if: runner.os == 'macOS'
155
126
  run: npm run desktop:build
156
127
  env:
157
- APP_URL: http://localhost:3010
128
+ # 设置更新通道,PR构建为nightly,否则为stable
129
+ UPDATE_CHANNEL: 'nightly'
130
+ APP_URL: http://localhost:3015
158
131
  DATABASE_URL: 'postgresql://postgres@localhost:5432/postgres'
159
132
  # 默认添加一个加密 SECRET
160
133
  KEY_VAULTS_SECRET: 'oLXWIiR/AKF+rWaqy9lHkrYgzpATbW3CtJp3UfkVgpE='
161
- # 公证部分将来再加回
162
- # CSC_LINK: ./build/developer-id-app-certs.p12
163
- # CSC_KEY_PASSWORD: ${{ secrets.APPLE_APP_CERTS_PASSWORD }}
164
- # APPLE_ID: ${{ secrets.APPLE_ID }}
165
- # APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
134
+ # macOS 签名和公证配置
135
+ CSC_LINK: ${{ secrets.APPLE_CERTIFICATE_BASE64 }}
136
+ CSC_KEY_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
137
+ NEXT_PUBLIC_DESKTOP_PROJECT_ID: ${{ secrets.UMAMI_NIGHTLY_DESKTOP_PROJECT_ID }}
138
+ NEXT_PUBLIC_DESKTOP_UMAMI_BASE_URL: ${{ secrets.UMAMI_NIGHTLY_DESKTOP_BASE_URL }}
139
+
140
+ # allow provisionally
141
+ CSC_FOR_PULL_REQUEST: true
142
+ APPLE_ID: ${{ secrets.APPLE_ID }}
143
+ APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}
144
+ APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
166
145
 
167
146
  # 非 macOS 平台构建处理
168
147
  - name: Build artifact on other platforms
169
148
  if: runner.os != 'macOS'
170
149
  run: npm run desktop:build
171
150
  env:
172
- APP_URL: http://localhost:3010
151
+ # 设置更新通道,PR构建为nightly,否则为stable
152
+ UPDATE_CHANNEL: 'nightly'
153
+ APP_URL: http://localhost:3015
173
154
  DATABASE_URL: 'postgresql://postgres@localhost:5432/postgres'
174
155
  KEY_VAULTS_SECRET: 'oLXWIiR/AKF+rWaqy9lHkrYgzpATbW3CtJp3UfkVgpE='
156
+ NEXT_PUBLIC_DESKTOP_PROJECT_ID: ${{ secrets.UMAMI_NIGHTLY_DESKTOP_PROJECT_ID }}
157
+ NEXT_PUBLIC_DESKTOP_UMAMI_BASE_URL: ${{ secrets.UMAMI_NIGHTLY_DESKTOP_BASE_URL }}
158
+
175
159
 
176
- # 上传构建产物,移除了 zip 相关部分
160
+ # 上传构建产物
177
161
  - name: Upload artifact
178
162
  uses: actions/upload-artifact@v4
179
163
  with:
@@ -186,18 +170,21 @@ jobs:
186
170
  apps/desktop/release/*.AppImage
187
171
  retention-days: 5
188
172
 
189
- - name: Log build info
190
- run: |
191
- echo "🔄 Is PR Build: ${{ needs.version.outputs.is_pr_build }}"
192
-
193
- # 将原本的 merge job 调整,作为所有构建产物的准备步骤
194
- prepare-artifacts:
173
+ publish-pr:
195
174
  needs: [build, version]
196
- name: Prepare Artifacts
175
+ name: Publish PR Build
197
176
  runs-on: ubuntu-latest
177
+ # Grant write permissions for creating release and commenting on PR
178
+ permissions:
179
+ contents: write
180
+ pull-requests: write
198
181
  outputs:
199
182
  artifact_path: ${{ steps.set_path.outputs.path }}
200
183
  steps:
184
+ - uses: actions/checkout@v4
185
+ with:
186
+ fetch-depth: 0
187
+
201
188
  # 下载所有平台的构建产物
202
189
  - name: Download artifacts
203
190
  uses: actions/download-artifact@v4
@@ -210,66 +197,6 @@ jobs:
210
197
  - name: List artifacts
211
198
  run: ls -R release
212
199
 
213
- # 设置构建产物路径,供后续 job 使用
214
- - name: Set artifact path
215
- id: set_path
216
- run: echo "path=release" >> $GITHUB_OUTPUT
217
-
218
- # 正式版发布 job - 只处理 release 触发的场景
219
- publish-release:
220
- # 只在 release 事件触发且不是 PR 构建时执行
221
- if: |
222
- github.event_name == 'release' &&
223
- needs.version.outputs.is_pr_build != 'true'
224
- needs: [prepare-artifacts, version]
225
- name: Publish Release
226
- runs-on: ubuntu-latest
227
- steps:
228
- - uses: actions/checkout@v4
229
- with:
230
- fetch-depth: 0
231
-
232
- # 下载构建产物
233
- - name: Download artifacts
234
- uses: actions/download-artifact@v4
235
- with:
236
- path: ${{ needs.prepare-artifacts.outputs.artifact_path }}
237
- pattern: release-*
238
- merge-multiple: true
239
-
240
- # 将构建产物上传到现有 release
241
- - name: Upload to Release
242
- uses: softprops/action-gh-release@v1
243
- with:
244
- tag_name: ${{ github.event.release.tag_name }}
245
- files: |
246
- ${{ needs.prepare-artifacts.outputs.artifact_path }}/latest*
247
- ${{ needs.prepare-artifacts.outputs.artifact_path }}/*.dmg*
248
- ${{ needs.prepare-artifacts.outputs.artifact_path }}/*.zip*
249
- ${{ needs.prepare-artifacts.outputs.artifact_path }}/*.exe*
250
- ${{ needs.prepare-artifacts.outputs.artifact_path }}/*.AppImage
251
- env:
252
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
253
-
254
- # PR 构建的处理步骤
255
- publish-pr:
256
- if: needs.version.outputs.is_pr_build == 'true'
257
- needs: [prepare-artifacts, version]
258
- name: Publish PR Build
259
- runs-on: ubuntu-latest
260
- steps:
261
- - uses: actions/checkout@v4
262
- with:
263
- fetch-depth: 0
264
-
265
- # 下载构建产物
266
- - name: Download artifacts
267
- uses: actions/download-artifact@v4
268
- with:
269
- path: ${{ needs.prepare-artifacts.outputs.artifact_path }}
270
- pattern: release-*
271
- merge-multiple: true
272
-
273
200
  # 生成PR发布描述
274
201
  - name: Generate PR Release Body
275
202
  id: pr_release_body
@@ -287,22 +214,22 @@ jobs:
287
214
 
288
215
  return body;
289
216
 
290
- # 为构建产物创建一个临时发布
291
217
  - name: Create Temporary Release for PR
292
218
  id: create_release
293
219
  uses: softprops/action-gh-release@v1
294
220
  with:
295
221
  name: PR Build v${{ needs.version.outputs.version }}
296
- tag_name: pr-build-${{ github.event.pull_request.number }}-${{ github.sha }}
222
+ tag_name: v${{ needs.version.outputs.version }}
223
+ # tag_name: pr-build-${{ github.event.pull_request.number }}-${{ github.sha }}
297
224
  body: ${{ steps.pr_release_body.outputs.result }}
298
225
  draft: false
299
226
  prerelease: true
300
227
  files: |
301
- ${{ needs.prepare-artifacts.outputs.artifact_path }}/latest*
302
- ${{ needs.prepare-artifacts.outputs.artifact_path }}/*.dmg*
303
- ${{ needs.prepare-artifacts.outputs.artifact_path }}/*.zip*
304
- ${{ needs.prepare-artifacts.outputs.artifact_path }}/*.exe*
305
- ${{ needs.prepare-artifacts.outputs.artifact_path }}/*.AppImage
228
+ release/latest*
229
+ release/*.dmg*
230
+ release/*.zip*
231
+ release/*.exe*
232
+ release/*.AppImage
306
233
  env:
307
234
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
308
235
 
@@ -315,17 +242,12 @@ jobs:
315
242
  const releaseUrl = "${{ steps.create_release.outputs.url }}";
316
243
  const prCommentGenerator = require('${{ github.workspace }}/.github/scripts/pr-comment.js');
317
244
 
318
- const body = await prCommentGenerator({
245
+ const result = await prCommentGenerator({
319
246
  github,
320
247
  context,
321
248
  releaseUrl,
322
249
  version: "${{ needs.version.outputs.version }}",
323
- tag: "pr-build-${{ github.event.pull_request.number }}-${{ github.sha }}"
250
+ tag: "v${{ needs.version.outputs.version }}"
324
251
  });
325
252
 
326
- github.rest.issues.createComment({
327
- issue_number: context.issue.number,
328
- owner: context.repo.owner,
329
- repo: context.repo.repo,
330
- body: body
331
- });
253
+ console.log(`评论状态: ${result.updated ? '已更新' : '已创建'}, ID: ${result.id}`);
@@ -0,0 +1,196 @@
1
+ name: Release Desktop
2
+
3
+ on:
4
+ release:
5
+ types: [published] # 发布 release 时触发构建
6
+
7
+ # 确保同一时间只运行一个相同的 workflow,取消正在进行的旧的运行
8
+ concurrency:
9
+ group: ${{ github.ref }}-${{ github.workflow }}
10
+ cancel-in-progress: true
11
+
12
+ # Add default permissions
13
+ permissions: read-all
14
+
15
+ jobs:
16
+ test:
17
+ name: Code quality check
18
+ # 添加 PR label 触发条件,只有添加了 Build Desktop 标签的 PR 才会触发构建
19
+ runs-on: ubuntu-latest # 只在 ubuntu 上运行一次检查
20
+ steps:
21
+ - name: Checkout base
22
+ uses: actions/checkout@v4
23
+ with:
24
+ fetch-depth: 0
25
+
26
+ - name: Setup Node.js
27
+ uses: actions/setup-node@v4
28
+ with:
29
+ node-version: 22
30
+
31
+ - name: Setup pnpm
32
+ uses: pnpm/action-setup@v2
33
+ with:
34
+ version: 9
35
+
36
+ - name: Install deps
37
+ run: pnpm install
38
+
39
+ - name: Lint
40
+ run: pnpm run lint
41
+
42
+ version:
43
+ name: Determine version
44
+ runs-on: ubuntu-latest
45
+ outputs:
46
+ # 输出版本信息,供后续 job 使用
47
+ version: ${{ steps.set_version.outputs.version }}
48
+ is_pr_build: ${{ steps.set_version.outputs.is_pr_build }}
49
+ steps:
50
+ - uses: actions/checkout@v4
51
+ with:
52
+ fetch-depth: 0
53
+
54
+ - name: Setup Node.js
55
+ uses: actions/setup-node@v4
56
+ with:
57
+ node-version: 22
58
+
59
+ # 主要逻辑:确定构建版本号
60
+ - name: Set version
61
+ id: set_version
62
+ run: |
63
+ # 从 apps/desktop/package.json 读取基础版本号
64
+ base_version=$(node -p "require('./apps/desktop/package.json').version")
65
+
66
+ # Release 事件直接使用 release tag 作为版本号,去掉可能的 v 前缀
67
+ version="${{ github.event.release.tag_name }}"
68
+ version="${version#v}"
69
+ echo "version=${version}" >> $GITHUB_OUTPUT
70
+ echo "is_pr_build=false" >> $GITHUB_OUTPUT
71
+ echo "📦 Release Version: ${version}"
72
+
73
+ # 输出版本信息总结,方便在 GitHub Actions 界面查看
74
+ - name: Version Summary
75
+ run: |
76
+ echo "🚦 Release Version: ${{ steps.set_version.outputs.version }}"
77
+ echo "🔄 Is PR Build: ${{ steps.set_version.outputs.is_pr_build }}"
78
+
79
+ build:
80
+ needs: [version, test]
81
+ name: Build Desktop App
82
+ runs-on: ${{ matrix.os }}
83
+ strategy:
84
+ matrix:
85
+ # 暂时先支持 macOS
86
+ os: [macos-latest]
87
+ # os: [macos-latest, windows-latest, ubuntu-latest]
88
+ steps:
89
+ - uses: actions/checkout@v4
90
+ with:
91
+ fetch-depth: 0
92
+
93
+ - name: Setup Node.js
94
+ uses: actions/setup-node@v4
95
+ with:
96
+ node-version: 22
97
+
98
+ - name: Setup pnpm
99
+ uses: pnpm/action-setup@v2
100
+ with:
101
+ version: 9
102
+
103
+ # node-linker=hoisted 模式将可以确保 asar 压缩可用
104
+ - name: Install deps
105
+ run: pnpm install --node-linker=hoisted
106
+
107
+ - name: Install deps on Desktop
108
+ run: npm run install-isolated --prefix=./apps/desktop
109
+
110
+ # 设置 package.json 的版本号
111
+ - name: Set package version
112
+ run: npm run workflow:set-desktop-version ${{ needs.version.outputs.version }} beta
113
+
114
+ # macOS 构建处理
115
+ - name: Build artifact on macOS
116
+ if: runner.os == 'macOS'
117
+ run: npm run desktop:build
118
+ env:
119
+ UPDATE_CHANNEL: 'stable'
120
+ APP_URL: http://localhost:3015
121
+ DATABASE_URL: 'postgresql://postgres@localhost:5432/postgres'
122
+ # 默认添加一个加密 SECRET
123
+ KEY_VAULTS_SECRET: 'oLXWIiR/AKF+rWaqy9lHkrYgzpATbW3CtJp3UfkVgpE='
124
+ # macOS 签名和公证配置
125
+ CSC_LINK: ${{ secrets.APPLE_CERTIFICATE_BASE64 }}
126
+ CSC_KEY_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
127
+ # allow provisionally
128
+ CSC_FOR_PULL_REQUEST: true
129
+ APPLE_ID: ${{ secrets.APPLE_ID }}
130
+ APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}
131
+ APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
132
+
133
+ NEXT_PUBLIC_DESKTOP_PROJECT_ID: ${{ secrets.UMAMI_BETA_DESKTOP_PROJECT_ID }}
134
+ NEXT_PUBLIC_DESKTOP_UMAMI_BASE_URL: ${{ secrets.UMAMI_BETA_DESKTOP_BASE_URL }}
135
+
136
+ # 非 macOS 平台构建处理
137
+ - name: Build artifact on other platforms
138
+ if: runner.os != 'macOS'
139
+ run: npm run desktop:build
140
+ env:
141
+ UPDATE_CHANNEL: 'stable'
142
+ APP_URL: http://localhost:3015
143
+ DATABASE_URL: 'postgresql://postgres@localhost:5432/postgres'
144
+ KEY_VAULTS_SECRET: 'oLXWIiR/AKF+rWaqy9lHkrYgzpATbW3CtJp3UfkVgpE='
145
+ NEXT_PUBLIC_DESKTOP_PROJECT_ID: ${{ secrets.UMAMI_BETA_DESKTOP_PROJECT_ID }}
146
+ NEXT_PUBLIC_DESKTOP_UMAMI_BASE_URL: ${{ secrets.UMAMI_BETA_DESKTOP_BASE_URL }}
147
+
148
+ # 上传构建产物,移除了 zip 相关部分
149
+ - name: Upload artifact
150
+ uses: actions/upload-artifact@v4
151
+ with:
152
+ name: release-${{ matrix.os }}
153
+ path: |
154
+ apps/desktop/release/latest*
155
+ apps/desktop/release/*.dmg*
156
+ apps/desktop/release/*.zip*
157
+ apps/desktop/release/*.exe*
158
+ apps/desktop/release/*.AppImage
159
+ retention-days: 5
160
+
161
+ # 正式版发布 job
162
+ publish-release:
163
+ needs: [build, version]
164
+ name: Prepare Artifacts
165
+ runs-on: ubuntu-latest
166
+ # Grant write permission to contents for uploading release assets
167
+ permissions:
168
+ contents: write
169
+ outputs:
170
+ artifact_path: ${{ steps.set_path.outputs.path }}
171
+ steps:
172
+ # 下载所有平台的构建产物
173
+ - name: Download artifacts
174
+ uses: actions/download-artifact@v4
175
+ with:
176
+ path: release
177
+ pattern: release-*
178
+ merge-multiple: true
179
+
180
+ # 列出所有构建产物
181
+ - name: List artifacts
182
+ run: ls -R release
183
+
184
+ # 将构建产物上传到现有 release
185
+ - name: Upload to Release
186
+ uses: softprops/action-gh-release@v1
187
+ with:
188
+ tag_name: ${{ github.event.release.tag_name }}
189
+ files: |
190
+ ${{ needs.prepare-artifacts.outputs.artifact_path }}/latest*
191
+ ${{ needs.prepare-artifacts.outputs.artifact_path }}/*.dmg*
192
+ ${{ needs.prepare-artifacts.outputs.artifact_path }}/*.zip*
193
+ ${{ needs.prepare-artifacts.outputs.artifact_path }}/*.exe*
194
+ ${{ needs.prepare-artifacts.outputs.artifact_path }}/*.AppImage
195
+ env:
196
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
package/CHANGELOG.md CHANGED
@@ -2,6 +2,31 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ## [Version 1.83.0](https://github.com/lobehub/lobe-chat/compare/v1.82.10...v1.83.0)
6
+
7
+ <sup>Released on **2025-04-27**</sup>
8
+
9
+ #### ✨ Features
10
+
11
+ - **misc**: Support desktop release framework and workflow.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### What's improved
19
+
20
+ - **misc**: Support desktop release framework and workflow, closes [#6474](https://github.com/lobehub/lobe-chat/issues/6474) ([ed97363](https://github.com/lobehub/lobe-chat/commit/ed97363))
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 1.82.10](https://github.com/lobehub/lobe-chat/compare/v1.82.9...v1.82.10)
6
31
 
7
32
  <sup>Released on **2025-04-26**</sup>
@@ -0,0 +1,31 @@
1
+ const { defineConfig } = require('@lobehub/i18n-cli');
2
+
3
+ module.exports = defineConfig({
4
+ entry: 'resources/locales/zh-CN',
5
+ entryLocale: 'zh-CN',
6
+ output: 'resources/locales',
7
+ outputLocales: [
8
+ 'ar',
9
+ 'bg-BG',
10
+ 'zh-TW',
11
+ 'en-US',
12
+ 'ru-RU',
13
+ 'ja-JP',
14
+ 'ko-KR',
15
+ 'fr-FR',
16
+ 'tr-TR',
17
+ 'es-ES',
18
+ 'pt-BR',
19
+ 'de-DE',
20
+ 'it-IT',
21
+ 'nl-NL',
22
+ 'pl-PL',
23
+ 'vi-VN',
24
+ 'fa-IR',
25
+ ],
26
+ temperature: 0,
27
+ modelName: 'gpt-4o-mini',
28
+ experimental: {
29
+ jsonMode: true,
30
+ },
31
+ });
@@ -0,0 +1,47 @@
1
+ ## Menu 实现框架
2
+
3
+ ```
4
+ apps/desktop/src/main/
5
+ ├── core/
6
+ │ ├── App.ts // 应用核心类
7
+ │ ├── BrowserManager.ts // 浏览器窗口管理
8
+ │ └── MenuManager.ts // 新增:菜单管理核心类,负责选择和协调平台实现
9
+ ├── menus/ // 新增:菜单实现目录
10
+ │ ├── index.ts // 导出平台实现和接口
11
+ │ ├── types.ts // 定义菜单平台接口 IMenuPlatform
12
+ │ └── impl/ // 平台特定实现目录
13
+ │ ├── BaseMenuPlatform.ts // 基础平台类,注入App
14
+ │ ├── DarwinMenu.ts // macOS 充血模型实现
15
+ │ ├── WindowsMenu.ts // Windows 充血模型实现
16
+ │ └── LinuxMenu.ts // Linux 充血模型实现
17
+ ├── controllers/
18
+ │ └── MenuCtr.ts // 菜单控制器,处理渲染进程调用
19
+ ```
20
+
21
+ ## i18n
22
+
23
+ src/main/
24
+ ├── core/
25
+ │ ├── I18nManager.ts //i18n 管理器
26
+ │ └── App.ts // 应用主类,集成 i18n
27
+ ├── locales/
28
+ │ ├── index.ts // 导出 i18n 相关功能
29
+ │ ├── resources.ts // 资源加载逻辑
30
+ │ └── default/ // 默认中文翻译源文件
31
+ │ ├── index.ts // 导出所有翻译
32
+ │ ├── menu.ts // 菜单翻译
33
+ │ ├── dialog.ts // 对话框翻译
34
+ │ └── common.ts // 通用翻译
35
+
36
+ 主进程 i18n 国际化管理
37
+ 使用方式:
38
+
39
+ 1. 直接导入 i18nManager 实例:
40
+ import i18nManager from '@/locales';
41
+
42
+ 2. 使用翻译函数:
43
+ import {t} from '@/locales';
44
+ const translated = t ('key');
45
+
46
+ 3. 添加新翻译:
47
+ 在 locales/default/ 目录下添加翻译源文件
@@ -0,0 +1,6 @@
1
+ # LobeHub Desktop
2
+
3
+ 构建路径:
4
+
5
+ - dist: 构建产物路径
6
+ - release: 发布产物路径
Binary file
@@ -0,0 +1,12 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>com.apple.security.cs.allow-jit</key>
6
+ <true/>
7
+ <key>com.apple.security.cs.allow-unsigned-executable-memory</key>
8
+ <true/>
9
+ <key>com.apple.security.cs.allow-dyld-environment-variables</key>
10
+ <true/>
11
+ </dict>
12
+ </plist>
Binary file
Binary file
Binary file