@lobehub/chat 1.135.5 → 1.136.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.
- package/.cursor/rules/project-introduce.mdc +3 -5
- package/.cursor/rules/project-structure.mdc +11 -9
- package/.cursor/rules/typescript.mdc +2 -8
- package/.github/workflows/desktop-pr-build.yml +10 -10
- package/.github/workflows/release-desktop-beta.yml +7 -7
- package/CHANGELOG.md +58 -0
- package/CLAUDE.md +4 -20
- package/Dockerfile.database +2 -0
- package/apps/desktop/build/Icon-beta.Assets.car +0 -0
- package/apps/desktop/build/Icon-dev.Assets.car +0 -0
- package/apps/desktop/build/Icon-nightly.Assets.car +0 -0
- package/apps/desktop/build/Icon.Assets.car +0 -0
- package/apps/desktop/electron-builder.js +42 -0
- package/changelog/v1.json +17 -0
- package/docs/development/basic/feature-development-frontend.mdx +11 -2
- package/docs/development/basic/feature-development-frontend.zh-CN.mdx +11 -2
- package/docs/self-hosting/environment-variables/model-provider.mdx +16 -0
- package/docs/self-hosting/environment-variables/model-provider.zh-CN.mdx +16 -0
- package/package.json +1 -1
- package/packages/model-bank/package.json +1 -0
- package/packages/model-bank/src/aiModels/cerebras.ts +156 -0
- package/packages/model-bank/src/aiModels/hunyuan.ts +1 -1
- package/packages/model-bank/src/aiModels/index.ts +3 -0
- package/packages/model-bank/src/aiModels/nebius.ts +0 -319
- package/packages/model-bank/src/aiModels/ollamacloud.ts +13 -0
- package/packages/model-bank/src/aiModels/vercelaigateway.ts +0 -3
- package/packages/model-bank/src/aiModels/xai.ts +0 -69
- package/packages/model-bank/src/const/modelProvider.ts +1 -0
- package/packages/model-runtime/src/index.ts +1 -0
- package/packages/model-runtime/src/providers/cerebras/index.ts +41 -0
- package/packages/model-runtime/src/runtimeMap.ts +2 -0
- package/packages/types/src/user/settings/keyVaults.ts +1 -0
- package/src/config/modelProviders/cerebras.ts +18 -0
- package/src/config/modelProviders/index.ts +3 -0
- package/src/envs/llm.ts +6 -0
- package/src/features/PluginsUI/Render/StandaloneType/index.tsx +2 -1
|
@@ -6,18 +6,16 @@ alwaysApply: true
|
|
|
6
6
|
|
|
7
7
|
You are developing an open-source, modern-design AI chat framework: lobehub(previous lobe-chat).
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Supported platforms:
|
|
10
10
|
|
|
11
11
|
- web desktop/mobile
|
|
12
12
|
- desktop(electron)
|
|
13
|
-
- mobile app(react native)
|
|
13
|
+
- mobile app(react native), coming soon
|
|
14
14
|
|
|
15
15
|
logo emoji: 🤯
|
|
16
16
|
|
|
17
17
|
## Project Technologies Stack
|
|
18
18
|
|
|
19
|
-
read [package.json](mdc:package.json) to know all npm packages you can use.
|
|
20
|
-
|
|
21
19
|
- Next.js 15
|
|
22
20
|
- react 19
|
|
23
21
|
- TypeScript
|
|
@@ -33,6 +31,6 @@ read [package.json](mdc:package.json) to know all npm packages you can use.
|
|
|
33
31
|
- dayjs for time library
|
|
34
32
|
- lodash-es for utility library
|
|
35
33
|
- TRPC for type safe backend
|
|
36
|
-
- PGLite for client DB and PostgreSQL for backend DB
|
|
34
|
+
- PGLite for client DB and Neon PostgreSQL for backend DB
|
|
37
35
|
- Drizzle ORM
|
|
38
36
|
- Vitest for testing
|
|
@@ -5,11 +5,11 @@ alwaysApply: false
|
|
|
5
5
|
|
|
6
6
|
# LobeChat Project Structure
|
|
7
7
|
|
|
8
|
-
note: some not very important files are not shown for simplicity.
|
|
9
|
-
|
|
10
8
|
## Complete Project Structure
|
|
11
9
|
|
|
12
|
-
|
|
10
|
+
This project uses common monorepo structure. The workspace packages name use `@lobechat/` namespace.
|
|
11
|
+
|
|
12
|
+
**note**: some not very important files are not shown for simplicity.
|
|
13
13
|
|
|
14
14
|
```plaintext
|
|
15
15
|
lobe-chat/
|
|
@@ -28,10 +28,12 @@ lobe-chat/
|
|
|
28
28
|
│ │ │ ├── schemas/
|
|
29
29
|
│ │ │ └── repositories/
|
|
30
30
|
│ ├── model-bank/
|
|
31
|
+
│ │ └── src/
|
|
32
|
+
│ │ └── aiModels/
|
|
31
33
|
│ ├── model-runtime/
|
|
32
34
|
│ │ └── src/
|
|
33
|
-
│ │ ├──
|
|
34
|
-
│ │ └──
|
|
35
|
+
│ │ ├── core/
|
|
36
|
+
│ │ └── providers/
|
|
35
37
|
│ ├── types/
|
|
36
38
|
│ │ └── src/
|
|
37
39
|
│ │ ├── message/
|
|
@@ -96,14 +98,14 @@ lobe-chat/
|
|
|
96
98
|
- UI Components: `src/components`, `src/features`
|
|
97
99
|
- Global providers: `src/layout`
|
|
98
100
|
- Zustand stores: `src/store`
|
|
99
|
-
- Client Services: `src/services/`
|
|
101
|
+
- Client Services: `src/services/` cross-platform services
|
|
100
102
|
- clientDB: `src/services/<domain>/client.ts`
|
|
101
103
|
- serverDB: `src/services/<domain>/server.ts`
|
|
102
104
|
- API Routers:
|
|
103
105
|
- `src/app/(backend)/webapi` (REST)
|
|
104
106
|
- `src/server/routers/{edge|lambda|async|desktop|tools}` (tRPC)
|
|
105
107
|
- Server:
|
|
106
|
-
- Services(can access serverDB): `src/server/services`
|
|
108
|
+
- Services(can access serverDB): `src/server/services` server-used-only services
|
|
107
109
|
- Modules(can't access db): `src/server/modules` (Server only Third-party Service Module)
|
|
108
110
|
- Database:
|
|
109
111
|
- Schema (Drizzle): `packages/database/src/schemas`
|
|
@@ -113,8 +115,8 @@ lobe-chat/
|
|
|
113
115
|
|
|
114
116
|
## Data Flow Architecture
|
|
115
117
|
|
|
116
|
-
- **
|
|
117
|
-
- **
|
|
118
|
+
- **Web with ClientDB**: React UI → Client Service → Direct Model Access → PGLite (Web WASM)
|
|
119
|
+
- **Web with ServerDB**: React UI → Client Service → tRPC Lambda → Server Services → PostgreSQL (Remote)
|
|
118
120
|
- **Desktop**:
|
|
119
121
|
- Cloud sync disabled: Electron UI → Client Service → tRPC Lambda → Local Server Services → PGLite (Node WASM)
|
|
120
122
|
- Cloud sync enabled: Electron UI → Client Service → tRPC Lambda → Cloud Server Services → PostgreSQL (Remote)
|
|
@@ -29,16 +29,11 @@ alwaysApply: false
|
|
|
29
29
|
|
|
30
30
|
## Code Structure and Readability
|
|
31
31
|
|
|
32
|
-
- Refactor repeated logic into reusable functions.
|
|
33
32
|
- Prefer object destructuring when accessing and using properties.
|
|
34
33
|
- Use consistent, descriptive naming; avoid obscure abbreviations.
|
|
35
34
|
- Use semantically meaningful variable, function, and class names.
|
|
36
35
|
- Replace magic numbers or strings with well-named constants.
|
|
37
|
-
- Keep meaningful code comments; do not remove them when applying edits. Update comments when behavior changes.
|
|
38
|
-
- Ensure JSDoc comments accurately reflect the implementation.
|
|
39
|
-
- Look for opportunities to simplify or modernize code with the latest JavaScript/TypeScript features where it improves clarity.
|
|
40
36
|
- Defer formatting to tooling; ignore purely formatting-only issues and autofixable lint problems.
|
|
41
|
-
- Respect project Prettier settings.
|
|
42
37
|
|
|
43
38
|
## UI and Theming
|
|
44
39
|
|
|
@@ -50,15 +45,14 @@ alwaysApply: false
|
|
|
50
45
|
## Performance
|
|
51
46
|
|
|
52
47
|
- Prefer `for…of` loops to index-based `for` loops when feasible.
|
|
53
|
-
-
|
|
54
|
-
- Reuse existing npm packages rather than reinventing the wheel (e.g., `lodash-es/omit`).
|
|
48
|
+
- Reuse existing utils inside `packages/utils` or installed npm packages rather than reinventing the wheel.
|
|
55
49
|
- Query only the required columns from a database rather than selecting entire rows.
|
|
56
50
|
|
|
57
51
|
## Time and Consistency
|
|
58
52
|
|
|
59
53
|
- Instead of calling `Date.now()` multiple times, assign it to a constant once and reuse it to ensure consistency and improve readability.
|
|
60
54
|
|
|
61
|
-
##
|
|
55
|
+
## Logging
|
|
62
56
|
|
|
63
57
|
- Never log user private information like api key, etc
|
|
64
58
|
- Don't use `import { log } from 'debug'` to log messages, because it will directly log the message to the console.
|
|
@@ -95,7 +95,7 @@ jobs:
|
|
|
95
95
|
runs-on: ${{ matrix.os }}
|
|
96
96
|
strategy:
|
|
97
97
|
matrix:
|
|
98
|
-
os: [macos-latest, macos-
|
|
98
|
+
os: [macos-latest, macos-15-intel, windows-2025, ubuntu-latest]
|
|
99
99
|
steps:
|
|
100
100
|
- uses: actions/checkout@v5
|
|
101
101
|
with:
|
|
@@ -129,11 +129,11 @@ jobs:
|
|
|
129
129
|
run: npm run desktop:build
|
|
130
130
|
env:
|
|
131
131
|
# 设置更新通道,PR构建为nightly,否则为stable
|
|
132
|
-
UPDATE_CHANNEL:
|
|
132
|
+
UPDATE_CHANNEL: "nightly"
|
|
133
133
|
APP_URL: http://localhost:3015
|
|
134
|
-
DATABASE_URL:
|
|
134
|
+
DATABASE_URL: "postgresql://postgres@localhost:5432/postgres"
|
|
135
135
|
# 默认添加一个加密 SECRET
|
|
136
|
-
KEY_VAULTS_SECRET:
|
|
136
|
+
KEY_VAULTS_SECRET: "oLXWIiR/AKF+rWaqy9lHkrYgzpATbW3CtJp3UfkVgpE="
|
|
137
137
|
# macOS 签名和公证配置
|
|
138
138
|
CSC_LINK: ${{ secrets.APPLE_CERTIFICATE_BASE64 }}
|
|
139
139
|
CSC_KEY_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
|
|
@@ -152,10 +152,10 @@ jobs:
|
|
|
152
152
|
run: npm run desktop:build
|
|
153
153
|
env:
|
|
154
154
|
# 设置更新通道,PR构建为nightly,否则为stable
|
|
155
|
-
UPDATE_CHANNEL:
|
|
155
|
+
UPDATE_CHANNEL: "nightly"
|
|
156
156
|
APP_URL: http://localhost:3015
|
|
157
|
-
DATABASE_URL:
|
|
158
|
-
KEY_VAULTS_SECRET:
|
|
157
|
+
DATABASE_URL: "postgresql://postgres@localhost:5432/postgres"
|
|
158
|
+
KEY_VAULTS_SECRET: "oLXWIiR/AKF+rWaqy9lHkrYgzpATbW3CtJp3UfkVgpE="
|
|
159
159
|
NEXT_PUBLIC_DESKTOP_PROJECT_ID: ${{ secrets.UMAMI_NIGHTLY_DESKTOP_PROJECT_ID }}
|
|
160
160
|
NEXT_PUBLIC_DESKTOP_UMAMI_BASE_URL: ${{ secrets.UMAMI_NIGHTLY_DESKTOP_BASE_URL }}
|
|
161
161
|
# 将 TEMP 和 TMP 目录设置到 C 盘
|
|
@@ -168,10 +168,10 @@ jobs:
|
|
|
168
168
|
run: npm run desktop:build
|
|
169
169
|
env:
|
|
170
170
|
# 设置更新通道,PR构建为nightly,否则为stable
|
|
171
|
-
UPDATE_CHANNEL:
|
|
171
|
+
UPDATE_CHANNEL: "nightly"
|
|
172
172
|
APP_URL: http://localhost:3015
|
|
173
|
-
DATABASE_URL:
|
|
174
|
-
KEY_VAULTS_SECRET:
|
|
173
|
+
DATABASE_URL: "postgresql://postgres@localhost:5432/postgres"
|
|
174
|
+
KEY_VAULTS_SECRET: "oLXWIiR/AKF+rWaqy9lHkrYgzpATbW3CtJp3UfkVgpE="
|
|
175
175
|
NEXT_PUBLIC_DESKTOP_PROJECT_ID: ${{ secrets.UMAMI_NIGHTLY_DESKTOP_PROJECT_ID }}
|
|
176
176
|
NEXT_PUBLIC_DESKTOP_UMAMI_BASE_URL: ${{ secrets.UMAMI_NIGHTLY_DESKTOP_BASE_URL }}
|
|
177
177
|
|
|
@@ -82,7 +82,7 @@ jobs:
|
|
|
82
82
|
runs-on: ${{ matrix.os }}
|
|
83
83
|
strategy:
|
|
84
84
|
matrix:
|
|
85
|
-
os: [macos-latest, macos-
|
|
85
|
+
os: [macos-latest, macos-15-intel, windows-2025, ubuntu-latest]
|
|
86
86
|
steps:
|
|
87
87
|
- uses: actions/checkout@v5
|
|
88
88
|
with:
|
|
@@ -116,9 +116,9 @@ jobs:
|
|
|
116
116
|
run: npm run desktop:build
|
|
117
117
|
env:
|
|
118
118
|
APP_URL: http://localhost:3015
|
|
119
|
-
DATABASE_URL:
|
|
119
|
+
DATABASE_URL: "postgresql://postgres@localhost:5432/postgres"
|
|
120
120
|
# 默认添加一个加密 SECRET
|
|
121
|
-
KEY_VAULTS_SECRET:
|
|
121
|
+
KEY_VAULTS_SECRET: "oLXWIiR/AKF+rWaqy9lHkrYgzpATbW3CtJp3UfkVgpE="
|
|
122
122
|
# macOS 签名和公证配置
|
|
123
123
|
CSC_LINK: ${{ secrets.APPLE_CERTIFICATE_BASE64 }}
|
|
124
124
|
CSC_KEY_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
|
|
@@ -137,8 +137,8 @@ jobs:
|
|
|
137
137
|
run: npm run desktop:build
|
|
138
138
|
env:
|
|
139
139
|
APP_URL: http://localhost:3015
|
|
140
|
-
DATABASE_URL:
|
|
141
|
-
KEY_VAULTS_SECRET:
|
|
140
|
+
DATABASE_URL: "postgresql://postgres@localhost:5432/postgres"
|
|
141
|
+
KEY_VAULTS_SECRET: "oLXWIiR/AKF+rWaqy9lHkrYgzpATbW3CtJp3UfkVgpE="
|
|
142
142
|
NEXT_PUBLIC_DESKTOP_PROJECT_ID: ${{ secrets.UMAMI_BETA_DESKTOP_PROJECT_ID }}
|
|
143
143
|
NEXT_PUBLIC_DESKTOP_UMAMI_BASE_URL: ${{ secrets.UMAMI_BETA_DESKTOP_BASE_URL }}
|
|
144
144
|
|
|
@@ -152,8 +152,8 @@ jobs:
|
|
|
152
152
|
run: npm run desktop:build
|
|
153
153
|
env:
|
|
154
154
|
APP_URL: http://localhost:3015
|
|
155
|
-
DATABASE_URL:
|
|
156
|
-
KEY_VAULTS_SECRET:
|
|
155
|
+
DATABASE_URL: "postgresql://postgres@localhost:5432/postgres"
|
|
156
|
+
KEY_VAULTS_SECRET: "oLXWIiR/AKF+rWaqy9lHkrYgzpATbW3CtJp3UfkVgpE="
|
|
157
157
|
NEXT_PUBLIC_DESKTOP_PROJECT_ID: ${{ secrets.UMAMI_BETA_DESKTOP_PROJECT_ID }}
|
|
158
158
|
NEXT_PUBLIC_DESKTOP_UMAMI_BASE_URL: ${{ secrets.UMAMI_BETA_DESKTOP_BASE_URL }}
|
|
159
159
|
|
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,64 @@
|
|
|
2
2
|
|
|
3
3
|
# Changelog
|
|
4
4
|
|
|
5
|
+
## [Version 1.136.0](https://github.com/lobehub/lobe-chat/compare/v1.135.6...v1.136.0)
|
|
6
|
+
|
|
7
|
+
<sup>Released on **2025-10-09**</sup>
|
|
8
|
+
|
|
9
|
+
#### ✨ Features
|
|
10
|
+
|
|
11
|
+
- **misc**: Add new provider Cerebras.
|
|
12
|
+
|
|
13
|
+
#### 🐛 Bug Fixes
|
|
14
|
+
|
|
15
|
+
- **misc**: Fix standalone plugin rerender issue.
|
|
16
|
+
|
|
17
|
+
<br/>
|
|
18
|
+
|
|
19
|
+
<details>
|
|
20
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
|
21
|
+
|
|
22
|
+
#### What's improved
|
|
23
|
+
|
|
24
|
+
- **misc**: Add new provider Cerebras, closes [#9559](https://github.com/lobehub/lobe-chat/issues/9559) ([9cceaad](https://github.com/lobehub/lobe-chat/commit/9cceaad))
|
|
25
|
+
|
|
26
|
+
#### What's fixed
|
|
27
|
+
|
|
28
|
+
- **misc**: Fix standalone plugin rerender issue, closes [#9611](https://github.com/lobehub/lobe-chat/issues/9611) [#9396](https://github.com/lobehub/lobe-chat/issues/9396) ([7ab30fc](https://github.com/lobehub/lobe-chat/commit/7ab30fc))
|
|
29
|
+
|
|
30
|
+
</details>
|
|
31
|
+
|
|
32
|
+
<div align="right">
|
|
33
|
+
|
|
34
|
+
[](#readme-top)
|
|
35
|
+
|
|
36
|
+
</div>
|
|
37
|
+
|
|
38
|
+
### [Version 1.135.6](https://github.com/lobehub/lobe-chat/compare/v1.135.5...v1.135.6)
|
|
39
|
+
|
|
40
|
+
<sup>Released on **2025-10-08**</sup>
|
|
41
|
+
|
|
42
|
+
#### 🐛 Bug Fixes
|
|
43
|
+
|
|
44
|
+
- **desktop**: Macos26 small icon.
|
|
45
|
+
|
|
46
|
+
<br/>
|
|
47
|
+
|
|
48
|
+
<details>
|
|
49
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
|
50
|
+
|
|
51
|
+
#### What's fixed
|
|
52
|
+
|
|
53
|
+
- **desktop**: Macos26 small icon, closes [#9421](https://github.com/lobehub/lobe-chat/issues/9421) ([ca03342](https://github.com/lobehub/lobe-chat/commit/ca03342))
|
|
54
|
+
|
|
55
|
+
</details>
|
|
56
|
+
|
|
57
|
+
<div align="right">
|
|
58
|
+
|
|
59
|
+
[](#readme-top)
|
|
60
|
+
|
|
61
|
+
</div>
|
|
62
|
+
|
|
5
63
|
### [Version 1.135.5](https://github.com/lobehub/lobe-chat/compare/v1.135.4...v1.135.5)
|
|
6
64
|
|
|
7
65
|
<sup>Released on **2025-10-08**</sup>
|
package/CLAUDE.md
CHANGED
|
@@ -31,28 +31,18 @@ This repository adopts a monorepo structure.
|
|
|
31
31
|
|
|
32
32
|
see @.cursor/rules/typescript.mdc
|
|
33
33
|
|
|
34
|
-
### Modify Code Rules
|
|
35
|
-
|
|
36
|
-
- **Code Language**:
|
|
37
|
-
- For files with existing Chinese comments: Continue using Chinese to maintain consistency
|
|
38
|
-
- For new files or files without Chinese comments: MUST use American English.
|
|
39
|
-
- eg: new react tsx file and new test file
|
|
40
|
-
- Conservative for existing code, modern approaches for new features
|
|
41
|
-
|
|
42
34
|
### Testing
|
|
43
35
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
- **Required Rule**: `testing-guide/testing-guide.mdc`
|
|
36
|
+
- **Required Rule**: read `@.cursor/rules/testing-guide/testing-guide.mdc` before writing tests
|
|
47
37
|
- **Command**:
|
|
48
38
|
- web: `bunx vitest run --silent='passed-only' '[file-path-pattern]'`
|
|
49
39
|
- packages(eg: database): `cd packages/database && bunx vitest run --silent='passed-only' '[file-path-pattern]'`
|
|
50
40
|
|
|
51
41
|
**Important**:
|
|
52
42
|
|
|
53
|
-
-
|
|
43
|
+
- wrap the file path in single quotes to avoid shell expansion
|
|
54
44
|
- Never run `bun run test` etc to run tests, this will run all tests and cost about 10mins
|
|
55
|
-
- If
|
|
45
|
+
- If trying to fix the same test twice, but still failed, stop and ask for help.
|
|
56
46
|
|
|
57
47
|
### Typecheck
|
|
58
48
|
|
|
@@ -61,15 +51,9 @@ Testing work follows the Rule-Aware Task Execution system above.
|
|
|
61
51
|
### i18n
|
|
62
52
|
|
|
63
53
|
- **Keys**: Add to `src/locales/default/namespace.ts`
|
|
64
|
-
- **Dev**: Translate `locales/zh-CN/namespace.json`
|
|
54
|
+
- **Dev**: Translate `locales/zh-CN/namespace.json` and `locales/en-US/namespace.json` locales file only for dev preview
|
|
65
55
|
- DON'T run `pnpm i18n`, let CI auto handle it
|
|
66
56
|
|
|
67
57
|
## Rules Index
|
|
68
58
|
|
|
69
|
-
Some useful rules of this project. Read them when needed.
|
|
70
|
-
|
|
71
|
-
**IMPORTANT**: All rule files referenced in this document are located in the `.cursor/rules/` directory. Throughout this document, rule files are referenced by their filename only for brevity.
|
|
72
|
-
|
|
73
|
-
### 📋 Complete Rule Files
|
|
74
|
-
|
|
75
59
|
Some useful project rules are listed in @.cursor/rules/rules-index.mdc
|
package/Dockerfile.database
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
const dotenv = require('dotenv');
|
|
2
|
+
const fs = require('node:fs/promises');
|
|
2
3
|
const os = require('node:os');
|
|
4
|
+
const path = require('node:path');
|
|
3
5
|
|
|
4
6
|
dotenv.config();
|
|
5
7
|
|
|
@@ -32,11 +34,50 @@ const getProtocolScheme = () => {
|
|
|
32
34
|
|
|
33
35
|
const protocolScheme = getProtocolScheme();
|
|
34
36
|
|
|
37
|
+
// Determine icon file based on version type
|
|
38
|
+
const getIconFileName = () => {
|
|
39
|
+
if (isNightly) return 'Icon-nightly';
|
|
40
|
+
if (isBeta) return 'Icon-beta';
|
|
41
|
+
return 'Icon';
|
|
42
|
+
};
|
|
43
|
+
|
|
35
44
|
/**
|
|
36
45
|
* @type {import('electron-builder').Configuration}
|
|
37
46
|
* @see https://www.electron.build/configuration
|
|
38
47
|
*/
|
|
39
48
|
const config = {
|
|
49
|
+
/**
|
|
50
|
+
* AfterPack hook to copy pre-generated Liquid Glass Assets.car for macOS 26+
|
|
51
|
+
* @see https://github.com/electron-userland/electron-builder/issues/9254
|
|
52
|
+
* @see https://github.com/MultiboxLabs/flow-browser/pull/159
|
|
53
|
+
* @see https://github.com/electron/packager/pull/1806
|
|
54
|
+
*/
|
|
55
|
+
afterPack: async (context) => {
|
|
56
|
+
// Only process macOS builds
|
|
57
|
+
if (context.electronPlatformName !== 'darwin') {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const iconFileName = getIconFileName();
|
|
62
|
+
const assetsCarSource = path.join(__dirname, 'build', `${iconFileName}.Assets.car`);
|
|
63
|
+
const resourcesPath = path.join(
|
|
64
|
+
context.appOutDir,
|
|
65
|
+
`${context.packager.appInfo.productFilename}.app`,
|
|
66
|
+
'Contents',
|
|
67
|
+
'Resources',
|
|
68
|
+
);
|
|
69
|
+
const assetsCarDest = path.join(resourcesPath, 'Assets.car');
|
|
70
|
+
|
|
71
|
+
try {
|
|
72
|
+
await fs.access(assetsCarSource);
|
|
73
|
+
await fs.copyFile(assetsCarSource, assetsCarDest);
|
|
74
|
+
console.log(`✅ Copied Liquid Glass icon: ${iconFileName}.Assets.car`);
|
|
75
|
+
} catch {
|
|
76
|
+
// Non-critical: Assets.car not found or copy failed
|
|
77
|
+
// App will use fallback .icns icon on all macOS versions
|
|
78
|
+
console.log(`⏭️ Skipping Assets.car (not found or copy failed)`);
|
|
79
|
+
}
|
|
80
|
+
},
|
|
40
81
|
appId: isNightly
|
|
41
82
|
? 'com.lobehub.lobehub-desktop-nightly'
|
|
42
83
|
: isBeta
|
|
@@ -81,6 +122,7 @@ const config = {
|
|
|
81
122
|
compression: 'maximum',
|
|
82
123
|
entitlementsInherit: 'build/entitlements.mac.plist',
|
|
83
124
|
extendInfo: {
|
|
125
|
+
CFBundleIconName: 'AppIcon',
|
|
84
126
|
CFBundleURLTypes: [
|
|
85
127
|
{
|
|
86
128
|
CFBundleURLName: 'LobeHub Protocol',
|
package/changelog/v1.json
CHANGED
|
@@ -1,4 +1,21 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"children": {
|
|
4
|
+
"features": [
|
|
5
|
+
"Add new provider Cerebras."
|
|
6
|
+
],
|
|
7
|
+
"fixes": [
|
|
8
|
+
"Fix standalone plugin rerender issue."
|
|
9
|
+
]
|
|
10
|
+
},
|
|
11
|
+
"date": "2025-10-09",
|
|
12
|
+
"version": "1.136.0"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"children": {},
|
|
16
|
+
"date": "2025-10-08",
|
|
17
|
+
"version": "1.135.6"
|
|
18
|
+
},
|
|
2
19
|
{
|
|
3
20
|
"children": {
|
|
4
21
|
"improvements": [
|
|
@@ -5,7 +5,9 @@ LobeChat is built on the Next.js framework and uses TypeScript as the primary de
|
|
|
5
5
|
1. Routing: Define routes (`src/app`).
|
|
6
6
|
2. Data Structure: Define data structures (`src/types`).
|
|
7
7
|
3. Business Logic Implementation: Zustand store (`src/store`).
|
|
8
|
-
4. Page Display: Write static components/pages
|
|
8
|
+
4. Page Display: Write static components/pages. Create features in:
|
|
9
|
+
- `src/features/<feature-name>/` for **shared global features** (used across multiple pages)
|
|
10
|
+
- `src/app/<new-page>/features/<feature-name>/` for **page-specific features** (only used in this page)
|
|
9
11
|
5. Function Binding: Bind the store with page triggers (`const [state, function] = useNewStore(s => [s.state, s.function])`).
|
|
10
12
|
|
|
11
13
|
Taking the "Chat Messages" feature as an example, here are the brief steps to implement this feature:
|
|
@@ -60,7 +62,8 @@ export const useChatStore = create<ChatState>((set) => ({
|
|
|
60
62
|
In `src/app/<new-page>/features/<new-feature>.tsx`, we need to create a new page or component to display "Chat Messages". In this file, we can use the Zustand Store created earlier and Ant Design components to build the UI:
|
|
61
63
|
|
|
62
64
|
```jsx
|
|
63
|
-
// src/
|
|
65
|
+
// src/app/chat/features/ChatPage/index.tsx
|
|
66
|
+
// Note: Use src/app/<page>/features/ for page-specific components
|
|
64
67
|
import { List, Typography } from 'antd';
|
|
65
68
|
import { useChatStore } from 'src/store/chatStore';
|
|
66
69
|
|
|
@@ -82,6 +85,12 @@ const ChatPage = () => {
|
|
|
82
85
|
export default ChatPage;
|
|
83
86
|
```
|
|
84
87
|
|
|
88
|
+
> **Note on Feature Organization**: LobeChat uses two patterns for organizing features:
|
|
89
|
+
> - **Global features** (`src/features/`): Shared components like `ChatInput`, `Conversation` used across the app
|
|
90
|
+
> - **Page-specific features** (`src/app/<page>/features/`): Components used only within a specific page route
|
|
91
|
+
>
|
|
92
|
+
> Choose based on reusability. If unsure, start with page-specific and refactor to global if needed elsewhere.
|
|
93
|
+
|
|
85
94
|
## 5. Function Binding
|
|
86
95
|
|
|
87
96
|
In a page or component, we need to bind the Zustand Store's state and methods to the UI. In the example above, we have already bound the `messages` state to the `dataSource` property of the list. Now, we also need a method to add new messages. We can define this method in the Zustand Store and then use it in the page or component:
|
|
@@ -5,7 +5,9 @@ LobeChat 基于 Next.js 框架构建,使用 TypeScript 作为主要开发语
|
|
|
5
5
|
1. 路由:定义路由 (`src/app`)
|
|
6
6
|
2. 数据结构: 定义数据结构 ( `src/types` )
|
|
7
7
|
3. 业务功能实现: zustand store (`src/store`)
|
|
8
|
-
4. 页面展示:书写静态组件 /
|
|
8
|
+
4. 页面展示:书写静态组件 / 页面。根据以下方式创建功能组件:
|
|
9
|
+
- `src/features/<feature-name>/` 用于 **全局共享功能**(跨多个页面使用)
|
|
10
|
+
- `src/app/<new-page>/features/<feature-name>/` 用于 **页面专属功能**(仅在当前页面使用)
|
|
9
11
|
5. 功能绑定:绑定 store 与页面的触发 (`const [state,function]= useNewStore(s=>[s.state,s.function])`)
|
|
10
12
|
|
|
11
13
|
我们以 "会话消息" 功能为例,以下是实现这个功能的简要步骤:
|
|
@@ -60,7 +62,8 @@ export const useChatStore = create<ChatState>((set) => ({
|
|
|
60
62
|
在 `src/app/<new-page>/features/<new-feature>.tsx` 中,我们需要创建一个新的页面或组件来显示 "会话消息"。在这个文件中,我们可以使用上面创建的 Zustand Store,以及 Ant Design 的组件来构建 UI:
|
|
61
63
|
|
|
62
64
|
```jsx
|
|
63
|
-
// src/
|
|
65
|
+
// src/app/chat/features/ChatPage/index.tsx
|
|
66
|
+
// 注意:使用 src/app/<page>/features/ 放置页面专属组件
|
|
64
67
|
import { List, Typography } from 'antd';
|
|
65
68
|
import { useChatStore } from 'src/store/chatStore';
|
|
66
69
|
|
|
@@ -82,6 +85,12 @@ const ChatPage = () => {
|
|
|
82
85
|
export default ChatPage;
|
|
83
86
|
```
|
|
84
87
|
|
|
88
|
+
> **关于功能组件组织方式的说明**:LobeChat 使用两种模式来组织功能组件:
|
|
89
|
+
> - **全局功能**(`src/features/`):跨应用共享的组件,如 `ChatInput`、`Conversation` 等
|
|
90
|
+
> - **页面专属功能**(`src/app/<page>/features/`):仅在特定页面路由中使用的组件
|
|
91
|
+
>
|
|
92
|
+
> 根据可复用性选择合适的方式。如果不确定,可以先放在页面专属位置,需要时再重构为全局共享。
|
|
93
|
+
|
|
85
94
|
## 5. 功能绑定
|
|
86
95
|
|
|
87
96
|
在页面或组件中,我们需要将 Zustand Store 的状态和方法绑定到 UI 上。在上面的示例中,我们已经将 `messages` 状态绑定到了列表的 `dataSource` 属性上。现在,我们还需要一个方法来添加新的消息。我们可以在 Zustand Store 中定义这个方法,然后在页面或组件中使用它:
|
|
@@ -717,4 +717,20 @@ NewAPI is a multi-provider model aggregation service that supports automatic mod
|
|
|
717
717
|
- Default: `-`
|
|
718
718
|
- Example: `-all,+vercel-model-1,+vercel-model-2=vercel-special`
|
|
719
719
|
|
|
720
|
+
## Cerebras
|
|
721
|
+
|
|
722
|
+
### `CEREBRAS_API_KEY`
|
|
723
|
+
|
|
724
|
+
- Type: Required
|
|
725
|
+
- Description: This is the API key you applied for in the Cerebras service.
|
|
726
|
+
- Default: -
|
|
727
|
+
- Example: `csk-xxxxxx...xxxxxx`
|
|
728
|
+
|
|
729
|
+
### `CEREBRAS_MODEL_LIST`
|
|
730
|
+
|
|
731
|
+
- Type: Optional
|
|
732
|
+
- Description: Used to control the Cerebras model list. Use `+` to add a model, `-` to hide a model, and `model_name=display_name` to customize the display name of a model. Separate multiple entries with commas. The definition syntax follows the same rules as other providers' model lists.
|
|
733
|
+
- Default: `-`
|
|
734
|
+
- Example: `-all,+cerebras-model-1,+cerebras-model-2=cerebras-special`
|
|
735
|
+
|
|
720
736
|
[model-list]: /docs/self-hosting/advanced/model-list
|
|
@@ -720,4 +720,20 @@ LobeChat 在部署时提供了丰富的模型服务商相关的环境变量,
|
|
|
720
720
|
- 默认值:`-`
|
|
721
721
|
- 示例:`-all,+vercel-model-1,+vercel-model-2=vercel-special`
|
|
722
722
|
|
|
723
|
+
## Cerebras
|
|
724
|
+
|
|
725
|
+
### `CEREBRAS_API_KEY`
|
|
726
|
+
|
|
727
|
+
- 类型:必选
|
|
728
|
+
- 描述:这是你在 Cerebras 服务中申请的 API 密钥
|
|
729
|
+
- 默认值:-
|
|
730
|
+
- 示例:`csk-xxxxxx...xxxxxx`
|
|
731
|
+
|
|
732
|
+
### `CEREBRAS_MODEL_LIST`
|
|
733
|
+
|
|
734
|
+
- 类型:可选
|
|
735
|
+
- 描述:用来控制 Cerebras 模型列表,使用 `+` 增加一个模型,使用 `-` 来隐藏一个模型,使用 `模型名=展示名` 来自定义模型的展示名,用英文逗号隔开。模型定义语法规则与其他 provider 保持一致。
|
|
736
|
+
- 默认值:`-`
|
|
737
|
+
- 示例:`-all,+cerebras-model-1,+cerebras-model-2=cerebras-special`
|
|
738
|
+
|
|
723
739
|
[model-list]: /zh/docs/self-hosting/advanced/model-list
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lobehub/chat",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.136.0",
|
|
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",
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
"./baichuan": "./src/aiModels/baichuan.ts",
|
|
16
16
|
"./bedrock": "./src/aiModels/bedrock.ts",
|
|
17
17
|
"./bfl": "./src/aiModels/bfl.ts",
|
|
18
|
+
"./cerebras": "./src/aiModels/cerebras.ts",
|
|
18
19
|
"./cloudflare": "./src/aiModels/cloudflare.ts",
|
|
19
20
|
"./cohere": "./src/aiModels/cohere.ts",
|
|
20
21
|
"./cometapi": "./src/aiModels/cometapi.ts",
|