@lobehub/chat 1.120.7 → 1.121.1
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-structure.mdc +54 -42
- package/.cursor/rules/testing-guide/testing-guide.mdc +28 -17
- package/.env.development +122 -0
- package/.vscode/settings.json +0 -1
- package/CHANGELOG.md +51 -0
- package/CLAUDE.md +3 -4
- package/apps/desktop/package.json +1 -0
- package/apps/desktop/src/main/modules/networkProxy/dispatcher.ts +24 -2
- package/changelog/v1.json +18 -0
- package/docker-compose/local/init_data.json +981 -1024
- package/docker-compose.development.yml +40 -0
- package/docs/development/basic/work-with-server-side-database.mdx +77 -0
- package/docs/development/basic/work-with-server-side-database.zh-CN.mdx +77 -0
- package/docs/self-hosting/advanced/s3/cloudflare-r2.mdx +1 -1
- package/docs/self-hosting/advanced/s3/cloudflare-r2.zh-CN.mdx +2 -2
- package/locales/zh-CN/common.json +7 -0
- package/package.json +2 -1
- package/packages/database/src/repositories/aiInfra/index.ts +3 -1
- package/packages/model-runtime/src/RouterRuntime/createRuntime.test.ts +6 -91
- package/packages/model-runtime/src/RouterRuntime/createRuntime.ts +6 -28
- package/packages/model-runtime/src/openrouter/index.ts +15 -12
- package/packages/model-runtime/src/openrouter/type.ts +10 -0
- package/packages/model-runtime/src/utils/modelParse.test.ts +66 -0
- package/packages/model-runtime/src/utils/modelParse.ts +15 -3
- package/packages/model-runtime/src/utils/postProcessModelList.ts +1 -0
- package/packages/utils/src/detectChinese.test.ts +37 -0
- package/packages/utils/src/detectChinese.ts +12 -0
- package/packages/utils/src/index.ts +1 -0
- package/src/app/[variants]/(main)/chat/(workspace)/@conversation/features/ChatInput/Desktop/TextArea.test.tsx +33 -18
- package/src/app/[variants]/(main)/chat/(workspace)/@topic/features/TopicListContent/ByTimeMode/index.tsx +3 -3
- package/src/app/[variants]/(main)/image/features/PromptInput/index.tsx +12 -0
- package/src/features/ChatInput/useSend.ts +14 -2
- package/src/hooks/useGeminiChineseWarning.tsx +91 -0
- package/src/locales/default/common.ts +7 -0
- package/src/store/global/initialState.ts +2 -0
@@ -19,12 +19,15 @@ lobe-chat/
|
|
19
19
|
│ ├── development/ # Development docs
|
20
20
|
│ ├── self-hosting/ # Self-hosting docs
|
21
21
|
│ └── usage/ # Usage guides
|
22
|
-
├── locales/ # Internationalization files
|
23
|
-
│ ├── en-US/ # English
|
24
|
-
│ └── zh-CN/ # Simplified Chinese
|
22
|
+
├── locales/ # Internationalization files (multiple locales)
|
23
|
+
│ ├── en-US/ # English (example)
|
24
|
+
│ └── zh-CN/ # Simplified Chinese (example)
|
25
25
|
├── packages/ # Monorepo packages directory
|
26
26
|
│ ├── const/ # Constants definition package
|
27
27
|
│ ├── database/ # Database related package
|
28
|
+
│ ├── electron-client-ipc/ # Electron renderer ↔ main IPC client
|
29
|
+
│ ├── electron-server-ipc/ # Electron main process IPC server
|
30
|
+
│ ├── model-bank/ # Built-in model presets/catalog exports
|
28
31
|
│ ├── model-runtime/ # AI model runtime package
|
29
32
|
│ ├── types/ # TypeScript type definitions
|
30
33
|
│ ├── utils/ # Utility functions package
|
@@ -37,7 +40,6 @@ lobe-chat/
|
|
37
40
|
│ └── screenshots/ # Application screenshots
|
38
41
|
├── scripts/ # Build and tool scripts
|
39
42
|
├── src/ # Main application source code (see below)
|
40
|
-
├── tests/ # Test configuration
|
41
43
|
├── .cursor/ # Cursor AI configuration
|
42
44
|
├── docker-compose/ # Docker configuration
|
43
45
|
├── package.json # Project dependencies
|
@@ -60,6 +62,7 @@ src/
|
|
60
62
|
│ │ ├── oidc/ # OpenID Connect endpoints
|
61
63
|
│ │ ├── trpc/ # tRPC API routes
|
62
64
|
│ │ │ ├── async/ # Async tRPC endpoints
|
65
|
+
│ │ │ ├── desktop/ # Desktop runtime endpoints
|
63
66
|
│ │ │ ├── edge/ # Edge runtime endpoints
|
64
67
|
│ │ │ ├── lambda/ # Lambda runtime endpoints
|
65
68
|
│ │ │ └── tools/ # Tools-specific endpoints
|
@@ -86,7 +89,7 @@ src/
|
|
86
89
|
│ ├── Error/ # Error handling components
|
87
90
|
│ └── Loading/ # Loading state components
|
88
91
|
├── config/ # Application configuration
|
89
|
-
│ ├──
|
92
|
+
│ ├── featureFlags/ # Feature flags & experiments
|
90
93
|
│ └── modelProviders/ # Model provider configurations
|
91
94
|
├── features/ # Feature components (UI Layer)
|
92
95
|
│ ├── AgentSetting/ # Agent configuration and management
|
@@ -109,7 +112,10 @@ src/
|
|
109
112
|
│ ├── modules/ # Server modules
|
110
113
|
│ ├── routers/ # tRPC routers
|
111
114
|
│ └── services/ # Server services
|
112
|
-
├── services/ #
|
115
|
+
├── services/ # Service layer (per-domain, client/server split)
|
116
|
+
│ ├── user/ # User services
|
117
|
+
│ │ ├── client.ts # Client DB (PGLite) implementation
|
118
|
+
│ │ └── server.ts # Server DB implementation (via tRPC)
|
113
119
|
│ ├── aiModel/ # AI model services
|
114
120
|
│ ├── session/ # Session services
|
115
121
|
│ └── message/ # Message services
|
@@ -162,43 +168,15 @@ packages/
|
|
162
168
|
└── web-crawler/ # Web crawling functionality
|
163
169
|
```
|
164
170
|
|
165
|
-
## Architecture
|
171
|
+
## Architecture Map
|
166
172
|
|
167
|
-
|
168
|
-
|
169
|
-
-
|
170
|
-
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
- Zustand-based client state with domain-specific slices
|
175
|
-
- Actions and selectors for predictable state updates
|
176
|
-
|
177
|
-
### 3. **Client Service Layer**
|
178
|
-
|
179
|
-
- Environment-adaptive services (local Model vs remote tRPC)
|
180
|
-
- Dual implementation pattern for multi-runtime compatibility
|
181
|
-
|
182
|
-
### 4. **API Interface Layer**
|
183
|
-
|
184
|
-
- Type-safe tRPC routers organized by runtime environment
|
185
|
-
- Request routing and validation
|
186
|
-
|
187
|
-
### 5. **Server Service Layer**
|
188
|
-
|
189
|
-
- Platform-agnostic business logic with implementation abstractions
|
190
|
-
- Reusable, testable service composition
|
191
|
-
|
192
|
-
### 6. **Data Access Layer**
|
193
|
-
|
194
|
-
- **Repository**: Complex queries, joins, and transaction management
|
195
|
-
- **Model**: Basic CRUD operations and single-table queries
|
196
|
-
- **Schema**: Drizzle ORM definitions and migration management
|
197
|
-
|
198
|
-
### 7. **Integration & Extensions**
|
199
|
-
|
200
|
-
- **External**: Third-party service integrations and library wrappers
|
201
|
-
- **Built-in**: AI runtime, tool system, file processing, and web crawling
|
173
|
+
- Presentation: `src/features`, `src/components`, `src/layout` — UI composition, global providers
|
174
|
+
- State: `src/store` — Zustand slices, selectors, middleware
|
175
|
+
- Client Services: `src/services/<domain>/{client|server}.ts` — client: PGLite; server: tRPC bridge
|
176
|
+
- API Routers: `src/app/(backend)/webapi` (REST), `src/app/(backend)/trpc/{edge|lambda|async|desktop|tools}`; Lambda router triggers Async router for long-running tasks (e.g., image)
|
177
|
+
- Server Services: `src/server/services` (business logic), `src/server/modules` (infra adapters)
|
178
|
+
- Data Access: `packages/database/src/{schemas,models,repositories}` — Schema (Drizzle), Model (CRUD), Repository (complex queries)
|
179
|
+
- Integrations: `src/libs` — analytics, auth, trpc, logging, runtime helpers
|
202
180
|
|
203
181
|
## Data Flow Architecture
|
204
182
|
|
@@ -225,3 +203,37 @@ _\*Depends on cloud sync configuration_
|
|
225
203
|
|
226
204
|
- **Type Safety**: End-to-end type safety via tRPC and Drizzle ORM
|
227
205
|
- **Local/Remote Dual Mode**: PGLite enables user data ownership and local control
|
206
|
+
|
207
|
+
## Quick Map
|
208
|
+
|
209
|
+
- App Routes: `src/app` — UI routes (App Router) and backend routes under `(backend)`
|
210
|
+
- Web API: `src/app/(backend)/webapi` — REST-like endpoints
|
211
|
+
- tRPC Routers: `src/server/routers` — typed RPC endpoints by runtime
|
212
|
+
- Client Services: `src/services` — environment-adaptive client-side business logic
|
213
|
+
- Server Services: `src/server/services` — platform-agnostic business logic
|
214
|
+
- Database: `packages/database` — schemas/models/repositories/migrations
|
215
|
+
- State: `src/store` — Zustand stores and slices
|
216
|
+
- Integrations: `src/libs` — analytics/auth/trpc/logging/runtime helpers
|
217
|
+
- Tools: `src/tools` — built-in tool system
|
218
|
+
|
219
|
+
## Common Tasks
|
220
|
+
|
221
|
+
- Add Web API route: `src/app/(backend)/webapi/<module>/route.ts`
|
222
|
+
- Add tRPC endpoint: `src/server/routers/{edge|lambda|desktop}/...`
|
223
|
+
- Add client/server service: `src/services/<domain>/{client|server}.ts` (client: PGLite; server: tRPC)
|
224
|
+
- Add server service: `src/server/services/<domain>`
|
225
|
+
- Add a new model/provider: `src/config/modelProviders/<provider>.ts` + `packages/model-bank/src/aiModels/<provider>.ts` + `packages/model-runtime/src/<provider>/index.ts`
|
226
|
+
- Add DB schema/model/repository: `packages/database/src/{schemas|models|repositories}`
|
227
|
+
- Add Zustand slice: `src/store/<domain>/slices`
|
228
|
+
|
229
|
+
## Env Modes
|
230
|
+
|
231
|
+
- `NEXT_PUBLIC_CLIENT_DB`: selects client DB mode (e.g., `pglite`) vs server-backed
|
232
|
+
- `NEXT_PUBLIC_IS_DESKTOP_APP`: enables desktop-specific routes and behavior
|
233
|
+
- `NEXT_PUBLIC_SERVICE_MODE`: controls service routing preference (client/server)
|
234
|
+
|
235
|
+
## Boundaries
|
236
|
+
|
237
|
+
- Keep client logic in `src/services`; server-only logic stays in `src/server/services`
|
238
|
+
- Don’t mix Web API (`webapi/`) with tRPC (`src/server/routers/`)
|
239
|
+
- Place business UI under `src/features`, global reusable UI under `src/components`
|
@@ -67,10 +67,19 @@ vitest test-file.test.ts
|
|
67
67
|
|
68
68
|
### 核心原则
|
69
69
|
|
70
|
-
1.
|
71
|
-
|
72
|
-
|
73
|
-
|
70
|
+
1. **收集足够的上下文**
|
71
|
+
在修复测试之前,务必做到:
|
72
|
+
- 完整理解测试的意图和实现
|
73
|
+
- 强烈建议阅读当前的 git diff 和 PR diff
|
74
|
+
|
75
|
+
2. **测试优先修复**
|
76
|
+
如果是测试本身写错了,应优先修改测试,而不是实现代码。
|
77
|
+
|
78
|
+
3. **专注单一问题**
|
79
|
+
只修复指定的测试,不要顺带添加额外测试。
|
80
|
+
|
81
|
+
4. **不自作主张**
|
82
|
+
发现其他问题时,不要直接修改,需先提出并讨论。
|
74
83
|
|
75
84
|
### 测试协作最佳实践
|
76
85
|
|
@@ -291,7 +300,7 @@ beforeEach(() => {
|
|
291
300
|
naturalWidth: 800,
|
292
301
|
}));
|
293
302
|
vi.stubGlobal('Image', mockImage);
|
294
|
-
|
303
|
+
|
295
304
|
// 现代方法2:使用vi.spyOn保留原功能,只mock特定方法
|
296
305
|
vi.spyOn(URL, 'createObjectURL').mockReturnValue('blob:mock-url');
|
297
306
|
vi.spyOn(URL, 'revokeObjectURL').mockImplementation(() => {});
|
@@ -312,8 +321,8 @@ global.Image = mockImage;
|
|
312
321
|
global.URL = { ...global.URL, createObjectURL: mockFn };
|
313
322
|
|
314
323
|
// ✅ 现代方法:类型安全的vi API
|
315
|
-
vi.stubGlobal('Image', mockImage);
|
316
|
-
vi.spyOn(URL, 'createObjectURL');
|
324
|
+
vi.stubGlobal('Image', mockImage); // 完全替换全局对象
|
325
|
+
vi.spyOn(URL, 'createObjectURL'); // 部分mock,保留其他功能
|
317
326
|
```
|
318
327
|
|
319
328
|
### 测试覆盖率原则:代码分支优于用例数量
|
@@ -324,16 +333,16 @@ vi.spyOn(URL, 'createObjectURL'); // 部分mock,保留其他功能
|
|
324
333
|
// ❌ 过度测试:29个测试用例都验证相同分支
|
325
334
|
describe('getImageDimensions', () => {
|
326
335
|
it('should reject .txt files');
|
327
|
-
it('should reject .pdf files');
|
336
|
+
it('should reject .pdf files');
|
328
337
|
// ... 25个类似测试,都走相同的验证分支
|
329
338
|
});
|
330
339
|
|
331
340
|
// ✅ 精简测试:4个核心用例覆盖所有分支
|
332
341
|
describe('getImageDimensions', () => {
|
333
|
-
it('should return dimensions for valid File object');
|
334
|
-
it('should return dimensions for valid data URI');
|
335
|
-
it('should return undefined for invalid inputs');
|
336
|
-
it('should return undefined when image fails to load');
|
342
|
+
it('should return dimensions for valid File object'); // 成功路径 - File
|
343
|
+
it('should return dimensions for valid data URI'); // 成功路径 - String
|
344
|
+
it('should return undefined for invalid inputs'); // 输入验证分支
|
345
|
+
it('should return undefined when image fails to load'); // 错误处理分支
|
337
346
|
});
|
338
347
|
```
|
339
348
|
|
@@ -345,6 +354,7 @@ describe('getImageDimensions', () => {
|
|
345
354
|
4. **业务逻辑** - 覆盖所有if/else分支
|
346
355
|
|
347
356
|
**合理测试数量**
|
357
|
+
|
348
358
|
- 简单工具函数:2-5个测试
|
349
359
|
- 复杂业务逻辑:5-10个测试
|
350
360
|
- 核心安全功能:适当增加,但避免重复路径
|
@@ -358,10 +368,12 @@ describe('getImageDimensions', () => {
|
|
358
368
|
```typescript
|
359
369
|
// ✅ 测试错误类型和属性
|
360
370
|
expect(() => validateUser({})).toThrow(ValidationError);
|
361
|
-
expect(() => processPayment({})).toThrow(
|
362
|
-
|
363
|
-
|
364
|
-
|
371
|
+
expect(() => processPayment({})).toThrow(
|
372
|
+
expect.objectContaining({
|
373
|
+
code: 'INVALID_PAYMENT_DATA',
|
374
|
+
statusCode: 400,
|
375
|
+
}),
|
376
|
+
);
|
365
377
|
|
366
378
|
// ❌ 避免测试具体错误文本
|
367
379
|
expect(() => processUser({})).toThrow('用户数据不能为空,请检查输入参数');
|
@@ -461,7 +473,6 @@ await (instance as any).getFromCache('key'); // 避免as any
|
|
461
473
|
- **文档说明**: 对于使用 `any` 的复杂场景,添加注释说明原因
|
462
474
|
- **测试覆盖**: 确保即使使用了 `any`,测试仍能有效验证功能正确性
|
463
475
|
|
464
|
-
|
465
476
|
### 检查最近修改记录
|
466
477
|
|
467
478
|
**核心原则**:测试突然失败时,优先检查最近的代码修改。
|
package/.env.development
ADDED
@@ -0,0 +1,122 @@
|
|
1
|
+
# LobeChat Development Server Configuration
|
2
|
+
# This file contains environment variables for both LobeChat server mode and Docker compose setup
|
3
|
+
|
4
|
+
COMPOSE_FILE="docker-compose.development.yml"
|
5
|
+
|
6
|
+
# ⚠️⚠️⚠️ DO NOT USE THE SECRETS BELOW IN PRODUCTION!
|
7
|
+
UNSAFE_SECRET="ww+0igxjGRAAR/eTNFQ55VmhQB5KE5trFZseuntThJs="
|
8
|
+
UNSAFE_PASSWORD="CHANGE_THIS_PASSWORD_IN_PRODUCTION"
|
9
|
+
|
10
|
+
# Core Server Configuration
|
11
|
+
# Service mode - set to 'server' for server-side deployment
|
12
|
+
NEXT_PUBLIC_SERVICE_MODE=server
|
13
|
+
|
14
|
+
# Service Ports Configuration
|
15
|
+
LOBE_PORT=3010
|
16
|
+
|
17
|
+
# Application URL - the base URL where LobeChat will be accessible
|
18
|
+
APP_URL=http://localhost:${LOBE_PORT}
|
19
|
+
|
20
|
+
# Secret key for encrypting vault data (generate with: openssl rand -base64 32)
|
21
|
+
KEY_VAULTS_SECRET=${UNSAFE_SECRET}
|
22
|
+
|
23
|
+
# Database Configuration
|
24
|
+
# Database name for LobeChat
|
25
|
+
LOBE_DB_NAME=lobechat
|
26
|
+
|
27
|
+
# PostgreSQL password
|
28
|
+
POSTGRES_PASSWORD=${UNSAFE_PASSWORD}
|
29
|
+
|
30
|
+
# PostgreSQL database connection URL
|
31
|
+
DATABASE_URL=postgresql://postgres:${POSTGRES_PASSWORD}@localhost:5432/${LOBE_DB_NAME}
|
32
|
+
|
33
|
+
# Database driver type
|
34
|
+
DATABASE_DRIVER=node
|
35
|
+
|
36
|
+
# Authentication Configuration
|
37
|
+
# Enable NextAuth authentication
|
38
|
+
NEXT_PUBLIC_ENABLE_NEXT_AUTH=1
|
39
|
+
|
40
|
+
# NextAuth secret for JWT signing (generate with: openssl rand -base64 32)
|
41
|
+
NEXT_AUTH_SECRET=${UNSAFE_SECRET}
|
42
|
+
|
43
|
+
NEXTAUTH_URL=${APP_URL}
|
44
|
+
|
45
|
+
# Authentication URL
|
46
|
+
AUTH_URL=${APP_URL}/api/auth
|
47
|
+
|
48
|
+
# SSO providers configuration - using Casdoor for development
|
49
|
+
NEXT_AUTH_SSO_PROVIDERS=casdoor
|
50
|
+
|
51
|
+
# Casdoor Configuration
|
52
|
+
# Casdoor service port
|
53
|
+
CASDOOR_PORT=8000
|
54
|
+
|
55
|
+
# Casdoor OIDC issuer URL
|
56
|
+
AUTH_CASDOOR_ISSUER=http://localhost:${CASDOOR_PORT}
|
57
|
+
|
58
|
+
# Casdoor application client ID
|
59
|
+
AUTH_CASDOOR_ID=a387a4892ee19b1a2249 # DO NOT USE IN PROD
|
60
|
+
|
61
|
+
# Casdoor application client secret
|
62
|
+
AUTH_CASDOOR_SECRET=dbf205949d704de81b0b5b3603174e23fbecc354 # DO NOT USE IN PROD
|
63
|
+
|
64
|
+
# Origin URL for Casdoor internal configuration
|
65
|
+
origin=http://localhost:${CASDOOR_PORT}
|
66
|
+
|
67
|
+
# MinIO Storage Configuration
|
68
|
+
# MinIO service port
|
69
|
+
MINIO_PORT=9000
|
70
|
+
|
71
|
+
# MinIO root user (admin username)
|
72
|
+
MINIO_ROOT_USER=admin
|
73
|
+
|
74
|
+
# MinIO root password
|
75
|
+
MINIO_ROOT_PASSWORD=${UNSAFE_PASSWORD}
|
76
|
+
|
77
|
+
# MinIO bucket for LobeChat files
|
78
|
+
MINIO_LOBE_BUCKET=lobe
|
79
|
+
|
80
|
+
# S3/MinIO Configuration for LobeChat
|
81
|
+
# S3/MinIO access key ID
|
82
|
+
S3_ACCESS_KEY_ID=${MINIO_ROOT_USER}
|
83
|
+
|
84
|
+
# S3/MinIO secret access key
|
85
|
+
S3_SECRET_ACCESS_KEY=${MINIO_ROOT_PASSWORD}
|
86
|
+
|
87
|
+
# S3/MinIO endpoint URL
|
88
|
+
S3_ENDPOINT=http://localhost:${MINIO_PORT}
|
89
|
+
|
90
|
+
# S3 bucket name for storing files
|
91
|
+
S3_BUCKET=${MINIO_LOBE_BUCKET}
|
92
|
+
|
93
|
+
# Public domain for S3 file access
|
94
|
+
S3_PUBLIC_DOMAIN=http://localhost:${MINIO_PORT}
|
95
|
+
|
96
|
+
# Enable path-style S3 requests (required for MinIO)
|
97
|
+
S3_ENABLE_PATH_STYLE=1
|
98
|
+
|
99
|
+
# Disable S3 ACL setting (for MinIO compatibility)
|
100
|
+
S3_SET_ACL=0
|
101
|
+
|
102
|
+
# Use base64 encoding for LLM vision images
|
103
|
+
LLM_VISION_IMAGE_USE_BASE64=1
|
104
|
+
|
105
|
+
# Search Service Configuration
|
106
|
+
# SearXNG search engine URL
|
107
|
+
SEARXNG_URL=http://searxng:8080
|
108
|
+
|
109
|
+
# Development Options
|
110
|
+
# Uncomment to skip authentication during development
|
111
|
+
|
112
|
+
# Proxy Configuration (Optional)
|
113
|
+
# Uncomment if you need proxy support (e.g., for GitHub auth or API access)
|
114
|
+
# HTTP_PROXY=http://localhost:7890
|
115
|
+
# HTTPS_PROXY=http://localhost:7890
|
116
|
+
|
117
|
+
# AI Model Configuration (Optional)
|
118
|
+
# Add your AI model API keys and configurations here
|
119
|
+
# ⚠️ WARNING: Never commit real API keys to version control!
|
120
|
+
# OPENAI_API_KEY=sk-NEVER_USE_REAL_API_KEYS_IN_CONFIG_FILES
|
121
|
+
# OPENAI_PROXY_URL=https://api.openai.com/v1
|
122
|
+
# OPENAI_MODEL_LIST=...
|
package/.vscode/settings.json
CHANGED
package/CHANGELOG.md
CHANGED
@@ -2,6 +2,57 @@
|
|
2
2
|
|
3
3
|
# Changelog
|
4
4
|
|
5
|
+
### [Version 1.121.1](https://github.com/lobehub/lobe-chat/compare/v1.121.0...v1.121.1)
|
6
|
+
|
7
|
+
<sup>Released on **2025-09-03**</sup>
|
8
|
+
|
9
|
+
#### 🐛 Bug Fixes
|
10
|
+
|
11
|
+
- **misc**: Fix socks5 proxy not work problem, fix virtuaso minheight was null.
|
12
|
+
|
13
|
+
<br/>
|
14
|
+
|
15
|
+
<details>
|
16
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
17
|
+
|
18
|
+
#### What's fixed
|
19
|
+
|
20
|
+
- **misc**: Fix socks5 proxy not work problem, closes [#9053](https://github.com/lobehub/lobe-chat/issues/9053) ([b13563c](https://github.com/lobehub/lobe-chat/commit/b13563c))
|
21
|
+
- **misc**: Fix virtuaso minheight was null, closes [#9055](https://github.com/lobehub/lobe-chat/issues/9055) ([ef79721](https://github.com/lobehub/lobe-chat/commit/ef79721))
|
22
|
+
|
23
|
+
</details>
|
24
|
+
|
25
|
+
<div align="right">
|
26
|
+
|
27
|
+
[](#readme-top)
|
28
|
+
|
29
|
+
</div>
|
30
|
+
|
31
|
+
## [Version 1.121.0](https://github.com/lobehub/lobe-chat/compare/v1.120.7...v1.121.0)
|
32
|
+
|
33
|
+
<sup>Released on **2025-09-03**</sup>
|
34
|
+
|
35
|
+
#### ✨ Features
|
36
|
+
|
37
|
+
- **misc**: Add nano banana Chinese prompt notify.
|
38
|
+
|
39
|
+
<br/>
|
40
|
+
|
41
|
+
<details>
|
42
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
43
|
+
|
44
|
+
#### What's improved
|
45
|
+
|
46
|
+
- **misc**: Add nano banana Chinese prompt notify, closes [#9038](https://github.com/lobehub/lobe-chat/issues/9038) ([58e19f8](https://github.com/lobehub/lobe-chat/commit/58e19f8))
|
47
|
+
|
48
|
+
</details>
|
49
|
+
|
50
|
+
<div align="right">
|
51
|
+
|
52
|
+
[](#readme-top)
|
53
|
+
|
54
|
+
</div>
|
55
|
+
|
5
56
|
### [Version 1.120.7](https://github.com/lobehub/lobe-chat/compare/v1.120.6...v1.120.7)
|
6
57
|
|
7
58
|
<sup>Released on **2025-09-02**</sup>
|
package/CLAUDE.md
CHANGED
@@ -58,12 +58,11 @@ Testing work follows the Rule-Aware Task Execution system above.
|
|
58
58
|
|
59
59
|
- use `bun run type-check` to check type errors.
|
60
60
|
|
61
|
-
###
|
61
|
+
### i18n
|
62
62
|
|
63
63
|
- **Keys**: Add to `src/locales/default/namespace.ts`
|
64
|
-
- **Dev**: Translate
|
65
|
-
-
|
66
|
-
- **Script**: DON'T run `pnpm i18n` (user/CI handles it)
|
64
|
+
- **Dev**: Translate `locales/zh-CN/namespace.json` locale file only for preview
|
65
|
+
- DON'T run `pnpm i18n`, let CI auto handle it
|
67
66
|
|
68
67
|
## Rules Index
|
69
68
|
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import { NetworkProxySettings } from '@lobechat/electron-client-ipc';
|
2
|
+
import { SocksProxies, socksDispatcher } from 'fetch-socks';
|
2
3
|
import { Agent, ProxyAgent, getGlobalDispatcher, setGlobalDispatcher } from 'undici';
|
3
4
|
|
4
5
|
import { createLogger } from '@/utils/logger';
|
@@ -91,8 +92,29 @@ export class ProxyDispatcherManager {
|
|
91
92
|
*/
|
92
93
|
static createProxyAgent(proxyType: string, proxyUrl: string) {
|
93
94
|
try {
|
94
|
-
|
95
|
-
|
95
|
+
if (proxyType === 'socks5') {
|
96
|
+
// 解析 SOCKS5 代理 URL
|
97
|
+
const url = new URL(proxyUrl);
|
98
|
+
const socksProxies: SocksProxies = [
|
99
|
+
{
|
100
|
+
host: url.hostname,
|
101
|
+
port: parseInt(url.port, 10),
|
102
|
+
type: 5,
|
103
|
+
...(url.username && url.password
|
104
|
+
? {
|
105
|
+
password: url.password,
|
106
|
+
userId: url.username,
|
107
|
+
}
|
108
|
+
: {}),
|
109
|
+
},
|
110
|
+
];
|
111
|
+
|
112
|
+
// 使用 fetch-socks 处理 SOCKS5 代理
|
113
|
+
return socksDispatcher(socksProxies);
|
114
|
+
} else {
|
115
|
+
// undici 的 ProxyAgent 支持 http, https
|
116
|
+
return new ProxyAgent({ uri: proxyUrl });
|
117
|
+
}
|
96
118
|
} catch (error) {
|
97
119
|
logger.error(`Failed to create proxy agent for ${proxyType}:`, error);
|
98
120
|
throw new Error(
|
package/changelog/v1.json
CHANGED
@@ -1,4 +1,22 @@
|
|
1
1
|
[
|
2
|
+
{
|
3
|
+
"children": {
|
4
|
+
"fixes": [
|
5
|
+
"Fix socks5 proxy not work problem, fix virtuaso minheight was null."
|
6
|
+
]
|
7
|
+
},
|
8
|
+
"date": "2025-09-03",
|
9
|
+
"version": "1.121.1"
|
10
|
+
},
|
11
|
+
{
|
12
|
+
"children": {
|
13
|
+
"features": [
|
14
|
+
"Add nano banana Chinese prompt notify."
|
15
|
+
]
|
16
|
+
},
|
17
|
+
"date": "2025-09-03",
|
18
|
+
"version": "1.121.0"
|
19
|
+
},
|
2
20
|
{
|
3
21
|
"children": {
|
4
22
|
"improvements": [
|