@lobehub/chat 1.136.13 → 1.137.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.
Files changed (190) hide show
  1. package/.cursor/rules/add-setting-env.mdc +175 -0
  2. package/.cursor/rules/db-migrations.mdc +25 -0
  3. package/.env.example +7 -0
  4. package/CHANGELOG.md +50 -0
  5. package/Dockerfile +3 -2
  6. package/Dockerfile.database +15 -3
  7. package/Dockerfile.pglite +3 -2
  8. package/changelog/v1.json +18 -0
  9. package/docs/development/database-schema.dbml +1 -0
  10. package/docs/self-hosting/advanced/feature-flags.mdx +25 -15
  11. package/docs/self-hosting/advanced/feature-flags.zh-CN.mdx +25 -15
  12. package/docs/self-hosting/environment-variables/basic.mdx +12 -0
  13. package/docs/self-hosting/environment-variables/basic.zh-CN.mdx +12 -0
  14. package/locales/ar/setting.json +8 -0
  15. package/locales/bg-BG/setting.json +8 -0
  16. package/locales/de-DE/setting.json +8 -0
  17. package/locales/en-US/setting.json +8 -0
  18. package/locales/es-ES/setting.json +8 -0
  19. package/locales/fa-IR/setting.json +8 -0
  20. package/locales/fr-FR/setting.json +8 -0
  21. package/locales/it-IT/setting.json +8 -0
  22. package/locales/ja-JP/setting.json +8 -0
  23. package/locales/ko-KR/setting.json +8 -0
  24. package/locales/nl-NL/setting.json +8 -0
  25. package/locales/pl-PL/setting.json +8 -0
  26. package/locales/pt-BR/setting.json +8 -0
  27. package/locales/ru-RU/setting.json +8 -0
  28. package/locales/tr-TR/setting.json +8 -0
  29. package/locales/vi-VN/setting.json +8 -0
  30. package/locales/zh-CN/setting.json +8 -0
  31. package/locales/zh-TW/setting.json +8 -0
  32. package/package.json +1 -1
  33. package/packages/agent-runtime/examples/tools-calling.ts +4 -3
  34. package/packages/agent-runtime/src/core/__tests__/runtime.test.ts +559 -29
  35. package/packages/agent-runtime/src/core/runtime.ts +171 -43
  36. package/packages/agent-runtime/src/types/instruction.ts +32 -6
  37. package/packages/agent-runtime/src/types/runtime.ts +2 -2
  38. package/packages/agent-runtime/src/types/state.ts +1 -8
  39. package/packages/agent-runtime/vitest.config.mts +14 -0
  40. package/packages/const/src/settings/image.ts +8 -0
  41. package/packages/const/src/settings/index.ts +3 -0
  42. package/packages/context-engine/src/__tests__/pipeline.test.ts +485 -0
  43. package/packages/context-engine/src/base/__tests__/BaseProcessor.test.ts +381 -0
  44. package/packages/context-engine/src/base/__tests__/BaseProvider.test.ts +392 -0
  45. package/packages/context-engine/src/processors/__tests__/MessageCleanup.test.ts +346 -0
  46. package/packages/context-engine/src/processors/__tests__/ToolCall.test.ts +552 -0
  47. package/packages/database/migrations/0038_add_image_user_settings.sql +1 -0
  48. package/packages/database/migrations/meta/0038_snapshot.json +7580 -0
  49. package/packages/database/migrations/meta/_journal.json +7 -0
  50. package/packages/database/src/core/migrations.json +6 -0
  51. package/packages/database/src/models/user.ts +3 -1
  52. package/packages/database/src/schemas/user.ts +1 -0
  53. package/packages/file-loaders/src/loaders/docx/index.test.ts +0 -1
  54. package/packages/file-loaders/src/loaders/excel/__snapshots__/index.test.ts.snap +30 -0
  55. package/packages/file-loaders/src/loaders/excel/index.test.ts +8 -0
  56. package/packages/file-loaders/src/loaders/pptx/index.test.ts +25 -0
  57. package/packages/file-loaders/src/utils/parser-utils.test.ts +155 -0
  58. package/packages/file-loaders/vitest.config.mts +8 -0
  59. package/packages/model-runtime/CLAUDE.md +5 -0
  60. package/packages/model-runtime/docs/test-coverage.md +706 -0
  61. package/packages/model-runtime/src/core/ModelRuntime.test.ts +231 -0
  62. package/packages/model-runtime/src/core/RouterRuntime/createRuntime.ts +1 -1
  63. package/packages/model-runtime/src/core/openaiCompatibleFactory/createImage.test.ts +799 -0
  64. package/packages/model-runtime/src/core/openaiCompatibleFactory/index.test.ts +188 -4
  65. package/packages/model-runtime/src/core/openaiCompatibleFactory/index.ts +41 -10
  66. package/packages/model-runtime/src/core/streams/openai/__snapshots__/responsesStream.test.ts.snap +439 -0
  67. package/packages/model-runtime/src/core/streams/openai/openai.test.ts +789 -0
  68. package/packages/model-runtime/src/core/streams/openai/responsesStream.test.ts +551 -0
  69. package/packages/model-runtime/src/core/usageConverters/utils/computeChatCost.test.ts +230 -0
  70. package/packages/model-runtime/src/core/usageConverters/utils/computeImageCost.test.ts +334 -37
  71. package/packages/model-runtime/src/providerTestUtils.ts +148 -145
  72. package/packages/model-runtime/src/providers/ai302/index.test.ts +60 -0
  73. package/packages/model-runtime/src/providers/ai302/index.ts +9 -4
  74. package/packages/model-runtime/src/providers/ai360/index.test.ts +1213 -1
  75. package/packages/model-runtime/src/providers/ai360/index.ts +9 -4
  76. package/packages/model-runtime/src/providers/aihubmix/index.test.ts +73 -0
  77. package/packages/model-runtime/src/providers/aihubmix/index.ts +6 -9
  78. package/packages/model-runtime/src/providers/akashchat/index.test.ts +433 -3
  79. package/packages/model-runtime/src/providers/akashchat/index.ts +12 -7
  80. package/packages/model-runtime/src/providers/anthropic/generateObject.test.ts +183 -29
  81. package/packages/model-runtime/src/providers/anthropic/generateObject.ts +40 -24
  82. package/packages/model-runtime/src/providers/azureai/index.test.ts +102 -0
  83. package/packages/model-runtime/src/providers/baichuan/index.test.ts +416 -26
  84. package/packages/model-runtime/src/providers/baichuan/index.ts +23 -20
  85. package/packages/model-runtime/src/providers/bedrock/index.test.ts +420 -2
  86. package/packages/model-runtime/src/providers/cerebras/index.test.ts +465 -0
  87. package/packages/model-runtime/src/providers/cerebras/index.ts +8 -3
  88. package/packages/model-runtime/src/providers/cohere/index.test.ts +1074 -1
  89. package/packages/model-runtime/src/providers/cohere/index.ts +8 -3
  90. package/packages/model-runtime/src/providers/cometapi/index.test.ts +439 -3
  91. package/packages/model-runtime/src/providers/cometapi/index.ts +8 -3
  92. package/packages/model-runtime/src/providers/deepseek/index.test.ts +116 -1
  93. package/packages/model-runtime/src/providers/deepseek/index.ts +8 -3
  94. package/packages/model-runtime/src/providers/fireworksai/index.test.ts +264 -3
  95. package/packages/model-runtime/src/providers/fireworksai/index.ts +8 -3
  96. package/packages/model-runtime/src/providers/giteeai/index.test.ts +325 -3
  97. package/packages/model-runtime/src/providers/giteeai/index.ts +23 -6
  98. package/packages/model-runtime/src/providers/github/index.test.ts +532 -3
  99. package/packages/model-runtime/src/providers/github/index.ts +8 -3
  100. package/packages/model-runtime/src/providers/groq/index.test.ts +344 -31
  101. package/packages/model-runtime/src/providers/groq/index.ts +8 -3
  102. package/packages/model-runtime/src/providers/higress/index.test.ts +142 -0
  103. package/packages/model-runtime/src/providers/higress/index.ts +8 -3
  104. package/packages/model-runtime/src/providers/huggingface/index.test.ts +612 -1
  105. package/packages/model-runtime/src/providers/huggingface/index.ts +9 -4
  106. package/packages/model-runtime/src/providers/hunyuan/index.test.ts +365 -1
  107. package/packages/model-runtime/src/providers/hunyuan/index.ts +9 -3
  108. package/packages/model-runtime/src/providers/infiniai/index.test.ts +71 -0
  109. package/packages/model-runtime/src/providers/internlm/index.test.ts +369 -2
  110. package/packages/model-runtime/src/providers/internlm/index.ts +10 -5
  111. package/packages/model-runtime/src/providers/jina/index.test.ts +164 -3
  112. package/packages/model-runtime/src/providers/jina/index.ts +8 -3
  113. package/packages/model-runtime/src/providers/lmstudio/index.test.ts +182 -3
  114. package/packages/model-runtime/src/providers/lmstudio/index.ts +8 -3
  115. package/packages/model-runtime/src/providers/mistral/index.test.ts +779 -27
  116. package/packages/model-runtime/src/providers/mistral/index.ts +8 -3
  117. package/packages/model-runtime/src/providers/modelscope/index.test.ts +232 -1
  118. package/packages/model-runtime/src/providers/modelscope/index.ts +8 -3
  119. package/packages/model-runtime/src/providers/moonshot/index.test.ts +489 -2
  120. package/packages/model-runtime/src/providers/moonshot/index.ts +8 -3
  121. package/packages/model-runtime/src/providers/nebius/index.test.ts +381 -3
  122. package/packages/model-runtime/src/providers/nebius/index.ts +8 -3
  123. package/packages/model-runtime/src/providers/newapi/index.test.ts +667 -3
  124. package/packages/model-runtime/src/providers/newapi/index.ts +6 -3
  125. package/packages/model-runtime/src/providers/nvidia/index.test.ts +168 -1
  126. package/packages/model-runtime/src/providers/nvidia/index.ts +12 -7
  127. package/packages/model-runtime/src/providers/ollama/index.test.ts +797 -1
  128. package/packages/model-runtime/src/providers/ollama/index.ts +8 -0
  129. package/packages/model-runtime/src/providers/ollamacloud/index.test.ts +411 -0
  130. package/packages/model-runtime/src/providers/ollamacloud/index.ts +8 -3
  131. package/packages/model-runtime/src/providers/openai/index.test.ts +171 -2
  132. package/packages/model-runtime/src/providers/openai/index.ts +8 -3
  133. package/packages/model-runtime/src/providers/openrouter/index.test.ts +1647 -95
  134. package/packages/model-runtime/src/providers/openrouter/index.ts +12 -7
  135. package/packages/model-runtime/src/providers/qiniu/index.test.ts +294 -1
  136. package/packages/model-runtime/src/providers/qiniu/index.ts +8 -3
  137. package/packages/model-runtime/src/providers/search1api/index.test.ts +1131 -11
  138. package/packages/model-runtime/src/providers/search1api/index.ts +10 -4
  139. package/packages/model-runtime/src/providers/sensenova/index.test.ts +1069 -1
  140. package/packages/model-runtime/src/providers/sensenova/index.ts +8 -3
  141. package/packages/model-runtime/src/providers/siliconcloud/index.test.ts +196 -0
  142. package/packages/model-runtime/src/providers/siliconcloud/index.ts +8 -3
  143. package/packages/model-runtime/src/providers/spark/index.test.ts +293 -1
  144. package/packages/model-runtime/src/providers/spark/index.ts +8 -3
  145. package/packages/model-runtime/src/providers/stepfun/index.test.ts +322 -3
  146. package/packages/model-runtime/src/providers/stepfun/index.ts +8 -3
  147. package/packages/model-runtime/src/providers/tencentcloud/index.test.ts +182 -3
  148. package/packages/model-runtime/src/providers/tencentcloud/index.ts +8 -3
  149. package/packages/model-runtime/src/providers/togetherai/index.test.ts +359 -4
  150. package/packages/model-runtime/src/providers/togetherai/index.ts +12 -5
  151. package/packages/model-runtime/src/providers/v0/index.test.ts +341 -0
  152. package/packages/model-runtime/src/providers/v0/index.ts +20 -6
  153. package/packages/model-runtime/src/providers/vercelaigateway/index.test.ts +710 -0
  154. package/packages/model-runtime/src/providers/vercelaigateway/index.ts +19 -13
  155. package/packages/model-runtime/src/providers/vllm/index.test.ts +45 -1
  156. package/packages/model-runtime/src/providers/volcengine/index.test.ts +75 -0
  157. package/packages/model-runtime/src/providers/wenxin/index.test.ts +144 -1
  158. package/packages/model-runtime/src/providers/wenxin/index.ts +8 -3
  159. package/packages/model-runtime/src/providers/xai/index.test.ts +105 -1
  160. package/packages/model-runtime/src/providers/xinference/index.test.ts +70 -1
  161. package/packages/model-runtime/src/providers/zeroone/index.test.ts +327 -3
  162. package/packages/model-runtime/src/providers/zeroone/index.ts +23 -6
  163. package/packages/model-runtime/src/providers/zhipu/index.test.ts +908 -236
  164. package/packages/model-runtime/src/providers/zhipu/index.ts +8 -3
  165. package/packages/model-runtime/src/types/structureOutput.ts +5 -1
  166. package/packages/model-runtime/vitest.config.mts +7 -1
  167. package/packages/types/src/aiChat.ts +20 -2
  168. package/packages/types/src/serverConfig.ts +7 -1
  169. package/packages/types/src/tool/index.ts +1 -0
  170. package/packages/types/src/tool/tool.ts +33 -0
  171. package/packages/types/src/user/settings/image.ts +3 -0
  172. package/packages/types/src/user/settings/index.ts +3 -0
  173. package/src/app/[variants]/(main)/settings/_layout/SettingsContent.tsx +3 -0
  174. package/src/app/[variants]/(main)/settings/hooks/useCategory.tsx +8 -3
  175. package/src/app/[variants]/(main)/settings/image/index.tsx +74 -0
  176. package/src/components/FormInput/FormSliderWithInput.tsx +40 -0
  177. package/src/components/FormInput/index.ts +1 -0
  178. package/src/envs/image.ts +27 -0
  179. package/src/features/Conversation/Messages/Assistant/index.tsx +1 -1
  180. package/src/features/Conversation/Messages/User/index.tsx +2 -2
  181. package/src/hooks/useFetchAiImageConfig.ts +12 -17
  182. package/src/locales/default/setting.ts +8 -0
  183. package/src/server/globalConfig/index.ts +5 -0
  184. package/src/server/routers/lambda/aiChat.ts +2 -0
  185. package/src/store/global/initialState.ts +1 -0
  186. package/src/store/image/slices/generationConfig/action.test.ts +17 -0
  187. package/src/store/image/slices/generationConfig/action.ts +18 -21
  188. package/src/store/image/slices/generationConfig/initialState.ts +3 -2
  189. package/src/store/user/slices/common/action.ts +1 -0
  190. package/src/store/user/slices/settings/selectors/settings.ts +3 -0
@@ -0,0 +1,175 @@
1
+ ---
2
+ description: Guide for adding environment variables to configure user settings
3
+ alwaysApply: false
4
+ ---
5
+
6
+ # Adding Environment Variable for User Settings
7
+
8
+ Add server-side environment variables to configure default values for user settings.
9
+
10
+ **Priority**: User Custom > Server Env Var > Hardcoded Default
11
+
12
+ ## Steps
13
+
14
+ ### 1. Define Environment Variable
15
+
16
+ Create `src/envs/<domain>.ts`:
17
+
18
+ ```typescript
19
+ import { createEnv } from '@t3-oss/env-nextjs';
20
+ import { z } from 'zod';
21
+
22
+ export const get<Domain>Config = () => {
23
+ return createEnv({
24
+ server: {
25
+ YOUR_ENV_VAR: z.coerce.number().min(MIN).max(MAX).optional(),
26
+ },
27
+ runtimeEnv: {
28
+ YOUR_ENV_VAR: process.env.YOUR_ENV_VAR,
29
+ },
30
+ });
31
+ };
32
+
33
+ export const <domain>Env = get<Domain>Config();
34
+ ```
35
+
36
+ ### 2. Update Type (Optional)
37
+
38
+ **Skip this step if the domain field already exists in `GlobalServerConfig`.**
39
+
40
+ Add to `packages/types/src/serverConfig.ts`:
41
+
42
+ ```typescript
43
+ export interface GlobalServerConfig {
44
+ <domain>?: {
45
+ <settingName>?: <type>;
46
+ };
47
+ }
48
+ ```
49
+
50
+ **Prefer reusing existing types** from `packages/types/src/user/settings` with `PartialDeep`:
51
+
52
+ ```typescript
53
+ import { User<Domain>Config } from './user/settings';
54
+
55
+ export interface GlobalServerConfig {
56
+ <domain>?: PartialDeep<User<Domain>Config>;
57
+ }
58
+ ```
59
+
60
+ ### 3. Assemble Server Config (Optional)
61
+
62
+ **Skip this step if the domain field already exists in server config.**
63
+
64
+ In `src/server/globalConfig/index.ts`:
65
+
66
+ ```typescript
67
+ import { <domain>Env } from '@/envs/<domain>';
68
+ import { cleanObject } from '@/utils/object';
69
+
70
+ export const getServerGlobalConfig = async () => {
71
+ const config: GlobalServerConfig = {
72
+ // ...
73
+ <domain>: cleanObject({
74
+ <settingName>: <domain>Env.YOUR_ENV_VAR,
75
+ }),
76
+ };
77
+ return config;
78
+ };
79
+ ```
80
+
81
+ If the domain already exists, just add the new field to the existing `cleanObject()`:
82
+
83
+ ```typescript
84
+ <domain>: cleanObject({
85
+ existingField: <domain>Env.EXISTING_VAR,
86
+ <settingName>: <domain>Env.YOUR_ENV_VAR, // Add this line
87
+ }),
88
+ ```
89
+
90
+ ### 4. Merge to User Store (Optional)
91
+
92
+ **Skip this step if the domain field already exists in `serverSettings`.**
93
+
94
+ In `src/store/user/slices/common/action.ts`, add to `serverSettings`:
95
+
96
+ ```typescript
97
+ const serverSettings: PartialDeep<UserSettings> = {
98
+ defaultAgent: serverConfig.defaultAgent,
99
+ <domain>: serverConfig.<domain>, // Add this line
100
+ // ...
101
+ };
102
+ ```
103
+
104
+ ### 5. Update .env.example
105
+
106
+ ```bash
107
+ # <Description> (range/options, default: X)
108
+ # YOUR_ENV_VAR=<example>
109
+ ```
110
+
111
+ ### 6. Update Documentation
112
+
113
+ Update both English and Chinese documentation:
114
+ - `docs/self-hosting/environment-variables/basic.mdx`
115
+ - `docs/self-hosting/environment-variables/basic.zh-CN.mdx`
116
+
117
+ Add new section or subsection with environment variable details (type, description, default, example, range/constraints).
118
+
119
+ ## Type Reuse
120
+
121
+ **Prefer reusing existing types** from `packages/types/src/user/settings` instead of defining inline types in `serverConfig.ts`.
122
+
123
+ ```typescript
124
+ // ✅ Good - reuse existing type
125
+ import { UserImageConfig } from './user/settings';
126
+
127
+ export interface GlobalServerConfig {
128
+ image?: PartialDeep<UserImageConfig>;
129
+ }
130
+
131
+ // ❌ Bad - inline type definition
132
+ export interface GlobalServerConfig {
133
+ image?: {
134
+ defaultImageNum?: number;
135
+ };
136
+ }
137
+ ```
138
+
139
+ ## Example: AI_IMAGE_DEFAULT_IMAGE_NUM
140
+
141
+ ```typescript
142
+ // src/envs/image.ts
143
+ export const getImageConfig = () => {
144
+ return createEnv({
145
+ server: {
146
+ AI_IMAGE_DEFAULT_IMAGE_NUM: z.coerce.number().min(1).max(20).optional(),
147
+ },
148
+ runtimeEnv: {
149
+ AI_IMAGE_DEFAULT_IMAGE_NUM: process.env.AI_IMAGE_DEFAULT_IMAGE_NUM,
150
+ },
151
+ });
152
+ };
153
+
154
+ // packages/types/src/serverConfig.ts
155
+ import { UserImageConfig } from './user/settings';
156
+
157
+ export interface GlobalServerConfig {
158
+ image?: PartialDeep<UserImageConfig>;
159
+ }
160
+
161
+ // src/server/globalConfig/index.ts
162
+ image: cleanObject({
163
+ defaultImageNum: imageEnv.AI_IMAGE_DEFAULT_IMAGE_NUM,
164
+ }),
165
+
166
+ // src/store/user/slices/common/action.ts
167
+ const serverSettings: PartialDeep<UserSettings> = {
168
+ image: serverConfig.image,
169
+ // ...
170
+ };
171
+
172
+ // .env.example
173
+ # AI_IMAGE_DEFAULT_IMAGE_NUM=4
174
+ ```
175
+
@@ -0,0 +1,25 @@
1
+ ---
2
+ globs: packages/database/migrations/**/*
3
+ alwaysApply: false
4
+ ---
5
+
6
+ # Database Migrations Guide
7
+
8
+ ## Defensive Programming - Use Idempotent Clauses
9
+
10
+ Always use defensive clauses to make migrations idempotent:
11
+
12
+ ```sql
13
+ -- ✅ Good: Idempotent operations
14
+ ALTER TABLE "users" ADD COLUMN IF NOT EXISTS "avatar" text;
15
+ DROP TABLE IF EXISTS "old_table";
16
+ CREATE INDEX IF NOT EXISTS "users_email_idx" ON "users" ("email");
17
+ ALTER TABLE "posts" DROP COLUMN IF EXISTS "deprecated_field";
18
+
19
+ -- ❌ Bad: Non-idempotent operations
20
+ ALTER TABLE "users" ADD COLUMN "avatar" text;
21
+ DROP TABLE "old_table";
22
+ CREATE INDEX "users_email_idx" ON "users" ("email");
23
+ ```
24
+
25
+ **Important**: After modifying migration SQL (e.g., adding `IF NOT EXISTS` clauses), run `bun run db:generate-client` to update the hash in `packages/database/src/core/migrations.json`.
package/.env.example CHANGED
@@ -169,6 +169,13 @@ OPENAI_API_KEY=sk-xxxxxxxxx
169
169
 
170
170
  # FAL_API_KEY=fal-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
171
171
 
172
+ ########################################
173
+ ######### AI Image Settings ############
174
+ ########################################
175
+
176
+ # Default image generation count (range: 1-20, default: 4)
177
+ # AI_IMAGE_DEFAULT_IMAGE_NUM=4
178
+
172
179
  ### Nebius ###
173
180
 
174
181
  # NEBIUS_API_KEY=sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
package/CHANGELOG.md CHANGED
@@ -2,6 +2,56 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ### [Version 1.137.1](https://github.com/lobehub/lobe-chat/compare/v1.137.0...v1.137.1)
6
+
7
+ <sup>Released on **2025-10-14**</sup>
8
+
9
+ #### 💄 Styles
10
+
11
+ - **misc**: Change the user chatItem maxWidth should use flex 1.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### Styles
19
+
20
+ - **misc**: Change the user chatItem maxWidth should use flex 1, closes [#9689](https://github.com/lobehub/lobe-chat/issues/9689) ([cfd5221](https://github.com/lobehub/lobe-chat/commit/cfd5221))
21
+
22
+ </details>
23
+
24
+ <div align="right">
25
+
26
+ [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
27
+
28
+ </div>
29
+
30
+ ## [Version 1.137.0](https://github.com/lobehub/lobe-chat/compare/v1.136.13...v1.137.0)
31
+
32
+ <sup>Released on **2025-10-12**</sup>
33
+
34
+ #### ✨ Features
35
+
36
+ - **misc**: Add new setting for default image num.
37
+
38
+ <br/>
39
+
40
+ <details>
41
+ <summary><kbd>Improvements and Fixes</kbd></summary>
42
+
43
+ #### What's improved
44
+
45
+ - **misc**: Add new setting for default image num, closes [#9618](https://github.com/lobehub/lobe-chat/issues/9618) ([de7368b](https://github.com/lobehub/lobe-chat/commit/de7368b))
46
+
47
+ </details>
48
+
49
+ <div align="right">
50
+
51
+ [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
52
+
53
+ </div>
54
+
5
55
  ### [Version 1.136.13](https://github.com/lobehub/lobe-chat/compare/v1.136.12...v1.136.13)
6
56
 
7
57
  <sup>Released on **2025-10-12**</sup>
package/Dockerfile CHANGED
@@ -142,7 +142,8 @@ ENV ACCESS_CODE="" \
142
142
  DEFAULT_AGENT_CONFIG="" \
143
143
  SYSTEM_AGENT="" \
144
144
  FEATURE_FLAGS="" \
145
- PROXY_URL=""
145
+ PROXY_URL="" \
146
+ ENABLE_AUTH_PROTECTION=""
146
147
 
147
148
  # Model Variables
148
149
  ENV \
@@ -255,7 +256,7 @@ ENV \
255
256
  # 302.AI
256
257
  AI302_API_KEY="" AI302_MODEL_LIST="" \
257
258
  # FAL
258
- FAL_API_KEY="" FAL_MODEL_LIST="" \
259
+ ENABLED_FAL="" FAL_API_KEY="" FAL_MODEL_LIST="" \
259
260
  # BFL
260
261
  BFL_API_KEY="" BFL_MODEL_LIST="" \
261
262
  # Vercel AI Gateway
@@ -39,6 +39,8 @@ ARG USE_CN_MIRROR
39
39
  ARG NEXT_PUBLIC_BASE_PATH
40
40
  ARG NEXT_PUBLIC_SERVICE_MODE
41
41
  ARG NEXT_PUBLIC_ENABLE_NEXT_AUTH
42
+ ARG NEXT_PUBLIC_ENABLE_CLERK_AUTH
43
+ ARG NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY
42
44
  ARG NEXT_PUBLIC_SENTRY_DSN
43
45
  ARG NEXT_PUBLIC_ANALYTICS_POSTHOG
44
46
  ARG NEXT_PUBLIC_POSTHOG_HOST
@@ -53,6 +55,9 @@ ENV NEXT_PUBLIC_BASE_PATH="${NEXT_PUBLIC_BASE_PATH}" \
53
55
 
54
56
  ENV NEXT_PUBLIC_SERVICE_MODE="${NEXT_PUBLIC_SERVICE_MODE:-server}" \
55
57
  NEXT_PUBLIC_ENABLE_NEXT_AUTH="${NEXT_PUBLIC_ENABLE_NEXT_AUTH:-1}" \
58
+ NEXT_PUBLIC_ENABLE_CLERK_AUTH="${NEXT_PUBLIC_ENABLE_CLERK_AUTH:-0}" \
59
+ NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY="${NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY}" \
60
+ CLERK_WEBHOOK_SECRET="whsec_xxx" \
56
61
  APP_URL="http://app.com" \
57
62
  DATABASE_DRIVER="node" \
58
63
  DATABASE_URL="postgres://postgres:password@localhost:5432/postgres" \
@@ -166,7 +171,8 @@ ENV ACCESS_CODE="" \
166
171
  DEFAULT_AGENT_CONFIG="" \
167
172
  SYSTEM_AGENT="" \
168
173
  FEATURE_FLAGS="" \
169
- PROXY_URL=""
174
+ PROXY_URL="" \
175
+ ENABLE_AUTH_PROTECTION=""
170
176
 
171
177
  # Database
172
178
  ENV KEY_VAULTS_SECRET="" \
@@ -178,13 +184,19 @@ ENV NEXT_AUTH_SECRET="" \
178
184
  NEXT_AUTH_SSO_PROVIDERS="" \
179
185
  NEXTAUTH_URL=""
180
186
 
187
+ # Clerk
188
+ ENV CLERK_SECRET_KEY="" \
189
+ CLERK_WEBHOOK_SECRET=""
190
+
181
191
  # S3
182
192
  ENV NEXT_PUBLIC_S3_DOMAIN="" \
183
193
  S3_PUBLIC_DOMAIN="" \
184
194
  S3_ACCESS_KEY_ID="" \
185
195
  S3_BUCKET="" \
186
196
  S3_ENDPOINT="" \
187
- S3_SECRET_ACCESS_KEY=""
197
+ S3_SECRET_ACCESS_KEY="" \
198
+ S3_ENABLE_PATH_STYLE="" \
199
+ S3_SET_ACL=""
188
200
 
189
201
  # Model Variables
190
202
  ENV \
@@ -297,7 +309,7 @@ ENV \
297
309
  # 302.AI
298
310
  AI302_API_KEY="" AI302_MODEL_LIST="" \
299
311
  # FAL
300
- FAL_API_KEY="" FAL_MODEL_LIST="" \
312
+ ENABLED_FAL="" FAL_API_KEY="" FAL_MODEL_LIST="" \
301
313
  # BFL
302
314
  BFL_API_KEY="" BFL_MODEL_LIST="" \
303
315
  # Vercel AI Gateway
package/Dockerfile.pglite CHANGED
@@ -144,7 +144,8 @@ ENV ACCESS_CODE="" \
144
144
  DEFAULT_AGENT_CONFIG="" \
145
145
  SYSTEM_AGENT="" \
146
146
  FEATURE_FLAGS="" \
147
- PROXY_URL=""
147
+ PROXY_URL="" \
148
+ ENABLE_AUTH_PROTECTION=""
148
149
 
149
150
  # Model Variables
150
151
  ENV \
@@ -253,7 +254,7 @@ ENV \
253
254
  # 302.AI
254
255
  AI302_API_KEY="" AI302_MODEL_LIST="" \
255
256
  # FAL
256
- FAL_API_KEY="" FAL_MODEL_LIST="" \
257
+ ENABLED_FAL="" FAL_API_KEY="" FAL_MODEL_LIST="" \
257
258
  # BFL
258
259
  BFL_API_KEY="" BFL_MODEL_LIST="" \
259
260
  # Vercel AI Gateway
package/changelog/v1.json CHANGED
@@ -1,4 +1,22 @@
1
1
  [
2
+ {
3
+ "children": {
4
+ "improvements": [
5
+ "Change the user chatItem maxWidth should use flex 1."
6
+ ]
7
+ },
8
+ "date": "2025-10-14",
9
+ "version": "1.137.1"
10
+ },
11
+ {
12
+ "children": {
13
+ "features": [
14
+ "Add new setting for default image num."
15
+ ]
16
+ },
17
+ "date": "2025-10-12",
18
+ "version": "1.137.0"
19
+ },
2
20
  {
3
21
  "children": {
4
22
  "fixes": [
@@ -945,6 +945,7 @@ table user_settings {
945
945
  system_agent jsonb
946
946
  default_agent jsonb
947
947
  tool jsonb
948
+ image jsonb
948
949
  }
949
950
 
950
951
  table users {
@@ -31,20 +31,30 @@ You can achieve various feature combinations using the above configuration synta
31
31
  their default values).
32
32
  </Callout>
33
33
 
34
- | Configuration Item | Description | Default Value |
35
- | ------------------------- | ----------------------------------------------- | ------------- |
36
- | `webrtc_sync` | Enables WebRTC sync functionality. | Disabled |
37
- | `language_model_settings` | Enables language model settings. | Enabled |
38
- | `openai_api_key` | Allows users to customize the OpenAI API Key. | Enabled |
39
- | `openai_proxy_url` | Allows users to customize the OpenAI proxy URL. | Enabled |
40
- | `create_session` | Allows users to create sessions. | Enabled |
41
- | `edit_agent` | Allows users to edit assistants. | Enabled |
42
- | `dalle` | Enables the DALL-E functionality. | Enabled |
43
- | `check_updates` | Allows checking for updates. | Enabled |
44
- | `welcome_suggest` | Displays welcome suggestions. | Enabled |
45
- | `market` | Enables the assistant market functionality. | Enabled |
46
- | `speech_to_text` | Enables speech-to-text functionality. | Enabled |
47
- | `knowledge_base` | Enables the knowledge base functionality. | Enabled |
48
- | `clerk_sign_up` | Enables the Clerk SignUp functionality. | Enabled |
34
+ | Configuration Item | Description | Default Value |
35
+ | ------------------------- | -------------------------------------------------------------------------------------------------------- | ------------- |
36
+ | `check_updates` | Allows checking for updates. | Enabled |
37
+ | `pin_list` | Controls pinned agent list display in sidebar. | Disabled |
38
+ | `language_model_settings` | Enables language model settings. | Enabled |
39
+ | `provider_settings` | Controls model provider settings display. | Enabled |
40
+ | `openai_api_key` | Allows users to customize the OpenAI API Key. | Enabled |
41
+ | `openai_proxy_url` | Allows users to customize the OpenAI proxy URL. | Enabled |
42
+ | `api_key_manage` | Controls access to API key management page (/profile/apikey). | Disabled |
43
+ | `create_session` | Allows users to create sessions. | Enabled |
44
+ | `edit_agent` | Allows users to edit assistants. | Enabled |
45
+ | `plugins` | Controls plugin functionality in chat and agent settings. | Enabled |
46
+ | `dalle` | Enables the DALL-E functionality. | Enabled |
47
+ | `ai_image` | Controls AI image generation feature and page (/image). | Enabled |
48
+ | `speech_to_text` | Enables speech-to-text functionality. | Enabled |
49
+ | `token_counter` | Reserved for token counter display. | Enabled |
50
+ | `welcome_suggest` | Displays welcome suggestions. | Enabled |
51
+ | `changelog` | Controls changelog modal/page display. | Enabled |
52
+ | `clerk_sign_up` | Enables the Clerk SignUp functionality. | Enabled |
53
+ | `market` | Enables the assistant market functionality. | Enabled |
54
+ | `knowledge_base` | Enables the knowledge base functionality. | Enabled |
55
+ | `rag_eval` | Controls RAG evaluation feature (/repos/\[id]/evals). | Disabled |
56
+ | `cloud_promotion` | Controls cloud service promotion link display in user menu. | Disabled |
57
+ | `commercial_hide_github` | Hides GitHub-related links in settings footer (requires commercial license). | Disabled |
58
+ | `commercial_hide_docs` | Hides documentation and help menu including changelog, docs, and feedback (requires commercial license). | Disabled |
49
59
 
50
60
  You can always check the [featureFlags](https://github.com/lobehub/lobe-chat/blob/main/src/config/featureFlags/schema.ts) to get the latest list of feature flags.
@@ -28,20 +28,30 @@ tags:
28
28
  关键字,你需要手动控制所有的功能标志(否则它们会采用对应的默认值)。
29
29
  </Callout>
30
30
 
31
- | 配置项 | 解释 | 默认值 |
32
- | ------------------------- | ----------------------- | --- |
33
- | `webrtc_sync` | 启用 WebRTC 同步功能。 | 关闭 |
34
- | `language_model_settings` | 启用语言模型设置。 | 开启 |
35
- | `openai_api_key` | 允许用户自定义 OpenAI API Key。 | 开启 |
36
- | `openai_proxy_url` | 允许用户自定义 OpenAI 代理 URL。 | 开启 |
37
- | `create_session` | 允许用户创建会话。 | 开启 |
38
- | `edit_agent` | 允许用户编辑助手。 | 开启 |
39
- | `dalle` | 启用 DALL-E 功能。 | 开启 |
40
- | `check_updates` | 允许检查更新。 | 开启 |
41
- | `welcome_suggest` | 显示欢迎建议。 | 开启 |
42
- | `market` | 启用助手市场功能。 | 开启 |
43
- | `speech_to_text` | 启用语音转文本功能。 | 开启 |
44
- | `knowledge_base` | 启用知识库功能。 | 开启 |
45
- | `clerk_sign_up` | 启用 Clerk 注册功能。 | 开启 |
31
+ | 配置项 | 解释 | 默认值 |
32
+ | ------------------------- | ------------------------------------ | --- |
33
+ | `check_updates` | 允许检查更新。 | 开启 |
34
+ | `pin_list` | 控制侧边栏中置顶助手列表的显示。 | 关闭 |
35
+ | `language_model_settings` | 启用语言模型设置。 | 开启 |
36
+ | `provider_settings` | 控制模型供应商设置的显示。 | 开启 |
37
+ | `openai_api_key` | 允许用户自定义 OpenAI API Key。 | 开启 |
38
+ | `openai_proxy_url` | 允许用户自定义 OpenAI 代理 URL。 | 开启 |
39
+ | `api_key_manage` | 控制 API 密钥管理页面 (/profile/apikey) 的访问。 | 关闭 |
40
+ | `create_session` | 允许用户创建会话。 | 开启 |
41
+ | `edit_agent` | 允许用户编辑助手。 | 开启 |
42
+ | `plugins` | 控制聊天和助手设置中的插件功能。 | 开启 |
43
+ | `dalle` | 启用 DALL-E 功能。 | 开启 |
44
+ | `ai_image` | 控制 AI 图像生成功能和页面 (/image)。 | 开启 |
45
+ | `speech_to_text` | 启用语音转文本功能。 | 开启 |
46
+ | `token_counter` | 保留用于令牌计数器显示。 | 开启 |
47
+ | `welcome_suggest` | 显示欢迎建议。 | 开启 |
48
+ | `changelog` | 控制更新日志弹窗 / 页面的显示。 | 开启 |
49
+ | `clerk_sign_up` | 启用 Clerk 注册功能。 | 开启 |
50
+ | `market` | 启用助手市场功能。 | 开启 |
51
+ | `knowledge_base` | 启用知识库功能。 | 开启 |
52
+ | `rag_eval` | 控制 RAG 评估功能 (/repos/\[id]/evals)。 | 关闭 |
53
+ | `cloud_promotion` | 控制用户菜单中云服务推广链接的显示。 | 关闭 |
54
+ | `commercial_hide_github` | 隐藏设置页面底部的 GitHub 相关链接(需要商业授权)。 | 关闭 |
55
+ | `commercial_hide_docs` | 隐藏文档和帮助菜单,包括更新日志、文档和反馈(需要商业授权)。 | 关闭 |
46
56
 
47
57
  你可以随时检查 [featureFlags](https://github.com/lobehub/lobe-chat/blob/main/src/config/featureFlags/schema.ts) 以获取最新的特性标志列表。
@@ -152,6 +152,18 @@ For specific content, please refer to the [Feature Flags](/docs/self-hosting/adv
152
152
  - Default: -
153
153
  - Example: `https://cdn.example.com`
154
154
 
155
+ ## AI Image
156
+
157
+ ### `AI_IMAGE_DEFAULT_IMAGE_NUM`
158
+
159
+ - Type: Optional
160
+ - Description: Sets the default number of images to generate for AI image generation. Users can still override this value in their settings.
161
+ - Default: `4`
162
+ - Example: `6`
163
+ - Range: `1-20`
164
+
165
+ This environment variable allows administrators to customize the default image generation count for their deployment. The value must be between 1 and 20. If not set, it defaults to 4. Users can still adjust this value in their personal settings.
166
+
155
167
  ## Plugin Service
156
168
 
157
169
  ### `PLUGINS_INDEX_URL`
@@ -148,6 +148,18 @@ LobeChat 在部署时提供了一些额外的配置项,你可以使用环境
148
148
  - 默认值:-
149
149
  - 示例:`https://cdn.example.com`
150
150
 
151
+ ## AI 图像
152
+
153
+ ### `AI_IMAGE_DEFAULT_IMAGE_NUM`
154
+
155
+ - 类型:可选
156
+ - 描述:设置 AI 图像生成的默认图片数量。用户仍可在个人设置中覆盖此值。
157
+ - 默认值:`4`
158
+ - 示例:`6`
159
+ - 范围:`1-20`
160
+
161
+ 此环境变量允许管理员为其部署自定义默认图片生成数量。值必须在 1 到 20 之间。如果未设置,默认为 4。用户仍可在个人设置中调整此值。
162
+
151
163
  ## 插件服务
152
164
 
153
165
  ### `PLUGINS_INDEX_URL`
@@ -294,6 +294,13 @@
294
294
  },
295
295
  "title": "الإعدادات العامة"
296
296
  },
297
+ "settingImage": {
298
+ "defaultCount": {
299
+ "desc": "اضبط عدد الصور الافتراضي عند إنشاء مهمة جديدة في لوحة توليد الصور.",
300
+ "label": "عدد الصور الافتراضي",
301
+ "title": "إعدادات الرسم بالذكاء الاصطناعي"
302
+ }
303
+ },
297
304
  "settingModel": {
298
305
  "enableMaxTokens": {
299
306
  "title": "تمكين الحد الأقصى للردود"
@@ -549,6 +556,7 @@
549
556
  "common": "إعدادات عامة",
550
557
  "experiment": "تجربة",
551
558
  "hotkey": "اختصارات لوحة المفاتيح",
559
+ "image": "الرسم بالذكاء الاصطناعي",
552
560
  "llm": "نموذج اللغة",
553
561
  "provider": "مزود خدمة الذكاء الاصطناعي",
554
562
  "proxy": "وكيل الشبكة",
@@ -294,6 +294,13 @@
294
294
  },
295
295
  "title": "Общи настройки"
296
296
  },
297
+ "settingImage": {
298
+ "defaultCount": {
299
+ "desc": "Задайте броя на изображенията по подразбиране, които да се генерират при създаване на нова задача в панела за генериране на изображения.",
300
+ "label": "Брой изображения по подразбиране",
301
+ "title": "Настройки за AI рисуване"
302
+ }
303
+ },
297
304
  "settingModel": {
298
305
  "enableMaxTokens": {
299
306
  "title": "Активиране на ограничението за максимален брой токени"
@@ -549,6 +556,7 @@
549
556
  "common": "Общи настройки",
550
557
  "experiment": "Експеримент",
551
558
  "hotkey": "Бързи клавиши",
559
+ "image": "AI рисуване",
552
560
  "llm": "Езиков модел",
553
561
  "provider": "AI доставчик",
554
562
  "proxy": "Мрежов прокси",
@@ -294,6 +294,13 @@
294
294
  },
295
295
  "title": "Allgemeine Einstellungen"
296
296
  },
297
+ "settingImage": {
298
+ "defaultCount": {
299
+ "desc": "Legen Sie die Standardanzahl der Bilder fest, die beim Erstellen einer neuen Aufgabe im Bildgenerierungs-Panel erzeugt werden.",
300
+ "label": "Standardanzahl der Bilder",
301
+ "title": "AI-Zeichnungseinstellungen"
302
+ }
303
+ },
297
304
  "settingModel": {
298
305
  "enableMaxTokens": {
299
306
  "title": "Maximale Token pro Antwort aktivieren"
@@ -549,6 +556,7 @@
549
556
  "common": "Allgemeine Einstellungen",
550
557
  "experiment": "Experiment",
551
558
  "hotkey": "Tastenkombinationen",
559
+ "image": "AI-Zeichnung",
552
560
  "llm": "Sprachmodell",
553
561
  "provider": "KI-Dienstanbieter",
554
562
  "proxy": "Netzwerkproxy",
@@ -294,6 +294,13 @@
294
294
  },
295
295
  "title": "General Settings"
296
296
  },
297
+ "settingImage": {
298
+ "defaultCount": {
299
+ "desc": "Set the default number of images generated when creating a new task in the image generation panel.",
300
+ "label": "Default Image Count",
301
+ "title": "AI Drawing Settings"
302
+ }
303
+ },
297
304
  "settingModel": {
298
305
  "enableMaxTokens": {
299
306
  "title": "Enable Max Tokens Limit"
@@ -549,6 +556,7 @@
549
556
  "common": "Common Settings",
550
557
  "experiment": "Experiment",
551
558
  "hotkey": "Hotkeys",
559
+ "image": "AI Drawing",
552
560
  "llm": "Language Model",
553
561
  "provider": "AI Service Provider",
554
562
  "proxy": "Network Proxy",
@@ -294,6 +294,13 @@
294
294
  },
295
295
  "title": "Configuración Común"
296
296
  },
297
+ "settingImage": {
298
+ "defaultCount": {
299
+ "desc": "Establece la cantidad predeterminada de imágenes al crear una nueva tarea en el panel de generación de imágenes.",
300
+ "label": "Cantidad de imágenes predeterminada",
301
+ "title": "Configuración de dibujo con IA"
302
+ }
303
+ },
297
304
  "settingModel": {
298
305
  "enableMaxTokens": {
299
306
  "title": "Activar límite de tokens por respuesta"
@@ -549,6 +556,7 @@
549
556
  "common": "Configuración común",
550
557
  "experiment": "Experimento",
551
558
  "hotkey": "Atajos de teclado",
559
+ "image": "Dibujo con IA",
552
560
  "llm": "Modelo de lenguaje",
553
561
  "provider": "Proveedor de servicios de IA",
554
562
  "proxy": "Proxy de red",