@lobehub/chat 0.128.4 → 0.128.6

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 (74) hide show
  1. package/.i18nrc.js +1 -1
  2. package/CHANGELOG.md +50 -0
  3. package/README.md +3 -3
  4. package/README.zh-CN.md +2 -2
  5. package/contributing/Upstream-Sync.md +58 -0
  6. package/contributing/Upstream-Sync.zh-CN.md +58 -0
  7. package/docs/{environment-variables/common.mdx → self-hosting/environment-variables/basic.mdx} +7 -0
  8. package/docs/{environment-variables/common.zh-CN.mdx → self-hosting/environment-variables/basic.zh-CN.mdx} +7 -0
  9. package/docs/self-hosting/platform/sealos.mdx +28 -0
  10. package/docs/self-hosting/platform/sealos.zh-CN.mdx +28 -0
  11. package/docs/self-hosting/platform/zeabur.mdx +28 -0
  12. package/docs/self-hosting/platform/zeabur.zh-CN.mdx +28 -0
  13. package/docs/{agents → usage/agents}/prompt.mdx +1 -1
  14. package/docs/{agents → usage/agents}/topics.mdx +1 -2
  15. package/package.json +2 -2
  16. package/src/app/api/auth/next-auth.ts +1 -0
  17. package/src/const/url.ts +4 -6
  18. package/src/middleware.ts +4 -1
  19. package/docs/self-hosting/environment-variable.mdx +0 -340
  20. package/docs/self-hosting/environment-variable.zh-CN.mdx +0 -344
  21. /package/docs/self-hosting/{analytics.mdx → advanced/analytics.mdx} +0 -0
  22. /package/docs/self-hosting/{analytics.zh-CN.mdx → advanced/analytics.zh-CN.mdx} +0 -0
  23. /package/docs/self-hosting/{authentication.mdx → advanced/authentication.mdx} +0 -0
  24. /package/docs/self-hosting/{authentication.zh-CN.mdx → advanced/authentication.zh-CN.mdx} +0 -0
  25. /package/docs/self-hosting/{upstream-sync.mdx → advanced/upstream-sync.mdx} +0 -0
  26. /package/docs/self-hosting/{upstream-sync.zh-CN.mdx → advanced/upstream-sync.zh-CN.mdx} +0 -0
  27. /package/docs/{environment-variables → self-hosting/environment-variables}/model-provider.mdx +0 -0
  28. /package/docs/{environment-variables → self-hosting/environment-variables}/model-provider.zh-CN.mdx +0 -0
  29. /package/docs/self-hosting/{deploy-with-azure-openai.mdx → examples/azure-openai.mdx} +0 -0
  30. /package/docs/self-hosting/{deploy-with-azure-openai.zh-CN.mdx → examples/azure-openai.zh-CN.mdx} +0 -0
  31. /package/docs/{common-errors → self-hosting/faq}/no-v1-suffix.mdx +0 -0
  32. /package/docs/{common-errors → self-hosting/faq}/no-v1-suffix.zh-CN.mdx +0 -0
  33. /package/docs/{common-errors → self-hosting/faq}/proxy-with-unable-to-verify-leaf-signature.mdx +0 -0
  34. /package/docs/{common-errors → self-hosting/faq}/proxy-with-unable-to-verify-leaf-signature.zh-CN.mdx +0 -0
  35. /package/docs/self-hosting/{docker-compose.mdx → platform/docker-compose.mdx} +0 -0
  36. /package/docs/self-hosting/{docker-compose.zh-CN.mdx → platform/docker-compose.zh-CN.mdx} +0 -0
  37. /package/docs/self-hosting/{docker.mdx → platform/docker.mdx} +0 -0
  38. /package/docs/self-hosting/{docker.zh-CN.mdx → platform/docker.zh-CN.mdx} +0 -0
  39. /package/docs/self-hosting/{vercel.mdx → platform/vercel.mdx} +0 -0
  40. /package/docs/self-hosting/{vercel.zh-CN.mdx → platform/vercel.zh-CN.mdx} +0 -0
  41. /package/docs/{agents → usage/agents}/concepts.mdx +0 -0
  42. /package/docs/{agents → usage/agents}/concepts.zh-CN.mdx +0 -0
  43. /package/docs/{agents → usage/agents}/custom-agent.mdx +0 -0
  44. /package/docs/{agents → usage/agents}/custom-agent.zh-CN.mdx +0 -0
  45. /package/docs/{agents → usage/agents}/model.mdx +0 -0
  46. /package/docs/{agents → usage/agents}/model.zh-CN.mdx +0 -0
  47. /package/docs/{agents → usage/agents}/prompt.zh-CN.mdx +0 -0
  48. /package/docs/{agents → usage/agents}/topics.zh-CN.mdx +0 -0
  49. /package/docs/usage/{agent-market.mdx → features/agent-market.mdx} +0 -0
  50. /package/docs/usage/{agent-market.zh-CN.mdx → features/agent-market.zh-CN.mdx} +0 -0
  51. /package/docs/usage/{mobile.mdx → features/mobile.mdx} +0 -0
  52. /package/docs/usage/{mobile.zh-CN.mdx → features/mobile.zh-CN.mdx} +0 -0
  53. /package/docs/usage/{more.mdx → features/more.mdx} +0 -0
  54. /package/docs/usage/{more.zh-CN.mdx → features/more.zh-CN.mdx} +0 -0
  55. /package/docs/usage/{plugin-system.mdx → features/plugin-system.mdx} +0 -0
  56. /package/docs/usage/{plugin-system.zh-CN.mdx → features/plugin-system.zh-CN.mdx} +0 -0
  57. /package/docs/usage/{pwa.mdx → features/pwa.mdx} +0 -0
  58. /package/docs/usage/{pwa.zh-CN.mdx → features/pwa.zh-CN.mdx} +0 -0
  59. /package/docs/usage/{text-to-image.mdx → features/text-to-image.mdx} +0 -0
  60. /package/docs/usage/{text-to-image.zh-CN.mdx → features/text-to-image.zh-CN.mdx} +0 -0
  61. /package/docs/usage/{theme.mdx → features/theme.mdx} +0 -0
  62. /package/docs/usage/{theme.zh-CN.mdx → features/theme.zh-CN.mdx} +0 -0
  63. /package/docs/usage/{tts.mdx → features/tts.mdx} +0 -0
  64. /package/docs/usage/{tts.zh-CN.mdx → features/tts.zh-CN.mdx} +0 -0
  65. /package/docs/usage/{vision.mdx → features/vision.mdx} +0 -0
  66. /package/docs/usage/{vision.zh-CN.mdx → features/vision.zh-CN.mdx} +0 -0
  67. /package/docs/{plugins → usage/plugins}/basic-usage.mdx +0 -0
  68. /package/docs/{plugins → usage/plugins}/basic-usage.zh-CN.mdx +0 -0
  69. /package/docs/{plugins → usage/plugins}/custom-plugin.mdx +0 -0
  70. /package/docs/{plugins → usage/plugins}/custom-plugin.zh-CN.mdx +0 -0
  71. /package/docs/{plugins → usage/plugins}/plugin-development.mdx +0 -0
  72. /package/docs/{plugins → usage/plugins}/plugin-development.zh-CN.mdx +0 -0
  73. /package/docs/{plugins → usage/plugins}/plugin-store.mdx +0 -0
  74. /package/docs/{plugins → usage/plugins}/plugin-store.zh-CN.mdx +0 -0
@@ -1,340 +0,0 @@
1
- ```markdown
2
- import { Callout } from 'nextra/components';
3
-
4
- # Environment Variables
5
-
6
- LobeChat provides some additional configuration options during deployment, which can be customized using environment variables.
7
-
8
- ## Common Variables
9
-
10
- ### `ACCESS_CODE`
11
-
12
- - Type: Optional
13
- - Description: Add a password to access the LobeChat service. You can set a long password to prevent brute force attacks.
14
- - Default: -
15
- - Example: `awCTe)re_r74` or `rtrt_ewee3@09!`
16
-
17
- ### `ENABLE_OAUTH_SSO`
18
-
19
- - Type: Optional
20
- - Description: Enable Single Sign-On (SSO) for LobeChat. Set to `1` to enable SSO. For more information, see [Authentication Services](#authentication-services).
21
- - Default: -
22
- - Example: `1`
23
-
24
- ### `NEXT_PUBLIC_BASE_PATH`
25
-
26
- - Type: Optional
27
- - Description: Add a `basePath` for LobeChat.
28
- - Default: -
29
- - Example: `/test`
30
-
31
- ### `DEFAULT_AGENT_CONFIG`
32
-
33
- - Type: Optional
34
- - Description: Used to configure the default settings for the LobeChat default assistant. It supports various data types and structures, including key-value pairs, nested fields, array values, etc.
35
- - Default: -
36
- - Example: `'model=gpt-4-1106-preview;params.max_tokens=300;plugins=search-engine,lobe-image-designer`
37
-
38
- `DEFAULT_AGENT_CONFIG` is used to configure the default settings for the LobeChat default assistant. It supports various data types and structures, including key-value pairs, nested fields, array values, etc. The table below provides detailed information on the configuration options, examples, and corresponding explanations for the `DEFAULT_AGENT_CONFIG` environment variable:
39
-
40
- | Configuration Type | Example | Explanation |
41
- | ------------------- | -------------------------------------------- | -------------------------------------------------------- |
42
- | Basic Key-Value Pair| `model=gpt-4` | Set the model to `gpt-4`. |
43
- | Nested Field | `tts.sttLocale=en-US` | Set the language locale for the text-to-speech service to `en-US`. |
44
- | Array | `plugins=search-engine,lobe-image-designer` | Enable the `search-engine` and `lobe-image-designer` plugins. |
45
- | Chinese Comma | `plugins=search-engine,lobe-image-designer` | Same as above, demonstrating support for Chinese comma separation. |
46
- | Multiple Configurations | `model=glm-4;provider=zhipu` | Set the model to `glm-4` and the model provider to `zhipu`. |
47
- | Numeric Value | `params.max_tokens=300` | Set the maximum tokens to `300`. |
48
- | Boolean Value | `enableAutoCreateTopic=true` | Enable automatic topic creation. |
49
- | Special Characters | `inputTemplate="Hello; I am a bot;"` | Set the input template to `Hello; I am a bot;`. |
50
- | Error Handling | `model=gpt-4;maxToken` | Ignore invalid entry `maxToken` and only parse `model=gpt-4`. |
51
- | Value Override | `model=gpt-4;model=gpt-4-1106-preview` | If the key is repeated, use the value that appears last, in this case, the value of `model` is `gpt-4-1106-preview`. |
52
-
53
- Further Reading:
54
-
55
- - [\[RFC\] 022 - Environment Variable Configuration for Default Assistant Parameters](https://github.com/lobehub/lobe-chat/discussions/913)
56
- ```
57
-
58
- ## Identity Verification Service
59
-
60
- ### General Settings
61
-
62
- #### `ENABLE_OAUTH_SSO`
63
-
64
- - Type: Required
65
- - Description: Enable Single Sign-On (SSO) for LobeChat. Set to `1` to enable single sign-on.
66
- - Default: `-`
67
- - Example: `1`
68
-
69
- #### `NEXTAUTH_SECRET`
70
-
71
- - Type: Required
72
- - Description: Key used to encrypt the session tokens in Auth.js. You can generate the key using the following command: `openssl rand -base64 32`.
73
- - Default: `-`
74
- - Example: `Tfhi2t2pelSMEA8eaV61KaqPNEndFFdMIxDaJnS1CUI=`
75
-
76
- ### Auth0
77
-
78
- <Callout>
79
- Currently, we only support the Auth0 identity verification service provider. If you need to use another identity verification service provider, you can submit a [feature request](https://github.com/lobehub/lobe-chat/issues/new/choose) or a pull request.
80
- </Callout>
81
-
82
- #### `AUTH0_CLIENT_ID`
83
-
84
- - Type: Required
85
- - Description: Client ID of the Auth0 application. You can access it [here][auth0-client-page] and navigate to the application settings to view.
86
- - Default: `-`
87
- - Example: `evCnOJP1UX8FMnXR9Xkj5t0NyFn5p70P`
88
-
89
- #### `AUTH0_CLIENT_SECRET`
90
-
91
- - Type: Required
92
- - Description: Client Secret of the Auth0 application.
93
- - Default: `-`
94
- - Example: `wnX7UbZg85ZUzF6ioxPLnJVEQa1Elbs7aqBUSF16xleBS5AdkVfASS49-fQIC8Rm`
95
-
96
- #### `AUTH0_ISSUER`
97
-
98
- - Type: Required
99
- - Description: Issuer/domain of the Auth0 application.
100
- - Default: `-`
101
- - Example: `https://example.auth0.com`
102
-
103
- ## Model Service Provider
104
-
105
- ### OpenAI
106
-
107
- #### `OPENAI_API_KEY`
108
-
109
- - Type: Required
110
- - Description: This is the API key you applied for on the OpenAI account page, you can go to [here][openai-api-page] to view
111
- - Default: -
112
- - Example: `sk-xxxxxx...xxxxxx`
113
-
114
- #### `OPENAI_PROXY_URL`
115
-
116
- - Type: Optional
117
- - Description: If you manually configure the OpenAI interface proxy, you can use this configuration item to override the default OpenAI API request base URL
118
- - Default: `https://api.openai.com/v1`
119
- - Example: `https://api.chatanywhere.cn` or `https://aihubmix.com/v1`
120
-
121
- \<Callout type={'warning'}>
122
- Please check the request suffix of your proxy service provider. Some proxy service providers may add `/v1` to the request suffix, while others may not. If you find that the AI returns an empty message during testing, try adding the `/v1` suffix and retry. </Callout>
123
-
124
- \<Callout type={'info'}>
125
- Whether to fill in `/v1` is closely related to the model service provider. For example, the default address of openai is `api.openai.com/v1`. If your proxy forwards the `/v1` interface, you can simply fill in `proxy.com`. However, if the model service provider directly forwards the `api.openai.com` domain, then you need to add `/v1` to the URL yourself. </Callout>
126
-
127
- Related discussions:
128
-
129
- - [Why is the return value blank after installing Docker, configuring the environment variables?](https://github.com/lobehub/lobe-chat/discussions/623)
130
- - [Reasons for errors using third-party interfaces](https://github.com/lobehub/lobe-chat/discussions/734)
131
- - [No response when the proxy server address is filled in for chatting](https://github.com/lobehub/lobe-chat/discussions/1065)
132
-
133
- #### `CUSTOM_MODELS`
134
-
135
- - Type: Optional
136
- - Description: Used to control the model list, use `+` to add a model, use `-` to hide a model, use `model name=display name` to customize the display name of a model, separated by English commas.
137
- - Default: `-`
138
- - Example: `+qwen-7b-chat,+glm-6b,-gpt-3.5-turbo,gpt-4-0125-preview=gpt-4-turbo`
139
-
140
- The above example adds `qwen-7b-chat` and `glm-6b` to the model list, removes `gpt-3.5-turbo` from the list, and displays the model name of `gpt-4-0125-preview` as `gpt-4-turbo`. If you want to disable all models first and then enable specific models, you can use `-all,+gpt-3.5-turbo`, which means only `gpt-3.5-turbo` is enabled.
141
-
142
- You can find all current model names in [modelProviders](https://github.com/lobehub/lobe-chat/tree/main/src/config/modelProviders).
143
-
144
- ### Azure OpenAI
145
-
146
- If you need to use Azure OpenAI to provide model services, you can refer to the [Deploying with Azure OpenAI](../Deployment/Deploy-with-Azure-OpenAI.en-US.md) section for detailed steps. Here, we will list the environment variables related to Azure OpenAI.
147
-
148
- #### `USE_AZURE_OPENAI`
149
-
150
- - Type: Optional
151
- - Description: Set this value to `1` to enable Azure OpenAI configuration
152
- - Default: -
153
- - Example: `1`
154
-
155
- #### `AZURE_API_KEY`
156
-
157
- - Type: Optional
158
- - Description: This is the API key you applied for on the Azure OpenAI account page
159
- - Default: -
160
- - Example: `c55168be3874490ef0565d9779ecd5a6`
161
-
162
- #### `AZURE_API_VERSION`
163
-
164
- - Type: Optional
165
- - Description: The API version of Azure, following the format YYYY-MM-DD
166
- - Default: `2023-08-01-preview`
167
- - Example: `2023-05-15`, refer to the [latest version][azure-api-verion-url]
168
-
169
- ### ZHIPU AI
170
-
171
- #### `ZHIPU_API_KEY`
172
-
173
- - Type: Required
174
- - Description: This is the API key you applied for in the ZHIPU AI service
175
- - Default: -
176
- - Example: `4582d332441a313f5c2ed9824d1798ca.rC8EcTAhgbOuAuVT`
177
-
178
- ### Moonshot AI
179
-
180
- #### `MOONSHOT_API_KEY`
181
-
182
- - Type: Required
183
- - Description: This is the API key you applied for in the Moonshot AI service
184
- - Default: -
185
- - Example: `Y2xpdGhpMzNhZXNoYjVtdnZjMWc6bXNrLWIxQlk3aDNPaXpBWnc0V1RaMDhSRmRFVlpZUWY=`
186
-
187
- ### Google AI
188
-
189
- #### `GOOGLE_API_KEY`
190
-
191
- - Type: Required
192
- - Description: This is the API key you applied for in the Google AI Platform to access Google AI services
193
- - Default: -
194
- - Example: `AIraDyDwcw254kwJaGjI9wwaHcdDCS__Vt3xQE`
195
-
196
- ### AWS Bedrock
197
-
198
- #### `AWS_ACCESS_KEY_ID`
199
-
200
- - Type: Required
201
- - Description: Access key ID for AWS service authentication
202
- - Default: -
203
- - Example: `AKIA5STVRLFSB4S9HWBR`
204
-
205
- #### `AWS_SECRET_ACCESS_KEY`
206
-
207
- - Type: Required
208
- - Description: Secret key for AWS service authentication
209
- - Default: -
210
- - Example: `Th3vXxLYpuKcv2BARktPSTPxx+jbSiFT6/0w7oEC`
211
-
212
- #### `AWS_REGION`
213
-
214
- - Type: Optional
215
- - Description: Region setting for AWS services
216
- - Default: `us-east-1`
217
- - Example: `us-east-1`
218
-
219
- ### Ollama
220
-
221
- #### `OLLAMA_PROXY_URL`
222
-
223
- - Type: Optional
224
- - Description: Used to enable the Ollama service, setting this will display optional open-source language models in the language model list and can also specify custom language models
225
- - Default: -
226
- - Example: `http://127.0.0.1:11434/v1`
227
-
228
- ## Plugin Service
229
-
230
- ### `PLUGINS_INDEX_URL`
231
-
232
- - Type: Optional
233
- - Description: The index address of the LobeChat plugin market. If you have deployed the plugin market service on your own, you can use this variable to override the default plugin market address.
234
- - Default Value: `https://chat-plugins.lobehub.com`
235
-
236
- ### `PLUGIN_SETTINGS`
237
-
238
- - Type: Optional
239
- - Description: Used to configure plugin settings. Use the format `plugin_name:setting_field=setting_value` to configure the plugin settings. Multiple setting fields are separated by an English semicolon `;`, and multiple plugin settings are separated by an English comma `,`.
240
- - Default Value: `-`
241
- - Example: `search-engine:SERPAPI_API_KEY=xxxxx,plugin-2:key1=value1;key2=value2`
242
-
243
- The above example sets the `SERPAPI_API_KEY` of the `search-engine` plugin to `xxxxx`, and sets `key1` of `plugin-2` to `value1`, and `key2` to `value2`. The generated plugin settings configuration is as follows:
244
-
245
- ```json
246
- {
247
- "plugin-2": {
248
- "key1": "value1",
249
- "key2": "value2"
250
- },
251
- "search-engine": {
252
- "SERPAPI_API_KEY": "xxxxx"
253
- }
254
- }
255
- ```
256
-
257
- ## Assistant Market
258
-
259
- ### `AGENTS_INDEX_URL`
260
-
261
- - Type: Optional
262
- - Description: The index address of the LobeChat assistant market. If you have deployed the assistant market service on your own, you can use this variable to override the default market address.
263
- - Default Value: `https://chat-agents.lobehub.com`
264
-
265
- ## Data Analytics
266
-
267
- ### Vercel Analytics
268
-
269
- #### `NEXT_PUBLIC_ANALYTICS_VERCEL`
270
-
271
- - Type: Optional
272
- - Description: Used to configure the environment variables for Vercel Analytics. Set to `1` to enable Vercel Analytics.
273
- - Default Value: `-`
274
- - Example: `1`
275
-
276
- #### `NEXT_PUBLIC_VERCEL_DEBUG`
277
-
278
- - Type: Optional
279
- - Description: Used to enable the debug mode for Vercel Analytics.
280
- - Default Value: `-`
281
- - Example: `1`
282
-
283
- ### Posthog Analytics
284
-
285
- #### `NEXT_PUBLIC_ANALYTICS_POSTHOG`
286
-
287
- - Type: Optional
288
- - Description: Used to enable the environment variables for [PostHog Analytics][posthog-analytics-url]. Set to `1` to enable PostHog Analytics.
289
- - Default Value: `-`
290
- - Example: `1`
291
-
292
- #### `NEXT_PUBLIC_POSTHOG_KEY`
293
-
294
- - Type: Optional
295
- - Description: Set the PostHog project key.
296
- - Default Value: `-`
297
- - Example: `phc_xxxxxxxx`
298
-
299
- #### `NEXT_PUBLIC_POSTHOG_HOST`
300
-
301
- - Type: Optional
302
- - Description: Set the deployment address of the PostHog service, defaulting to the official SAAS address.
303
- - Default Value: `https://app.posthog.com`
304
- - Example: `https://example.com`
305
-
306
- #### `NEXT_PUBLIC_POSTHOG_DEBUG`
307
-
308
- - Type: Optional
309
- - Description: Enable the debug mode for PostHog.
310
- - Default Value: `-`
311
- - Example: `1`
312
-
313
- ### Umami Analytics
314
-
315
- #### `NEXT_PUBLIC_ANALYTICS_UMAMI`
316
-
317
- - Type: Optional
318
- - Description: Used to enable the environment variables for [Umami Analytics][umami-analytics-url]. Set to `1` to enable Umami Analytics.
319
- - Default Value: `-`
320
- - Example: `1`
321
-
322
- #### `NEXT_PUBLIC_UMAMI_SCRIPT_URL`
323
-
324
- - Type: Optional
325
- - Description: The URL of the Umami script, defaulting to the script URL provided by Umami Cloud.
326
- - Default Value: `https://analytics.umami.is/script.js`
327
- - Example: `https://umami.your-site.com/script.js`
328
-
329
- #### `NEXT_PUBLIC_UMAMI_WEBSITE_ID`
330
-
331
- - Type: Required
332
- - Description: Your Umami Website ID.
333
- - Default Value: `-`
334
- - Example: `E738D82A-EE9E-4806-A81F-0CA3CAE57F65`
335
-
336
- [auth0-client-page]: https://manage.auth0.com/dashboard
337
- [azure-api-verion-url]: https://docs.microsoft.com/zh-cn/azure/developer/javascript/api-reference/es-modules/azure-sdk/ai-translation/translationconfiguration?view=azure-node-latest#api-version
338
- [openai-api-page]: https://platform.openai.com/account/api-keys
339
- [posthog-analytics-url]: https://posthog.com
340
- [umami-analytics-url]: https://umami.is
@@ -1,344 +0,0 @@
1
- import { Callout } from 'nextra/components';
2
-
3
- # 环境变量
4
-
5
- LobeChat 在部署时提供了一些额外的配置项,你可以使用环境变量进行自定义设置。
6
-
7
- ## 通用变量
8
-
9
- ### `ACCESS_CODE`
10
-
11
- - 类型:可选
12
- - 描述:添加访问 LobeChat 服务的密码,你可以设置一个长密码以防被爆破
13
- - 默认值:-
14
- - 示例:`awCTe)re_r74` or `rtrt_ewee3@09!`
15
-
16
- ### `ENABLE_OAUTH_SSO`
17
-
18
- - 类型:可选
19
- - 描述:为 LobeChat 启用单点登录 (SSO)。设置为 `1` 以启用单点登录。有关详细信息,请参阅[身份验证服务](#身份验证服务)。
20
- - 默认值: `-`
21
- - 示例: `1`
22
-
23
- ### `NEXT_PUBLIC_BASE_PATH`
24
-
25
- - 类型:可选
26
- - 描述:为 LobeChat 添加 `basePath`
27
- - 默认值: `-`
28
- - 示例: `/test`
29
-
30
- #### `DEFAULT_AGENT_CONFIG`
31
-
32
- - 类型:可选
33
- - 描述:用于配置 LobeChat 默认助理的默认配置。它支持多种数据类型和结构,包括键值对、嵌套字段、数组值等。
34
- - 默认值:`-`
35
- - 示例:`'model=gpt-4-1106-preview;params.max_tokens=300;plugins=search-engine,lobe-image-designer`
36
-
37
- `DEFAULT_AGENT_CONFIG` 用于配置 LobeChat 默认助理的默认配置。它支持多种数据类型和结构,包括键值对、嵌套字段、数组值等。下表详细说明了 `DEFAULT_AGENT_CONFIG` 环境变量的配置项、示例以及相应解释:
38
-
39
- | 配置项类型 | 示例 | 解释 |
40
- | --- | --- | --- |
41
- | 基本键值对 | `model=gpt-4` | 设置模型为 `gpt-4`。 |
42
- | 嵌套字段 | `tts.sttLocale=en-US` | 设置文本到语音服务的语言区域为 `en-US`。 |
43
- | 数组 | `plugins=search-engine,lobe-image-designer` | 启用 `search-engine` 和 `lobe-image-designer` 插件。 |
44
- | 中文逗号 | `plugins=search-engine,lobe-image-designer` | 同上,演示支持中文逗号分隔。 |
45
- | 多个配置项 | `model=glm-4;provider=zhipu` | 设置模型为 `glm-4` 且模型服务商为 `zhipu`。 |
46
- | 数字值 | `params.max_tokens=300` | 设置最大令牌数为 `300`。 |
47
- | 布尔值 | `enableAutoCreateTopic=true` | 启用自动创建主题。 |
48
- | 特殊字符 | `inputTemplate="Hello; I am a bot;"` | 设置输入模板为 `Hello; I am a bot;`。 |
49
- | 错误处理 | `model=gpt-4;maxToken` | 忽略无效条目 `maxToken`,仅解析出 `model=gpt-4`。 |
50
- | 值覆盖 | `model=gpt-4;model=gpt-4-1106-preview` | 如果键重复,使用最后一次出现的值,此处 `model` 的值为 `gpt-4-1106-preview`。 |
51
-
52
- 相关阅读:
53
-
54
- - [\[RFC\] 022 - 环境变量配置默认助手参数](https://github.com/lobehub/lobe-chat/discussions/913)
55
-
56
- ## 身份验证服务
57
-
58
- ### 通用设置
59
-
60
- #### `ENABLE_OAUTH_SSO`
61
-
62
- - 类型:必选
63
- - 描述:为 LobeChat 启用单点登录 (SSO)。设置为 `1` 以启用单点登录。
64
- - 默认值: `-`
65
- - 示例: `1`
66
-
67
- #### `NEXTAUTH_SECRET`
68
-
69
- - 类型:必选
70
- - 描述:用于加密 Auth.js 会话令牌的密钥。您可以使用以下命令生成秘钥: `openssl rand -base64 32`.
71
- - 默认值: `-`
72
- - 示例: `Tfhi2t2pelSMEA8eaV61KaqPNEndFFdMIxDaJnS1CUI=`
73
-
74
- ### Auth0
75
-
76
- <Callout>
77
- 目前我们只支持 Auth0 身份验证服务提供商。如果您需要使用其他身份验证服务提供商,可以提交
78
- [功能请求](https://github.com/lobehub/lobe-chat/issues/new/choose) 或 Pull Request。
79
- </Callout>
80
-
81
- #### `AUTH0_CLIENT_ID`
82
-
83
- - 类型:必选
84
- - 描述: Auth0 应用程序的 Client ID,您可以访问[这里][auth0-client-page]并导航至应用程序设置来查看
85
- - 默认值: `-`
86
- - 示例: `evCnOJP1UX8FMnXR9Xkj5t0NyFn5p70P`
87
-
88
- #### `AUTH0_CLIENT_SECRET`
89
-
90
- - 类型:必选
91
- - 描述: Auth0 应用程序的 Client Secret
92
- - 默认值: `-`
93
- - 示例: `wnX7UbZg85ZUzF6ioxPLnJVEQa1Elbs7aqBUSF16xleBS5AdkVfASS49-fQIC8Rm`
94
-
95
- #### `AUTH0_ISSUER`
96
-
97
- - 类型:必选
98
- - 描述: Auth0 应用程序的签发人 / 域
99
- - 默认值: `-`
100
- - 示例: `https://example.auth0.com`
101
-
102
- ## 模型服务商
103
-
104
- ### OpenAI
105
-
106
- #### `OPENAI_API_KEY`
107
-
108
- - 类型:必选
109
- - 描述:这是你在 OpenAI 账户页面申请的 API 密钥,可以前往[这里][openai-api-page]查看
110
- - 默认值:-
111
- - 示例:`sk-xxxxxx...xxxxxx`
112
-
113
- #### `OPENAI_PROXY_URL`
114
-
115
- - 类型:可选
116
- - 描述:如果你手动配置了 OpenAI 接口代理,可以使用此配置项来覆盖默认的 OpenAI API 请求基础 URL
117
- - 默认值:`https://api.openai.com/v1`
118
- - 示例:`https://api.chatanywhere.cn` 或 `https://aihubmix.com/v1`
119
-
120
- <Callout type={'warning'}>
121
- 请检查你的代理服务商的请求后缀,有的代理服务商会在请求后缀添加
122
- `/v1`,有的则不会。如果你在测试时发现 AI 返回的消息为空,请尝试添加 `/v1` 后缀后重试。
123
- </Callout>
124
-
125
- <Callout type={'info'}>
126
- 是否填写 `/v1` 跟模型服务商有很大关系,比如 openai 的默认地址是 `api.openai.com/v1`
127
- 。如果你的代理商转发了 `/v1` 这个接口,那么直接填 `proxy.com` 即可。
128
- 但如果模型服务商是直接转发了 `api.openai.com` 域名,那么你就要自己加上 `/v1` 这个 url。
129
- </Callout>
130
-
131
- 相关讨论:
132
-
133
- - [Docker 安装,配置好环境变量后,为何返回值是空白?](https://github.com/lobehub/lobe-chat/discussions/623)
134
- - [使用第三方接口报错的原因](https://github.com/lobehub/lobe-chat/discussions/734)
135
- - [代理服务器地址填了聊天没任何反应](https://github.com/lobehub/lobe-chat/discussions/1065)
136
-
137
- #### `CUSTOM_MODELS`
138
-
139
- - 类型:可选
140
- - 描述:用来控制模型列表,使用 `+` 增加一个模型,使用 `-` 来隐藏一个模型,使用 `模型名=展示名` 来自定义模型的展示名,用英文逗号隔开。
141
- - 默认值:`-`
142
- - 示例:`+qwen-7b-chat,+glm-6b,-gpt-3.5-turbo,gpt-4-0125-preview=gpt-4-turbo`
143
-
144
- 上面示例表示增加 `qwen-7b-chat` 和 `glm-6b` 到模型列表,而从列表中删除 `gpt-3.5-turbo`,并将 `gpt-4-0125-preview` 模型名字展示为 `gpt-4-turbo`。如果你想先禁用所有模型,再启用指定模型,可以使用 `-all,+gpt-3.5-turbo`,则表示仅启用 `gpt-3.5-turbo`。
145
-
146
- 你可以在 [modelProviders](https://github.com/lobehub/lobe-chat/tree/main/src/config/modelProviders) 查找到当前的所有模型名。
147
-
148
- ### Azure OpenAI
149
-
150
- 如果你需要使用 Azure OpenAI 来提供模型服务,可以查阅 [使用 Azure OpenAI 部署](../Deployment/Deploy-with-Azure-OpenAI.zh-CN.md) 章节查看详细步骤,这里将列举和 Azure OpenAI 相关的环境变量。
151
-
152
- #### `USE_AZURE_OPENAI`
153
-
154
- - 类型:可选
155
- - 描述:设置该值为 `1` 开启 Azure OpenAI 配置
156
- - 默认值:-
157
- - 示例:`1`
158
-
159
- #### `AZURE_API_KEY`
160
-
161
- - 类型:可选
162
- - 描述:这是你在 Azure OpenAI 账户页面申请的 API 密钥
163
- - 默认值:-
164
- - 示例:`c55168be3874490ef0565d9779ecd5a6`
165
-
166
- #### `AZURE_API_VERSION`
167
-
168
- - 类型:可选
169
- - 描述:Azure 的 API 版本,遵循 YYYY-MM-DD 格式
170
- - 默认值:`2023-08-01-preview`
171
- - 示例:`2023-05-15`,查阅[最新版本][azure-api-verion-url]
172
-
173
- ### 智谱 AI
174
-
175
- #### `ZHIPU_API_KEY`
176
-
177
- - 类型:必选
178
- - 描述:这是你在 智谱 AI 服务中申请的 API 密钥
179
- - 默认值:-
180
- - 示例:`4582d332441a313f5c2ed9824d1798ca.rC8EcTAhgbOuAuVT`
181
-
182
- ### Moonshot AI
183
-
184
- #### `MOONSHOT_API_KEY`
185
-
186
- - 类型:必选
187
- - 描述:这是你在 Moonshot AI 服务中申请的 API 密钥
188
- - 默认值:-
189
- - 示例:`Y2xpdGhpMzNhZXNoYjVtdnZjMWc6bXNrLWIxQlk3aDNPaXpBWnc0V1RaMDhSRmRFVlpZUWY=`
190
-
191
- ### Google AI
192
-
193
- #### `GOOGLE_API_KEY`
194
-
195
- - 类型:必选
196
- - 描述:这是你在 Google AI Platform 申请的 API 密钥,用于访问 Google AI 服务
197
- - 默认值:-
198
- - 示例:`AIraDyDwcw254kwJaGjI9wwaHcdDCS__Vt3xQE`
199
-
200
- ### AWS Bedrock
201
-
202
- #### `AWS_ACCESS_KEY_ID`
203
-
204
- - 类型:必选
205
- - 描述:用于 AWS 服务认证的访问键 ID
206
- - 默认值:-
207
- - 示例:`AKIA5STVRLFSB4S9HWBR`
208
-
209
- #### `AWS_SECRET_ACCESS_KEY`
210
-
211
- - 类型:必选
212
- - 描述:用于 AWS 服务认证的密钥
213
- - 默认值:-
214
- - 示例:`Th3vXxLYpuKcv2BARktPSTPxx+jbSiFT6/0w7oEC`
215
-
216
- #### `AWS_REGION`
217
-
218
- - 类型:可选
219
- - 描述:AWS 服务的区域设置
220
- - 默认值:`us-east-1`
221
- - 示例:`us-east-1`
222
-
223
- ### Ollama
224
-
225
- #### `OLLAMA_PROXY_URL`
226
-
227
- - 类型:可选
228
- - 描述:用于启用 Ollama 服务,设置后可在语言模型列表内展示可选开源语言模型,也可以指定自定义语言模型
229
- - 默认值:-
230
- - 示例:`http://127.0.0.1:11434/v1`
231
-
232
- ## 插件服务
233
-
234
- ### `PLUGINS_INDEX_URL`
235
-
236
- - 类型:可选
237
- - 描述:LobeChat 插件市场的索引地址,如果你自行部署了插件市场的服务,可以使用该变量来覆盖默认的插件市场地址
238
- - 默认值:`https://chat-plugins.lobehub.com`
239
-
240
- ### `PLUGIN_SETTINGS`
241
-
242
- - 类型:可选
243
- - 描述:用于配置插件的设置,使用 `插件名:设置字段=设置值` 的格式来配置插件的设置,多个设置字段用英文分号 `;` 隔开,多个插件设置使用英文逗号`,`隔开。
244
- - 默认值:`-`
245
- - 示例:`search-engine:SERPAPI_API_KEY=xxxxx,plugin-2:key1=value1;key2=value2`
246
-
247
- 上述示例表示设置 `search-engine` 插件的 `SERPAPI_API_KEY` 为 `xxxxx`,设置 `plugin-2` 的 `key1` 为 `value1`,`key2` 为 `value2`。生成的插件设置配置如下:
248
-
249
- ```json
250
- {
251
- "plugin-2": {
252
- "key1": "value1",
253
- "key2": "value2"
254
- },
255
- "search-engine": {
256
- "SERPAPI_API_KEY": "xxxxx"
257
- }
258
- }
259
- ```
260
-
261
- ## 助手市场
262
-
263
- ### `AGENTS_INDEX_URL`
264
-
265
- - 类型:可选
266
- - 描述:LobeChat 助手市场的索引地址,如果你自行部署了助手市场的服务,可以使用该变量来覆盖默认的市场地址
267
- - 默认值:`https://chat-agents.lobehub.com`
268
-
269
- ## 数据统计
270
-
271
- ### Vercel Analytics
272
-
273
- #### `NEXT_PUBLIC_ANALYTICS_VERCEL`
274
-
275
- - 类型:可选
276
- - 描述:用于配置 Vercel Analytics 的环境变量,当设为 `1` 时开启 Vercel Analytics
277
- - 默认值: `-`
278
- - 示例:`1`
279
-
280
- #### `NEXT_PUBLIC_VERCEL_DEBUG`
281
-
282
- - 类型:可选
283
- - 描述:用于开启 Vercel Analytics 的调试模式
284
- - 默认值: `-`
285
- - 示例:`1`
286
-
287
- ### Posthog Analytics
288
-
289
- #### `NEXT_PUBLIC_ANALYTICS_POSTHOG`
290
-
291
- - 类型:可选
292
- - 描述:用于开启 [PostHog Analytics][posthog-analytics-url] 的环境变量,设为 `1` 时开启 PostHog Analytics
293
- - 默认值: `-`
294
- - 示例:`1`
295
-
296
- #### `NEXT_PUBLIC_POSTHOG_KEY`
297
-
298
- - 类型:可选
299
- - 描述:设置 PostHog 项目 Key
300
- - 默认值: `-`
301
- - 示例:`phc_xxxxxxxx`
302
-
303
- #### `NEXT_PUBLIC_POSTHOG_HOST`
304
-
305
- - 类型:可选
306
- - 描述:设置 PostHog 服务的部署地址,默认为官方的 SAAS 地址
307
- - 默认值:`https://app.posthog.com`
308
- - 示例:`https://example.com`
309
-
310
- #### `NEXT_PUBLIC_POSTHOG_DEBUG`
311
-
312
- - 类型:可选
313
- - 描述:开启 PostHog 的调试模式
314
- - 默认值: `-`
315
- - 示例:`1`
316
-
317
- ### Umami Analytics
318
-
319
- #### `NEXT_PUBLIC_ANALYTICS_UMAMI`
320
-
321
- - 类型:可选
322
- - 描述:用于开启 [Umami Analytics][umami-analytics-url] 的环境变量,设为 `1` 时开启 Umami Analytics
323
- - 默认值: `-`
324
- - 示例:`1`
325
-
326
- #### `NEXT_PUBLIC_UMAMI_SCRIPT_URL`
327
-
328
- - 类型:可选
329
- - 描述:Umami 脚本的网址,默认为 Umami Cloud 提供的脚本网址
330
- - 默认值:`https://analytics.umami.is/script.js`
331
- - 示例:`https://umami.your-site.com/script.js`
332
-
333
- #### `NEXT_PUBLIC_UMAMI_WEBSITE_ID`
334
-
335
- - 类型:必选
336
- - 描述:你的 Umami 的 Website ID
337
- - 默认值:`-`
338
- - 示例:`E738D82A-EE9E-4806-A81F-0CA3CAE57F65`
339
-
340
- [auth0-client-page]: https://manage.auth0.com/dashboard
341
- [azure-api-verion-url]: https://docs.microsoft.com/zh-cn/azure/developer/javascript/api-reference/es-modules/azure-sdk/ai-translation/translationconfiguration?view=azure-node-latest#api-version
342
- [openai-api-page]: https://platform.openai.com/account/api-keys
343
- [posthog-analytics-url]: https://posthog.com
344
- [umami-analytics-url]: https://umami.is