@lobehub/chat 1.124.2 → 1.124.3
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.
- package/.github/scripts/pr-comment.js +2 -11
- package/.github/workflows/desktop-pr-build.yml +12 -86
- package/.github/workflows/release-desktop-beta.yml +20 -91
- package/CHANGELOG.md +25 -0
- package/apps/desktop/electron-builder.js +4 -8
- package/changelog/v1.json +9 -0
- package/package.json +1 -1
- package/packages/const/package.json +3 -1
- package/packages/const/src/analytics.ts +1 -1
- package/packages/const/src/desktop.ts +3 -2
- package/packages/const/src/discover.ts +3 -2
- package/packages/const/src/guide.ts +2 -2
- package/packages/const/src/index.ts +1 -0
- package/packages/const/src/settings/common.ts +1 -1
- package/packages/const/src/settings/genUserLLMConfig.test.ts +1 -2
- package/packages/const/src/settings/genUserLLMConfig.ts +1 -2
- package/packages/const/src/settings/index.ts +1 -3
- package/packages/const/src/settings/knowledge.ts +1 -1
- package/packages/const/src/settings/llm.ts +2 -4
- package/packages/const/src/settings/systemAgent.ts +1 -5
- package/packages/const/src/settings/tts.ts +1 -1
- package/packages/const/src/url.ts +2 -2
- package/packages/model-runtime/src/higress/index.ts +2 -3
- package/packages/types/src/discover/index.ts +0 -8
- package/packages/types/src/index.ts +2 -0
- package/packages/types/src/tool/index.ts +1 -0
- package/packages/types/src/tool/tool.ts +1 -1
- package/packages/types/src/user/settings/index.ts +1 -2
- package/packages/utils/vitest.config.mts +0 -1
- package/src/app/(backend)/webapi/models/[provider]/pull/route.ts +0 -2
- package/src/app/(backend)/webapi/models/[provider]/route.ts +0 -2
- package/src/app/(backend)/webapi/text-to-image/[provider]/route.ts +0 -2
- package/src/app/(backend)/webapi/trace/route.ts +0 -2
- package/packages/const/src/settings/sync.ts +0 -5
- package/scripts/electronWorkflow/mergeMacReleaseFiles.ts +0 -207
@@ -36,19 +36,10 @@ module.exports = async ({ github, context, releaseUrl, version, tag }) => {
|
|
36
36
|
// Generate combined download table
|
37
37
|
let assetTable = '| Platform | File | Size |\n| --- | --- | --- |\n';
|
38
38
|
|
39
|
-
// Add macOS assets
|
39
|
+
// Add macOS assets
|
40
40
|
macAssets.forEach((asset) => {
|
41
41
|
const sizeInMB = (asset.size / (1024 * 1024)).toFixed(2);
|
42
|
-
|
43
|
-
// Detect architecture from filename
|
44
|
-
let architecture = '';
|
45
|
-
if (asset.name.includes('arm64')) {
|
46
|
-
architecture = ' (Apple Silicon)';
|
47
|
-
} else if (asset.name.includes('x64') || asset.name.includes('-mac.')) {
|
48
|
-
architecture = ' (Intel)';
|
49
|
-
}
|
50
|
-
|
51
|
-
assetTable += `| macOS${architecture} | [${asset.name}](${asset.browser_download_url}) | ${sizeInMB} MB |\n`;
|
42
|
+
assetTable += `| macOS | [${asset.name}](${asset.browser_download_url}) | ${sizeInMB} MB |\n`;
|
52
43
|
});
|
53
44
|
|
54
45
|
// Add Windows assets
|
@@ -32,18 +32,18 @@ jobs:
|
|
32
32
|
with:
|
33
33
|
node-version: 22
|
34
34
|
|
35
|
-
- name:
|
36
|
-
uses:
|
35
|
+
- name: Setup pnpm
|
36
|
+
uses: pnpm/action-setup@v2
|
37
37
|
with:
|
38
|
-
|
38
|
+
version: 10
|
39
39
|
|
40
40
|
- name: Install deps
|
41
|
-
run:
|
41
|
+
run: pnpm install
|
42
42
|
env:
|
43
43
|
NODE_OPTIONS: --max-old-space-size=6144
|
44
44
|
|
45
45
|
- name: Lint
|
46
|
-
run:
|
46
|
+
run: pnpm run lint
|
47
47
|
env:
|
48
48
|
NODE_OPTIONS: --max-old-space-size=6144
|
49
49
|
|
@@ -93,7 +93,7 @@ jobs:
|
|
93
93
|
runs-on: ${{ matrix.os }}
|
94
94
|
strategy:
|
95
95
|
matrix:
|
96
|
-
os: [macos-latest,
|
96
|
+
os: [macos-latest, windows-2025, ubuntu-latest]
|
97
97
|
steps:
|
98
98
|
- uses: actions/checkout@v5
|
99
99
|
with:
|
@@ -172,27 +172,6 @@ jobs:
|
|
172
172
|
NEXT_PUBLIC_DESKTOP_PROJECT_ID: ${{ secrets.UMAMI_NIGHTLY_DESKTOP_PROJECT_ID }}
|
173
173
|
NEXT_PUBLIC_DESKTOP_UMAMI_BASE_URL: ${{ secrets.UMAMI_NIGHTLY_DESKTOP_BASE_URL }}
|
174
174
|
|
175
|
-
# 处理 macOS latest-mac.yml 重命名 (避免多架构覆盖)
|
176
|
-
- name: Rename macOS latest-mac.yml for multi-architecture support
|
177
|
-
if: runner.os == 'macOS'
|
178
|
-
run: |
|
179
|
-
cd apps/desktop/release
|
180
|
-
if [ -f "latest-mac.yml" ]; then
|
181
|
-
# 根据运行环境检测架构
|
182
|
-
if [[ "${{ matrix.os }}" == *"arm64"* || "${{ matrix.os }}" == "macos-latest" ]]; then
|
183
|
-
ARCH_SUFFIX="arm"
|
184
|
-
else
|
185
|
-
ARCH_SUFFIX="intel"
|
186
|
-
fi
|
187
|
-
|
188
|
-
mv latest-mac.yml "latest-mac-${ARCH_SUFFIX}.yml"
|
189
|
-
echo "✅ Renamed latest-mac.yml to latest-mac-${ARCH_SUFFIX}.yml"
|
190
|
-
ls -la latest-mac-*.yml
|
191
|
-
else
|
192
|
-
echo "⚠️ latest-mac.yml not found, skipping rename"
|
193
|
-
ls -la latest*.yml || echo "No latest*.yml files found"
|
194
|
-
fi
|
195
|
-
|
196
175
|
# 上传构建产物
|
197
176
|
- name: Upload artifact
|
198
177
|
uses: actions/upload-artifact@v4
|
@@ -210,62 +189,8 @@ jobs:
|
|
210
189
|
apps/desktop/release/*.tar.gz*
|
211
190
|
retention-days: 5
|
212
191
|
|
213
|
-
# 合并 macOS 多架构 latest-mac.yml 文件
|
214
|
-
merge-mac-files:
|
215
|
-
needs: [build, version]
|
216
|
-
name: Merge macOS Release Files for PR
|
217
|
-
runs-on: ubuntu-latest
|
218
|
-
permissions:
|
219
|
-
contents: write
|
220
|
-
steps:
|
221
|
-
- name: Checkout repository
|
222
|
-
uses: actions/checkout@v5
|
223
|
-
|
224
|
-
- name: Setup Node.js
|
225
|
-
uses: actions/setup-node@v4
|
226
|
-
with:
|
227
|
-
node-version: 22
|
228
|
-
|
229
|
-
- name: Install required dependencies only
|
230
|
-
run: |
|
231
|
-
# 创建临时目录并安装依赖
|
232
|
-
mkdir -p temp-deps
|
233
|
-
cd temp-deps
|
234
|
-
npm init -y
|
235
|
-
npm install fs-extra yaml tsx
|
236
|
-
# 确保回到项目根目录
|
237
|
-
cd ${{ github.workspace }}
|
238
|
-
|
239
|
-
# 下载所有平台的构建产物
|
240
|
-
- name: Download artifacts
|
241
|
-
uses: actions/download-artifact@v4
|
242
|
-
with:
|
243
|
-
path: release
|
244
|
-
pattern: release-*
|
245
|
-
merge-multiple: true
|
246
|
-
|
247
|
-
# 列出下载的构建产物
|
248
|
-
- name: List downloaded artifacts
|
249
|
-
run: ls -R release
|
250
|
-
|
251
|
-
# 合并 macOS YAML 文件 (确保在项目根目录执行)
|
252
|
-
- name: Merge latest-mac.yml files
|
253
|
-
working-directory: ${{ github.workspace }}
|
254
|
-
run: NODE_PATH="${PWD}/temp-deps/node_modules" "${PWD}/temp-deps/node_modules/.bin/tsx" scripts/electronWorkflow/mergeMacReleaseFiles.ts ${{ needs.version.outputs.version }}
|
255
|
-
env:
|
256
|
-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
257
|
-
RELEASE_TAG: ${{ needs.version.outputs.version }}
|
258
|
-
|
259
|
-
# 上传合并后的构建产物
|
260
|
-
- name: Upload artifacts with merged macOS files
|
261
|
-
uses: actions/upload-artifact@v4
|
262
|
-
with:
|
263
|
-
name: merged-release-pr
|
264
|
-
path: release/
|
265
|
-
retention-days: 1
|
266
|
-
|
267
192
|
publish-pr:
|
268
|
-
needs: [
|
193
|
+
needs: [build, version]
|
269
194
|
name: Publish PR Build
|
270
195
|
runs-on: ubuntu-latest
|
271
196
|
# Grant write permissions for creating release and commenting on PR
|
@@ -279,15 +204,16 @@ jobs:
|
|
279
204
|
with:
|
280
205
|
fetch-depth: 0
|
281
206
|
|
282
|
-
#
|
283
|
-
- name: Download
|
207
|
+
# 下载所有平台的构建产物
|
208
|
+
- name: Download artifacts
|
284
209
|
uses: actions/download-artifact@v4
|
285
210
|
with:
|
286
|
-
name: merged-release-pr
|
287
211
|
path: release
|
212
|
+
pattern: release-*
|
213
|
+
merge-multiple: true
|
288
214
|
|
289
215
|
# 列出所有构建产物
|
290
|
-
- name: List
|
216
|
+
- name: List artifacts
|
291
217
|
run: ls -R release
|
292
218
|
|
293
219
|
# 生成PR发布描述
|
@@ -28,16 +28,16 @@ jobs:
|
|
28
28
|
with:
|
29
29
|
node-version: 22
|
30
30
|
|
31
|
-
- name:
|
32
|
-
uses:
|
31
|
+
- name: Setup pnpm
|
32
|
+
uses: pnpm/action-setup@v2
|
33
33
|
with:
|
34
|
-
|
34
|
+
version: 10
|
35
35
|
|
36
36
|
- name: Install deps
|
37
|
-
run:
|
37
|
+
run: pnpm install
|
38
38
|
|
39
39
|
- name: Lint
|
40
|
-
run:
|
40
|
+
run: pnpm run lint
|
41
41
|
|
42
42
|
version:
|
43
43
|
name: Determine version
|
@@ -80,7 +80,7 @@ jobs:
|
|
80
80
|
runs-on: ${{ matrix.os }}
|
81
81
|
strategy:
|
82
82
|
matrix:
|
83
|
-
os: [macos-latest,
|
83
|
+
os: [macos-latest, windows-2025, ubuntu-latest]
|
84
84
|
steps:
|
85
85
|
- uses: actions/checkout@v5
|
86
86
|
with:
|
@@ -91,14 +91,14 @@ jobs:
|
|
91
91
|
with:
|
92
92
|
node-version: 22
|
93
93
|
|
94
|
-
- name:
|
95
|
-
uses:
|
94
|
+
- name: Setup pnpm
|
95
|
+
uses: pnpm/action-setup@v2
|
96
96
|
with:
|
97
|
-
|
97
|
+
version: 10
|
98
98
|
|
99
|
-
#
|
99
|
+
# node-linker=hoisted 模式将可以确保 asar 压缩可用
|
100
100
|
- name: Install deps
|
101
|
-
run:
|
101
|
+
run: pnpm install --node-linker=hoisted
|
102
102
|
|
103
103
|
- name: Install deps on Desktop
|
104
104
|
run: npm run install-isolated --prefix=./apps/desktop
|
@@ -154,28 +154,7 @@ jobs:
|
|
154
154
|
NEXT_PUBLIC_DESKTOP_PROJECT_ID: ${{ secrets.UMAMI_BETA_DESKTOP_PROJECT_ID }}
|
155
155
|
NEXT_PUBLIC_DESKTOP_UMAMI_BASE_URL: ${{ secrets.UMAMI_BETA_DESKTOP_BASE_URL }}
|
156
156
|
|
157
|
-
#
|
158
|
-
- name: Rename macOS latest-mac.yml for multi-architecture support
|
159
|
-
if: runner.os == 'macOS'
|
160
|
-
run: |
|
161
|
-
cd apps/desktop/release
|
162
|
-
if [ -f "latest-mac.yml" ]; then
|
163
|
-
# 根据运行环境检测架构
|
164
|
-
if [[ "${{ matrix.os }}" == *"arm64"* || "${{ matrix.os }}" == "macos-latest" ]]; then
|
165
|
-
ARCH_SUFFIX="arm"
|
166
|
-
else
|
167
|
-
ARCH_SUFFIX="intel"
|
168
|
-
fi
|
169
|
-
|
170
|
-
mv latest-mac.yml "latest-mac-${ARCH_SUFFIX}.yml"
|
171
|
-
echo "✅ Renamed latest-mac.yml to latest-mac-${ARCH_SUFFIX}.yml"
|
172
|
-
ls -la latest-mac-*.yml
|
173
|
-
else
|
174
|
-
echo "⚠️ latest-mac.yml not found, skipping rename"
|
175
|
-
ls -la latest*.yml || echo "No latest*.yml files found"
|
176
|
-
fi
|
177
|
-
|
178
|
-
# 上传构建产物 (工作流处理重命名,不依赖 electron-builder 钩子)
|
157
|
+
# 上传构建产物,移除了 zip 相关部分
|
179
158
|
- name: Upload artifact
|
180
159
|
uses: actions/upload-artifact@v4
|
181
160
|
with:
|
@@ -192,32 +171,17 @@ jobs:
|
|
192
171
|
apps/desktop/release/*.tar.gz*
|
193
172
|
retention-days: 5
|
194
173
|
|
195
|
-
#
|
196
|
-
|
174
|
+
# 正式版发布 job
|
175
|
+
publish-release:
|
197
176
|
needs: [build, version]
|
198
|
-
name:
|
177
|
+
name: Publish Beta Release
|
199
178
|
runs-on: ubuntu-latest
|
179
|
+
# Grant write permission to contents for uploading release assets
|
200
180
|
permissions:
|
201
181
|
contents: write
|
182
|
+
outputs:
|
183
|
+
artifact_path: ${{ steps.set_path.outputs.path }}
|
202
184
|
steps:
|
203
|
-
- name: Checkout repository
|
204
|
-
uses: actions/checkout@v5
|
205
|
-
|
206
|
-
- name: Setup Node.js
|
207
|
-
uses: actions/setup-node@v4
|
208
|
-
with:
|
209
|
-
node-version: 22
|
210
|
-
|
211
|
-
- name: Install required dependencies only
|
212
|
-
run: |
|
213
|
-
# 创建临时目录并安装依赖
|
214
|
-
mkdir -p temp-deps
|
215
|
-
cd temp-deps
|
216
|
-
npm init -y
|
217
|
-
npm install fs-extra yaml tsx
|
218
|
-
# 确保回到项目根目录
|
219
|
-
cd ${{ github.workspace }}
|
220
|
-
|
221
185
|
# 下载所有平台的构建产物
|
222
186
|
- name: Download artifacts
|
223
187
|
uses: actions/download-artifact@v4
|
@@ -226,46 +190,11 @@ jobs:
|
|
226
190
|
pattern: release-*
|
227
191
|
merge-multiple: true
|
228
192
|
|
229
|
-
# 列出下载的构建产物
|
230
|
-
- name: List downloaded artifacts
|
231
|
-
run: ls -R release
|
232
|
-
|
233
|
-
# 合并 macOS YAML 文件 (确保在项目根目录执行)
|
234
|
-
- name: Merge latest-mac.yml files
|
235
|
-
working-directory: ${{ github.workspace }}
|
236
|
-
run: NODE_PATH="${PWD}/temp-deps/node_modules" "${PWD}/temp-deps/node_modules/.bin/tsx" scripts/electronWorkflow/mergeMacReleaseFiles.ts ${{ github.event.release.tag_name }}
|
237
|
-
env:
|
238
|
-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
239
|
-
RELEASE_TAG: ${{ github.event.release.tag_name }}
|
240
|
-
|
241
|
-
# 上传合并后的构建产物
|
242
|
-
- name: Upload artifacts with merged macOS files
|
243
|
-
uses: actions/upload-artifact@v4
|
244
|
-
with:
|
245
|
-
name: merged-release
|
246
|
-
path: release/
|
247
|
-
retention-days: 1
|
248
|
-
|
249
|
-
# 发布所有平台构建产物
|
250
|
-
publish-release:
|
251
|
-
needs: [merge-mac-files]
|
252
|
-
name: Publish Beta Release
|
253
|
-
runs-on: ubuntu-latest
|
254
|
-
permissions:
|
255
|
-
contents: write
|
256
|
-
steps:
|
257
|
-
# 下载合并后的构建产物
|
258
|
-
- name: Download merged artifacts
|
259
|
-
uses: actions/download-artifact@v4
|
260
|
-
with:
|
261
|
-
name: merged-release
|
262
|
-
path: release
|
263
|
-
|
264
193
|
# 列出所有构建产物
|
265
|
-
- name: List
|
194
|
+
- name: List artifacts
|
266
195
|
run: ls -R release
|
267
196
|
|
268
|
-
# 将构建产物上传到现有 release
|
197
|
+
# 将构建产物上传到现有 release
|
269
198
|
- name: Upload to Release
|
270
199
|
uses: softprops/action-gh-release@v1
|
271
200
|
with:
|
package/CHANGELOG.md
CHANGED
@@ -2,6 +2,31 @@
|
|
2
2
|
|
3
3
|
# Changelog
|
4
4
|
|
5
|
+
### [Version 1.124.3](https://github.com/lobehub/lobe-chat/compare/v1.124.2...v1.124.3)
|
6
|
+
|
7
|
+
<sup>Released on **2025-09-06**</sup>
|
8
|
+
|
9
|
+
#### ♻ Code Refactoring
|
10
|
+
|
11
|
+
- **misc**: Refactor to remove edge runtime and add more tests.
|
12
|
+
|
13
|
+
<br/>
|
14
|
+
|
15
|
+
<details>
|
16
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
17
|
+
|
18
|
+
#### Code refactoring
|
19
|
+
|
20
|
+
- **misc**: Refactor to remove edge runtime and add more tests, closes [#9133](https://github.com/lobehub/lobe-chat/issues/9133) ([6f87034](https://github.com/lobehub/lobe-chat/commit/6f87034))
|
21
|
+
|
22
|
+
</details>
|
23
|
+
|
24
|
+
<div align="right">
|
25
|
+
|
26
|
+
[](#readme-top)
|
27
|
+
|
28
|
+
</div>
|
29
|
+
|
5
30
|
### [Version 1.124.2](https://github.com/lobehub/lobe-chat/compare/v1.124.1...v1.124.2)
|
6
31
|
|
7
32
|
<sup>Released on **2025-09-06**</sup>
|
@@ -1,15 +1,12 @@
|
|
1
1
|
const dotenv = require('dotenv');
|
2
|
-
const os = require('node:os');
|
3
2
|
|
4
3
|
dotenv.config();
|
5
4
|
|
6
5
|
const packageJSON = require('./package.json');
|
7
6
|
|
8
7
|
const channel = process.env.UPDATE_CHANNEL;
|
9
|
-
const arch = os.arch();
|
10
8
|
|
11
9
|
console.log(`🚄 Build Version ${packageJSON.version}, Channel: ${channel}`);
|
12
|
-
console.log(`🏗️ Building for architecture: ${arch}`);
|
13
10
|
|
14
11
|
const isNightly = channel === 'nightly';
|
15
12
|
const isBeta = packageJSON.name.includes('beta');
|
@@ -90,13 +87,12 @@ const config = {
|
|
90
87
|
hardenedRuntime: true,
|
91
88
|
notarize: true,
|
92
89
|
target:
|
93
|
-
// 降低构建时间,nightly 只打
|
94
|
-
// 根据当前机器架构只构建对应架构的包
|
90
|
+
// 降低构建时间,nightly 只打 arm64
|
95
91
|
isNightly
|
96
|
-
? [{ arch: [
|
92
|
+
? [{ arch: ['arm64'], target: 'dmg' }]
|
97
93
|
: [
|
98
|
-
{ arch: [
|
99
|
-
{ arch: [
|
94
|
+
{ arch: ['x64', 'arm64'], target: 'dmg' },
|
95
|
+
{ arch: ['x64', 'arm64'], target: 'zip' },
|
100
96
|
],
|
101
97
|
},
|
102
98
|
npmRebuild: true,
|
package/changelog/v1.json
CHANGED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@lobehub/chat",
|
3
|
-
"version": "1.124.
|
3
|
+
"version": "1.124.3",
|
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",
|
@@ -1,5 +1,6 @@
|
|
1
|
-
import {
|
2
|
-
|
1
|
+
import { DesktopHotkeyConfig } from '@lobechat/types';
|
2
|
+
|
3
|
+
import { DESKTOP_HOTKEYS_REGISTRATION } from './hotkeys';
|
3
4
|
|
4
5
|
export const DESKTOP_USER_ID = 'DEFAULT_DESKTOP_USER';
|
5
6
|
|
@@ -1,10 +1,11 @@
|
|
1
|
-
import { DEFAULT_AGENT_CONFIG } from '@/const/settings';
|
2
1
|
import {
|
3
2
|
DiscoverAssistantDetail,
|
4
3
|
DiscoverModelDetail,
|
5
4
|
DiscoverPluginDetail,
|
6
5
|
DiscoverProviderDetail,
|
7
|
-
} from '
|
6
|
+
} from '@lobechat/types';
|
7
|
+
|
8
|
+
import { DEFAULT_AGENT_CONFIG } from './settings';
|
8
9
|
|
9
10
|
const DEFAULT_CREATED_AT = new Date().toISOString();
|
10
11
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import urlJoin from 'url-join';
|
2
2
|
|
3
|
-
import { BRANDING_EMAIL } from '
|
3
|
+
import { BRANDING_EMAIL } from './branding';
|
4
4
|
import {
|
5
5
|
BLOG,
|
6
6
|
DOCKER_IMAGE,
|
@@ -11,7 +11,7 @@ import {
|
|
11
11
|
SELF_HOSTING_DOCUMENTS,
|
12
12
|
USAGE_DOCUMENTS,
|
13
13
|
WIKI,
|
14
|
-
} from '
|
14
|
+
} from './url';
|
15
15
|
|
16
16
|
export const INBOX_GUIDE_SYSTEMROLE = `# Role: LobeChat Support Assistant
|
17
17
|
|
@@ -1,8 +1,7 @@
|
|
1
1
|
import { ModelProvider } from '@lobechat/model-runtime';
|
2
|
-
import { UserModelProviderConfig } from '@lobechat/types';
|
2
|
+
import { ModelProviderCard, UserModelProviderConfig } from '@lobechat/types';
|
3
3
|
|
4
4
|
import * as ProviderCards from '@/config/modelProviders';
|
5
|
-
import { ModelProviderCard } from '@/types/llm';
|
6
5
|
|
7
6
|
export const genUserLLMConfig = (specificConfig: Record<any, any>): UserModelProviderConfig => {
|
8
7
|
return Object.keys(ModelProvider).reduce((config, providerKey) => {
|
@@ -1,10 +1,9 @@
|
|
1
|
-
import { UserSettings } from '
|
1
|
+
import { UserSettings } from '@lobechat/types';
|
2
2
|
|
3
3
|
import { DEFAULT_AGENT } from './agent';
|
4
4
|
import { DEFAULT_COMMON_SETTINGS } from './common';
|
5
5
|
import { DEFAULT_HOTKEY_CONFIG } from './hotkey';
|
6
6
|
import { DEFAULT_LLM_CONFIG } from './llm';
|
7
|
-
import { DEFAULT_SYNC_CONFIG } from './sync';
|
8
7
|
import { DEFAULT_SYSTEM_AGENT_CONFIG } from './systemAgent';
|
9
8
|
import { DEFAULT_TOOL_CONFIG } from './tool';
|
10
9
|
import { DEFAULT_TTS_CONFIG } from './tts';
|
@@ -22,7 +21,6 @@ export const DEFAULT_SETTINGS: UserSettings = {
|
|
22
21
|
hotkey: DEFAULT_HOTKEY_CONFIG,
|
23
22
|
keyVaults: {},
|
24
23
|
languageModel: DEFAULT_LLM_CONFIG,
|
25
|
-
sync: DEFAULT_SYNC_CONFIG,
|
26
24
|
systemAgent: DEFAULT_SYSTEM_AGENT_CONFIG,
|
27
25
|
tool: DEFAULT_TOOL_CONFIG,
|
28
26
|
tts: DEFAULT_TTS_CONFIG,
|
@@ -1,5 +1,3 @@
|
|
1
|
-
import { ModelProvider } from '@lobechat/model-runtime';
|
2
|
-
|
3
1
|
import { genUserLLMConfig } from './genUserLLMConfig';
|
4
2
|
|
5
3
|
export const DEFAULT_LLM_CONFIG = genUserLLMConfig({
|
@@ -18,10 +16,10 @@ export const DEFAULT_LLM_CONFIG = genUserLLMConfig({
|
|
18
16
|
export const DEFAULT_MODEL = 'gpt-5-mini';
|
19
17
|
|
20
18
|
export const DEFAULT_EMBEDDING_MODEL = 'text-embedding-3-small';
|
21
|
-
export const DEFAULT_EMBEDDING_PROVIDER =
|
19
|
+
export const DEFAULT_EMBEDDING_PROVIDER = 'openai';
|
22
20
|
|
23
21
|
export const DEFAULT_RERANK_MODEL = 'rerank-english-v3.0';
|
24
22
|
export const DEFAULT_RERANK_PROVIDER = 'cohere';
|
25
23
|
export const DEFAULT_RERANK_QUERY_MODE = 'full_text';
|
26
24
|
|
27
|
-
export const DEFAULT_PROVIDER =
|
25
|
+
export const DEFAULT_PROVIDER = 'openai';
|
@@ -1,8 +1,4 @@
|
|
1
|
-
import {
|
2
|
-
QueryRewriteSystemAgent,
|
3
|
-
SystemAgentItem,
|
4
|
-
UserSystemAgentConfig,
|
5
|
-
} from '@/types/user/settings';
|
1
|
+
import { QueryRewriteSystemAgent, SystemAgentItem, UserSystemAgentConfig } from '@lobechat/types';
|
6
2
|
|
7
3
|
import { DEFAULT_MODEL, DEFAULT_PROVIDER } from './llm';
|
8
4
|
|
@@ -1,10 +1,10 @@
|
|
1
1
|
import qs from 'query-string';
|
2
2
|
import urlJoin from 'url-join';
|
3
3
|
|
4
|
-
import { isDev } from '@/utils/env';
|
5
|
-
|
6
4
|
import { INBOX_SESSION_ID } from './session';
|
7
5
|
|
6
|
+
const isDev = process.env.NODE_ENV === 'development';
|
7
|
+
|
8
8
|
export const UTM_SOURCE = 'chat_preview';
|
9
9
|
|
10
10
|
export const OFFICIAL_URL = 'https://lobechat.com';
|
@@ -1,6 +1,5 @@
|
|
1
|
-
import {
|
2
|
-
|
3
|
-
import type { ChatModelCard } from '@/types/llm';
|
1
|
+
import type { ChatModelCard } from '@lobechat/types';
|
2
|
+
import uniqueId from 'lodash-es/uniqueId';
|
4
3
|
|
5
4
|
import { ModelProvider } from '../types';
|
6
5
|
import { createOpenAICompatibleRuntime } from '../utils/openaiCompatibleFactory';
|
@@ -1,6 +1,3 @@
|
|
1
|
-
import { Locales } from '@/locales/resources';
|
2
|
-
import { PageProps } from '@/types/next';
|
3
|
-
|
4
1
|
export * from './assistants';
|
5
2
|
export * from './mcp';
|
6
3
|
export * from './models';
|
@@ -16,11 +13,6 @@ export enum DiscoverTab {
|
|
16
13
|
Providers = 'provider',
|
17
14
|
}
|
18
15
|
|
19
|
-
export type DiscoverPageProps<T = string> = PageProps<
|
20
|
-
{ slug: T; variants: string },
|
21
|
-
{ hl?: Locales }
|
22
|
-
>;
|
23
|
-
|
24
16
|
export type IdentifiersResponse = {
|
25
17
|
identifier: string;
|
26
18
|
lastModified: string;
|
@@ -6,6 +6,7 @@ export * from './asyncTask';
|
|
6
6
|
export * from './auth';
|
7
7
|
export * from './chunk';
|
8
8
|
export * from './clientDB';
|
9
|
+
export * from './discover';
|
9
10
|
export * from './eval';
|
10
11
|
export * from './fetch';
|
11
12
|
export * from './hotkey';
|
@@ -17,6 +18,7 @@ export * from './rag';
|
|
17
18
|
export * from './search';
|
18
19
|
export * from './serverConfig';
|
19
20
|
export * from './session';
|
21
|
+
export * from './tool';
|
20
22
|
export * from './topic';
|
21
23
|
export * from './user';
|
22
24
|
export * from './user/settings';
|
@@ -4,13 +4,13 @@ import { UserGeneralConfig } from './general';
|
|
4
4
|
import { UserHotkeyConfig } from './hotkey';
|
5
5
|
import { UserKeyVaults } from './keyVaults';
|
6
6
|
import { UserModelProviderConfig } from './modelProvider';
|
7
|
-
import { UserSyncSettings } from './sync';
|
8
7
|
import { UserSystemAgentConfig } from './systemAgent';
|
9
8
|
import { UserToolConfig } from './tool';
|
10
9
|
import { UserTTSConfig } from './tts';
|
11
10
|
|
12
11
|
export type UserDefaultAgent = LobeAgentSettings;
|
13
12
|
|
13
|
+
export * from './filesConfig';
|
14
14
|
export * from './general';
|
15
15
|
export * from './hotkey';
|
16
16
|
export * from './keyVaults';
|
@@ -28,7 +28,6 @@ export interface UserSettings {
|
|
28
28
|
hotkey: UserHotkeyConfig;
|
29
29
|
keyVaults: UserKeyVaults;
|
30
30
|
languageModel: UserModelProviderConfig;
|
31
|
-
sync?: UserSyncSettings;
|
32
31
|
systemAgent: UserSystemAgentConfig;
|
33
32
|
tool: UserToolConfig;
|
34
33
|
tts: UserTTSConfig;
|
@@ -5,8 +5,6 @@ import { checkAuth } from '@/app/(backend)/middleware/auth';
|
|
5
5
|
import { initModelRuntimeWithUserPayload } from '@/server/modules/ModelRuntime';
|
6
6
|
import { createErrorResponse } from '@/utils/errorResponse';
|
7
7
|
|
8
|
-
export const runtime = 'edge';
|
9
|
-
|
10
8
|
export const POST = checkAuth(async (req, { params, jwtPayload }) => {
|
11
9
|
const { provider } = await params;
|
12
10
|
|
@@ -6,8 +6,6 @@ import { checkAuth } from '@/app/(backend)/middleware/auth';
|
|
6
6
|
import { initModelRuntimeWithUserPayload } from '@/server/modules/ModelRuntime';
|
7
7
|
import { createErrorResponse } from '@/utils/errorResponse';
|
8
8
|
|
9
|
-
export const runtime = 'edge';
|
10
|
-
|
11
9
|
const noNeedAPIKey = (provider: string) => [ModelProvider.OpenRouter].includes(provider as any);
|
12
10
|
|
13
11
|
export const GET = checkAuth(async (req, { params, jwtPayload }) => {
|
@@ -6,8 +6,6 @@ import { checkAuth } from '@/app/(backend)/middleware/auth';
|
|
6
6
|
import { initModelRuntimeWithUserPayload } from '@/server/modules/ModelRuntime';
|
7
7
|
import { createErrorResponse } from '@/utils/errorResponse';
|
8
8
|
|
9
|
-
export const runtime = 'edge';
|
10
|
-
|
11
9
|
export const preferredRegion = [
|
12
10
|
'arn1',
|
13
11
|
'bom1',
|
@@ -4,8 +4,6 @@ import { after } from 'next/server';
|
|
4
4
|
import { TraceClient } from '@/libs/traces';
|
5
5
|
import { TraceEventBasePayload, TraceEventPayloads } from '@/types/trace';
|
6
6
|
|
7
|
-
export const runtime = 'edge';
|
8
|
-
|
9
7
|
export const POST = async (req: Request) => {
|
10
8
|
type RequestData = TraceEventPayloads & TraceEventBasePayload;
|
11
9
|
const data = (await req.json()) as RequestData;
|
@@ -1,207 +0,0 @@
|
|
1
|
-
/* eslint-disable unicorn/no-process-exit, unicorn/prefer-top-level-await */
|
2
|
-
import fs from 'fs-extra';
|
3
|
-
import path from 'node:path';
|
4
|
-
import { parse, stringify } from 'yaml';
|
5
|
-
|
6
|
-
interface LatestMacYml {
|
7
|
-
files: Array<{
|
8
|
-
sha512: string;
|
9
|
-
size: number;
|
10
|
-
url: string;
|
11
|
-
}>;
|
12
|
-
path: string;
|
13
|
-
releaseDate: string;
|
14
|
-
sha512: string;
|
15
|
-
version: string;
|
16
|
-
}
|
17
|
-
|
18
|
-
// 配置
|
19
|
-
const RELEASE_TAG = process.env.RELEASE_TAG || process.argv[2];
|
20
|
-
const FILE_NAME = 'latest-mac.yml';
|
21
|
-
const RELEASE_DIR = path.resolve('release');
|
22
|
-
|
23
|
-
// 验证环境变量和输入
|
24
|
-
if (!RELEASE_TAG) {
|
25
|
-
console.error('❌ RELEASE_TAG environment variable or argument is required');
|
26
|
-
process.exit(1);
|
27
|
-
}
|
28
|
-
|
29
|
-
// 验证 release tag 格式
|
30
|
-
if (!/^v?\d+\.\d+\.\d+/.test(RELEASE_TAG)) {
|
31
|
-
console.error(`❌ Invalid RELEASE_TAG format: ${RELEASE_TAG}. Expected format: v1.2.3`);
|
32
|
-
process.exit(1);
|
33
|
-
}
|
34
|
-
|
35
|
-
/**
|
36
|
-
* 检测 latest-mac.yml 文件的平台类型
|
37
|
-
*/
|
38
|
-
function detectPlatform(yamlContent: LatestMacYml): 'intel' | 'arm' | 'both' | 'none' {
|
39
|
-
const hasIntel = yamlContent.files.some((file) => file.url.includes('-x64.dmg'));
|
40
|
-
const hasArm = yamlContent.files.some((file) => file.url.includes('-arm64.dmg'));
|
41
|
-
|
42
|
-
if (hasIntel && hasArm) return 'both';
|
43
|
-
if (hasIntel && !hasArm) return 'intel';
|
44
|
-
if (!hasIntel && hasArm) return 'arm';
|
45
|
-
return 'none';
|
46
|
-
}
|
47
|
-
|
48
|
-
/**
|
49
|
-
* 合并两个 latest-mac.yml 文件
|
50
|
-
* @param intelContent Intel 平台的 YAML 内容
|
51
|
-
* @param armContent ARM 平台的 YAML 内容
|
52
|
-
*/
|
53
|
-
function mergeYamlFiles(intelContent: LatestMacYml, armContent: LatestMacYml): string {
|
54
|
-
// 以 Intel 为基础(保持兼容性)
|
55
|
-
const merged: LatestMacYml = {
|
56
|
-
...intelContent,
|
57
|
-
files: [...intelContent.files, ...armContent.files],
|
58
|
-
};
|
59
|
-
|
60
|
-
// 使用 yaml 库生成,保持 sha512 在同一行
|
61
|
-
return stringify(merged, {
|
62
|
-
lineWidth: 0, // 不换行
|
63
|
-
});
|
64
|
-
}
|
65
|
-
|
66
|
-
// GitHub API functions removed since we're working with local files only
|
67
|
-
|
68
|
-
/**
|
69
|
-
* 读取本地文件
|
70
|
-
*/
|
71
|
-
function readLocalFile(filePath: string): string | null {
|
72
|
-
try {
|
73
|
-
if (fs.existsSync(filePath)) {
|
74
|
-
const content = fs.readFileSync(filePath, 'utf8');
|
75
|
-
console.log(`✅ Read local file: ${filePath} (${content.length} chars)`);
|
76
|
-
return content;
|
77
|
-
}
|
78
|
-
console.log(`⚠️ Local file not found: ${filePath}`);
|
79
|
-
return null;
|
80
|
-
} catch (error) {
|
81
|
-
console.error(`❌ Error reading local file ${filePath}:`, error);
|
82
|
-
return null;
|
83
|
-
}
|
84
|
-
}
|
85
|
-
|
86
|
-
/**
|
87
|
-
* 写入本地文件
|
88
|
-
*/
|
89
|
-
function writeLocalFile(filePath: string, content: string): void {
|
90
|
-
try {
|
91
|
-
fs.writeFileSync(filePath, content, 'utf8');
|
92
|
-
console.log(`✅ Written local file: ${filePath} (${content.length} chars)`);
|
93
|
-
} catch (error) {
|
94
|
-
console.error(`❌ Error writing local file ${filePath}:`, error);
|
95
|
-
throw error;
|
96
|
-
}
|
97
|
-
}
|
98
|
-
|
99
|
-
/**
|
100
|
-
* 主函数
|
101
|
-
*/
|
102
|
-
async function main(): Promise<void> {
|
103
|
-
try {
|
104
|
-
console.log(`🚀 Starting macOS Release file merge for ${RELEASE_TAG}`);
|
105
|
-
console.log(`📁 Working directory: ${RELEASE_DIR}`);
|
106
|
-
|
107
|
-
// 1. 检查 release 目录下的所有文件
|
108
|
-
const releaseFiles = fs.readdirSync(RELEASE_DIR);
|
109
|
-
console.log(`📂 Files in release directory: ${releaseFiles.join(', ')}`);
|
110
|
-
|
111
|
-
// 2. 查找所有 latest-mac*.yml 文件
|
112
|
-
const macYmlFiles = releaseFiles.filter(
|
113
|
-
(f) => f.startsWith('latest-mac') && f.endsWith('.yml'),
|
114
|
-
);
|
115
|
-
console.log(`🔍 Found macOS YAML files: ${macYmlFiles.join(', ')}`);
|
116
|
-
|
117
|
-
if (macYmlFiles.length === 0) {
|
118
|
-
console.log('⚠️ No macOS YAML files found, skipping merge');
|
119
|
-
return;
|
120
|
-
}
|
121
|
-
|
122
|
-
// 3. 处理找到的文件,识别平台
|
123
|
-
const macFiles: Array<{
|
124
|
-
content: string;
|
125
|
-
filename: string;
|
126
|
-
platform: 'intel' | 'arm';
|
127
|
-
yaml: LatestMacYml;
|
128
|
-
}> = [];
|
129
|
-
|
130
|
-
for (const fileName of macYmlFiles) {
|
131
|
-
const filePath = path.join(RELEASE_DIR, fileName);
|
132
|
-
const content = readLocalFile(filePath);
|
133
|
-
|
134
|
-
if (!content) continue;
|
135
|
-
|
136
|
-
try {
|
137
|
-
const yamlContent = parse(content) as LatestMacYml;
|
138
|
-
const platform = detectPlatform(yamlContent);
|
139
|
-
|
140
|
-
if (platform === 'intel' || platform === 'arm') {
|
141
|
-
macFiles.push({ content, filename: fileName, platform, yaml: yamlContent });
|
142
|
-
console.log(`🔍 Detected ${platform} platform in ${fileName}`);
|
143
|
-
} else if (platform === 'both') {
|
144
|
-
console.log(`✅ Found already merged file: ${fileName}`);
|
145
|
-
// 如果已经是合并后的文件,直接复制为最终文件
|
146
|
-
writeLocalFile(path.join(RELEASE_DIR, FILE_NAME), content);
|
147
|
-
return;
|
148
|
-
} else {
|
149
|
-
console.log(`⚠️ Unknown platform type: ${platform} in ${fileName}`);
|
150
|
-
}
|
151
|
-
} catch (error) {
|
152
|
-
console.warn(`⚠️ Failed to parse ${fileName}:`, error);
|
153
|
-
}
|
154
|
-
}
|
155
|
-
|
156
|
-
// 4. 检查是否有两个不同平台的文件
|
157
|
-
const intelFiles = macFiles.filter((f) => f.platform === 'intel');
|
158
|
-
const armFiles = macFiles.filter((f) => f.platform === 'arm');
|
159
|
-
|
160
|
-
if (intelFiles.length === 0 && armFiles.length === 0) {
|
161
|
-
console.log('⚠️ No valid platform files found');
|
162
|
-
return;
|
163
|
-
}
|
164
|
-
|
165
|
-
if (intelFiles.length === 0) {
|
166
|
-
console.log('⚠️ No Intel files found, using ARM only');
|
167
|
-
writeLocalFile(path.join(RELEASE_DIR, FILE_NAME), armFiles[0].content);
|
168
|
-
return;
|
169
|
-
}
|
170
|
-
|
171
|
-
if (armFiles.length === 0) {
|
172
|
-
console.log('⚠️ No ARM files found, using Intel only');
|
173
|
-
writeLocalFile(path.join(RELEASE_DIR, FILE_NAME), intelFiles[0].content);
|
174
|
-
return;
|
175
|
-
}
|
176
|
-
|
177
|
-
// 5. 合并 Intel 和 ARM 文件
|
178
|
-
const intelFile = intelFiles[0];
|
179
|
-
const armFile = armFiles[0];
|
180
|
-
|
181
|
-
console.log(`🔄 Merging ${intelFile.filename} (Intel) and ${armFile.filename} (ARM)...`);
|
182
|
-
const mergedContent = mergeYamlFiles(intelFile.yaml, armFile.yaml);
|
183
|
-
|
184
|
-
// 6. 保存合并后的文件
|
185
|
-
const mergedFilePath = path.join(RELEASE_DIR, FILE_NAME);
|
186
|
-
writeLocalFile(mergedFilePath, mergedContent);
|
187
|
-
|
188
|
-
// 7. 验证合并结果
|
189
|
-
const mergedYaml = parse(mergedContent) as LatestMacYml;
|
190
|
-
const finalPlatform = detectPlatform(mergedYaml);
|
191
|
-
|
192
|
-
if (finalPlatform === 'both') {
|
193
|
-
console.log('✅ Successfully merged both Intel and ARM platforms');
|
194
|
-
console.log(`📊 Final file contains ${mergedYaml.files.length} files`);
|
195
|
-
} else {
|
196
|
-
console.warn(`⚠️ Merge result unexpected: ${finalPlatform}`);
|
197
|
-
}
|
198
|
-
|
199
|
-
console.log('🎉 Merge complete!');
|
200
|
-
} catch (error) {
|
201
|
-
console.error('❌ Error during merge:', error);
|
202
|
-
process.exit(1);
|
203
|
-
}
|
204
|
-
}
|
205
|
-
|
206
|
-
// 运行主函数
|
207
|
-
void main();
|