@lobehub/chat 0.133.0 → 0.133.2
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/.eslintrc.js +16 -0
- package/CHANGELOG.md +1392 -2240
- package/README.md +7 -3
- package/README.zh-CN.md +7 -3
- package/contributing/Home.md +20 -28
- package/contributing/_Sidebar.md +1 -9
- package/docs/self-hosting/advanced/analytics.zh-CN.mdx +4 -2
- package/docs/self-hosting/advanced/authentication.mdx +32 -33
- package/docs/self-hosting/advanced/authentication.zh-CN.mdx +31 -34
- package/docs/self-hosting/advanced/upstream-sync.mdx +23 -26
- package/docs/self-hosting/advanced/upstream-sync.zh-CN.mdx +23 -26
- package/docs/self-hosting/environment-variables/basic.mdx +12 -14
- package/docs/self-hosting/environment-variables/basic.zh-CN.mdx +13 -15
- package/docs/self-hosting/environment-variables/model-provider.mdx +6 -2
- package/docs/self-hosting/environment-variables/model-provider.zh-CN.mdx +8 -5
- package/docs/self-hosting/environment-variables.mdx +11 -0
- package/docs/self-hosting/environment-variables.zh-CN.mdx +10 -0
- package/docs/self-hosting/examples/azure-openai.mdx +7 -7
- package/docs/self-hosting/examples/azure-openai.zh-CN.mdx +7 -7
- package/docs/self-hosting/faq/no-v1-suffix.mdx +0 -1
- package/docs/self-hosting/faq/proxy-with-unable-to-verify-leaf-signature.mdx +0 -1
- package/docs/self-hosting/platform/docker-compose.mdx +73 -79
- package/docs/self-hosting/platform/docker-compose.zh-CN.mdx +80 -86
- package/docs/self-hosting/platform/docker.mdx +96 -101
- package/docs/self-hosting/platform/docker.zh-CN.mdx +102 -107
- package/docs/self-hosting/platform/netlify.mdx +66 -145
- package/docs/self-hosting/platform/netlify.zh-CN.mdx +64 -143
- package/docs/self-hosting/platform/repocloud.mdx +7 -9
- package/docs/self-hosting/platform/repocloud.zh-CN.mdx +10 -12
- package/docs/self-hosting/platform/sealos.mdx +7 -9
- package/docs/self-hosting/platform/sealos.zh-CN.mdx +10 -12
- package/docs/self-hosting/platform/vercel.mdx +13 -15
- package/docs/self-hosting/platform/vercel.zh-CN.mdx +12 -15
- package/docs/self-hosting/platform/zeabur.mdx +7 -9
- package/docs/self-hosting/platform/zeabur.zh-CN.mdx +10 -12
- package/docs/self-hosting/start.mdx +17 -0
- package/docs/self-hosting/start.zh-CN.mdx +17 -0
- package/docs/usage/agents/concepts.mdx +0 -1
- package/docs/usage/agents/custom-agent.mdx +5 -7
- package/docs/usage/agents/custom-agent.zh-CN.mdx +3 -3
- package/docs/usage/agents/model.mdx +9 -4
- package/docs/usage/agents/model.zh-CN.mdx +5 -5
- package/docs/usage/agents/prompt.mdx +8 -9
- package/docs/usage/agents/prompt.zh-CN.mdx +7 -8
- package/docs/usage/agents/topics.mdx +1 -1
- package/docs/usage/features/agent-market.mdx +13 -11
- package/docs/usage/features/agent-market.zh-CN.mdx +7 -8
- package/docs/usage/features/local-llm.mdx +6 -5
- package/docs/usage/features/local-llm.zh-CN.mdx +8 -5
- package/docs/usage/features/mobile.mdx +5 -5
- package/docs/usage/features/mobile.zh-CN.mdx +1 -5
- package/docs/usage/features/multi-ai-providers.mdx +6 -6
- package/docs/usage/features/multi-ai-providers.zh-CN.mdx +3 -7
- package/docs/usage/features/plugin-system.mdx +20 -18
- package/docs/usage/features/plugin-system.zh-CN.mdx +20 -22
- package/docs/usage/features/pwa.mdx +9 -11
- package/docs/usage/features/pwa.zh-CN.mdx +5 -11
- package/docs/usage/features/text-to-image.mdx +5 -1
- package/docs/usage/features/text-to-image.zh-CN.mdx +1 -1
- package/docs/usage/features/theme.mdx +5 -5
- package/docs/usage/features/theme.zh-CN.mdx +1 -5
- package/docs/usage/features/tts.mdx +6 -1
- package/docs/usage/features/tts.zh-CN.mdx +1 -1
- package/docs/usage/features/vision.mdx +7 -3
- package/docs/usage/features/vision.zh-CN.mdx +1 -1
- package/docs/usage/plugins/basic-usage.mdx +2 -2
- package/docs/usage/plugins/custom-plugin.mdx +2 -2
- package/docs/usage/plugins/custom-plugin.zh-CN.mdx +2 -2
- package/docs/usage/plugins/{plugin-development.mdx → development.mdx} +7 -7
- package/docs/usage/plugins/{plugin-development.zh-CN.mdx → development.zh-CN.mdx} +7 -7
- package/docs/usage/plugins/{plugin-store.mdx → store.mdx} +0 -1
- package/docs/usage/plugins/store.zh-CN.mdx +9 -0
- package/docs/usage/providers/ollama/gemma.mdx +22 -33
- package/docs/usage/providers/ollama/gemma.zh-CN.mdx +20 -32
- package/docs/usage/providers/ollama.mdx +34 -43
- package/docs/usage/providers/ollama.zh-CN.mdx +18 -29
- package/docs/usage/start.mdx +34 -0
- package/docs/usage/start.zh-CN.mdx +28 -0
- package/next-sitemap.config.mjs +2 -3
- package/package.json +24 -19
- package/src/app/settings/llm/Anthropic/index.tsx +2 -2
- package/src/app/settings/llm/index.tsx +4 -4
- package/src/config/modelProviders/ollama.ts +4 -4
- package/src/libs/agent-runtime/anthropic/index.test.ts +6 -10
- package/docs/usage/plugins/plugin-store.zh-CN.mdx +0 -9
- package/public/robots.txt +0 -4
|
@@ -36,18 +36,18 @@ LobeChat 在部署时提供了一些额外的配置项,你可以使用环境
|
|
|
36
36
|
|
|
37
37
|
`DEFAULT_AGENT_CONFIG` 用于配置 LobeChat 默认助理的默认配置。它支持多种数据类型和结构,包括键值对、嵌套字段、数组值等。下表详细说明了 `DEFAULT_AGENT_CONFIG` 环境变量的配置项、示例以及相应解释:
|
|
38
38
|
|
|
39
|
-
| 配置项类型 | 示例
|
|
40
|
-
|
|
|
41
|
-
| 基本键值对 | `model=gpt-4`
|
|
42
|
-
| 嵌套字段
|
|
43
|
-
| 数组
|
|
44
|
-
| 中文逗号
|
|
45
|
-
| 多个配置项 | `model=glm-4;provider=zhipu`
|
|
46
|
-
| 数字值
|
|
47
|
-
| 布尔值
|
|
48
|
-
| 特殊字符
|
|
49
|
-
| 错误处理
|
|
50
|
-
| 值覆盖
|
|
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
51
|
|
|
52
52
|
相关阅读:
|
|
53
53
|
|
|
@@ -74,7 +74,7 @@ LobeChat 在部署时提供了一些额外的配置项,你可以使用环境
|
|
|
74
74
|
#### `NEXTAUTH_URL`
|
|
75
75
|
|
|
76
76
|
- 类型:可选
|
|
77
|
-
- 描述:该URL用于指定Auth.js在执行OAuth验证时的回调地址,在Vercel上部署时无需设置。
|
|
77
|
+
- 描述:该 URL 用于指定 Auth.js 在执行 OAuth 验证时的回调地址,在 Vercel 上部署时无需设置。
|
|
78
78
|
- 默认值:`-`
|
|
79
79
|
- 示例:`https://example.com/api/auth`
|
|
80
80
|
|
|
@@ -215,7 +215,5 @@ LobeChat 在部署时提供了一些额外的配置项,你可以使用环境
|
|
|
215
215
|
- 示例:`E738D82A-EE9E-4806-A81F-0CA3CAE57F65`
|
|
216
216
|
|
|
217
217
|
[auth0-client-page]: https://manage.auth0.com/dashboard
|
|
218
|
-
[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
|
|
219
|
-
[openai-api-page]: https://platform.openai.com/account/api-keys
|
|
220
218
|
[posthog-analytics-url]: https://posthog.com
|
|
221
219
|
[umami-analytics-url]: https://umami.is
|
|
@@ -23,14 +23,14 @@ When deploying LobeChat, a rich set of environment variables related to model se
|
|
|
23
23
|
<Callout type={'warning'}>
|
|
24
24
|
Please check the request suffix of your proxy service provider. Some proxy service providers may
|
|
25
25
|
add `/v1` to the request suffix, while others may not. If you find that the AI returns an empty
|
|
26
|
-
message during testing, try adding the `/v1` suffix and retry.
|
|
26
|
+
message during testing, try adding the `/v1` suffix and retry.
|
|
27
27
|
</Callout>
|
|
28
28
|
|
|
29
29
|
<Callout type={'info'}>
|
|
30
30
|
Whether to fill in `/v1` is closely related to the model service provider. For example, the
|
|
31
31
|
default address of openai is `api.openai.com/v1`. If your proxy forwards the `/v1` interface, you
|
|
32
32
|
can simply fill in `proxy.com`. However, if the model service provider directly forwards the
|
|
33
|
-
`api.openai.com` domain, then you need to add `/v1` to the URL yourself.
|
|
33
|
+
`api.openai.com` domain, then you need to add `/v1` to the URL yourself.
|
|
34
34
|
</Callout>
|
|
35
35
|
|
|
36
36
|
Related discussions:
|
|
@@ -171,3 +171,7 @@ When using the `turn` mode, the API Keys will be retrieved in a round-robin mann
|
|
|
171
171
|
- Description: This is the API key you applied for in the Mistral AI service
|
|
172
172
|
- Default: -
|
|
173
173
|
- Example: `xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=`
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
[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
|
|
177
|
+
[openai-api-page]: https://platform.openai.com/account/api-keys
|
|
@@ -9,7 +9,7 @@ LobeChat 在部署时提供了丰富的模型服务商相关的环境变量,
|
|
|
9
9
|
### `OPENAI_API_KEY`
|
|
10
10
|
|
|
11
11
|
- 类型:必选
|
|
12
|
-
- 描述:这是你在 OpenAI 账户页面申请的 API 密钥,可以前往[这里][openai-api-page]查看
|
|
12
|
+
- 描述:这是你在 OpenAI 账户页面申请的 API 密钥,可以前往 \[这里]\[openai-api-page] 查看
|
|
13
13
|
- 默认值:-
|
|
14
14
|
- 示例:`sk-xxxxxx...xxxxxx`
|
|
15
15
|
|
|
@@ -51,13 +51,13 @@ LobeChat 在部署时提供了丰富的模型服务商相关的环境变量,
|
|
|
51
51
|
### `API_KEY_SELECT_MODE`
|
|
52
52
|
|
|
53
53
|
- 类型:可选
|
|
54
|
-
- 描述:用于控制多个API Keys时,选择Key的模式,当前支持 `random` 和 `turn`
|
|
54
|
+
- 描述:用于控制多个 API Keys 时,选择 Key 的模式,当前支持 `random` 和 `turn`
|
|
55
55
|
- 默认值:`random`
|
|
56
56
|
- 示例:`random` 或 `turn`
|
|
57
57
|
|
|
58
|
-
使用 `random` 模式下,将在多个API Keys中随机获取一个API Key。
|
|
58
|
+
使用 `random` 模式下,将在多个 API Keys 中随机获取一个 API Key。
|
|
59
59
|
|
|
60
|
-
使用 `turn` 模式下,将按照填写的顺序,轮训获取得到API Key。
|
|
60
|
+
使用 `turn` 模式下,将按照填写的顺序,轮训获取得到 API Key。
|
|
61
61
|
|
|
62
62
|
## Azure OpenAI
|
|
63
63
|
|
|
@@ -82,7 +82,7 @@ LobeChat 在部署时提供了丰富的模型服务商相关的环境变量,
|
|
|
82
82
|
- 类型:可选
|
|
83
83
|
- 描述:Azure 的 API 版本,遵循 YYYY-MM-DD 格式
|
|
84
84
|
- 默认值:`2023-08-01-preview`
|
|
85
|
-
- 示例:`2023-05-15`,查阅[最新版本][azure-api-verion-url]
|
|
85
|
+
- 示例:`2023-05-15`,查阅 [最新版本][azure-api-verion-url]
|
|
86
86
|
|
|
87
87
|
## 智谱 AI
|
|
88
88
|
|
|
@@ -169,3 +169,6 @@ LobeChat 在部署时提供了丰富的模型服务商相关的环境变量,
|
|
|
169
169
|
- 描述:这是你在 Mistral AI 服务中申请的 API 密钥
|
|
170
170
|
- 默认值:-
|
|
171
171
|
- 示例:`xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=`
|
|
172
|
+
|
|
173
|
+
[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
|
|
174
|
+
[openai-api-page]: https://platform.openai.com/account/api-keys
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Cards } from 'nextra/components';
|
|
2
|
+
|
|
3
|
+
# Environment Variables
|
|
4
|
+
|
|
5
|
+
LobeChat provides some additional configuration options when deployed, which can be customized using environment variables.
|
|
6
|
+
|
|
7
|
+
<Cards>
|
|
8
|
+
<Cards.Card href={'environment-variables/basic'} title={'Basic Environment Variables'} />
|
|
9
|
+
|
|
10
|
+
<Cards.Card href={'environment-variables/model-provider'} title={'Model Service Providers'} />
|
|
11
|
+
</Cards>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Cards } from 'nextra/components';
|
|
2
|
+
|
|
3
|
+
# 环境变量
|
|
4
|
+
|
|
5
|
+
LobeChat 在部署时提供了一些额外的配置项,你可以使用环境变量进行自定义设置。
|
|
6
|
+
|
|
7
|
+
<Cards>
|
|
8
|
+
<Cards.Card href={'environment-variables/basic'} title={'基础环境变量'} />
|
|
9
|
+
<Cards.Card href={'environment-variables/model-provider'} title={'模型服务商'} />
|
|
10
|
+
</Cards>
|
|
@@ -30,13 +30,13 @@ After completing the configuration of the above fields, click "Check". If it pro
|
|
|
30
30
|
|
|
31
31
|
If you want the deployed version to be pre-configured with Azure OpenAI for end users to use directly, you need to configure the following environment variables during deployment:
|
|
32
32
|
|
|
33
|
-
| Environment Variable | Type
|
|
34
|
-
|
|
|
35
|
-
| `USE_AZURE_OPENAI`
|
|
36
|
-
| `AZURE_API_KEY`
|
|
37
|
-
| `OPENAI_PROXY_URL`
|
|
38
|
-
| `AZURE_API_VERSION`
|
|
39
|
-
| `ACCESS_CODE`
|
|
33
|
+
| Environment Variable | Type | Description | Default Value | Example |
|
|
34
|
+
| -------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ | -------------------------------------------------------- |
|
|
35
|
+
| `USE_AZURE_OPENAI` | Required | Set this value to `1` to enable Azure OpenAI configuration | - | `1` |
|
|
36
|
+
| `AZURE_API_KEY` | Required | This is the API key you obtained from the Azure OpenAI account page | - | `c55168be3874490ef0565d9779ecd5a6` |
|
|
37
|
+
| `OPENAI_PROXY_URL` | Required | Azure API address, can be found in the "Keys and Endpoints" section when checking resources in the Azure portal | - | `https://docs-test-001.openai.azure.com` |
|
|
38
|
+
| `AZURE_API_VERSION` | Optional | Azure API version, following the format YYYY-MM-DD | 2023-08-01-preview | `2023-05-15`, see [latest version][azure-api-verion-url] |
|
|
39
|
+
| `ACCESS_CODE` | Optional | Add a password to access this service. You can set a long password to prevent brute force attacks. When this value is separated by commas, it becomes an array of passwords | - | `awCT74` or `e3@09!` or `code1,code2,code3` |
|
|
40
40
|
|
|
41
41
|
<Callout>
|
|
42
42
|
When you enable `USE_AZURE_OPENAI` on the server, users will be unable to modify and use the
|
|
@@ -32,13 +32,13 @@ LobeChat 支持使用 [Azure OpenAI][azure-openai-url] 作为 OpenAI 的模型
|
|
|
32
32
|
|
|
33
33
|
如果你希望部署的版本直接配置好 Azure OpenAI,让终端用户直接使用,那么你需要在部署时配置以下环境变量:
|
|
34
34
|
|
|
35
|
-
| 环境变量
|
|
36
|
-
|
|
|
37
|
-
| `USE_AZURE_OPENAI`
|
|
38
|
-
| `AZURE_API_KEY`
|
|
39
|
-
| `OPENAI_PROXY_URL`
|
|
40
|
-
| `AZURE_API_VERSION` | 可选 | Azure 的 API 版本,遵循 YYYY-MM-DD 格式
|
|
41
|
-
| `ACCESS_CODE`
|
|
35
|
+
| 环境变量 | 类型 | 描述 | 默认值 | 示例 |
|
|
36
|
+
| ------------------- | -- | ------------------------------------------------ | ------------------ | ------------------------------------------- |
|
|
37
|
+
| `USE_AZURE_OPENAI` | 必选 | 设置改值为 `1` 开启 Azure OpenAI 配置 | - | `1` |
|
|
38
|
+
| `AZURE_API_KEY` | 必选 | 这是你在 Azure OpenAI 账户页面申请的 API 密钥 | - | `c55168be3874490ef0565d9779ecd5a6` |
|
|
39
|
+
| `OPENAI_PROXY_URL` | 必选 | Azure API 地址,从 Azure 门户检查资源时,可在 “密钥和终结点” 部分中找到此值 | - | `https://docs-test-001.openai.azure.com` |
|
|
40
|
+
| `AZURE_API_VERSION` | 可选 | Azure 的 API 版本,遵循 YYYY-MM-DD 格式 | 2023-08-01-preview | `2023-05-15`,查阅[最新版本][azure-api-verion-url] |
|
|
41
|
+
| `ACCESS_CODE` | 可选 | 添加访问此服务的密码,你可以设置一个长密码以防被爆破,该值用逗号分隔时为密码数组 | - | `awCT74` 或 `e3@09!` or `code1,code2,code3` |
|
|
42
42
|
|
|
43
43
|
<Callout>
|
|
44
44
|
当你在服务端开启 `USE_AZURE_OPENAI` 后,用户将无法在前端配置中修改并使用 OpenAI API key。
|
|
@@ -15,4 +15,3 @@ Recheck and confirm whether `OPENAI_PROXY_URL` is set correctly, including wheth
|
|
|
15
15
|
- [No response when the proxy server address is filled in for chat](https://github.com/lobehub/lobe-chat/discussions/1065)
|
|
16
16
|
|
|
17
17
|
If the problem still cannot be resolved, it is recommended to raise the issue in the community, providing relevant logs and configuration information for other developers or maintainers to offer assistance.
|
|
18
|
-
|
|
@@ -67,4 +67,3 @@ If possible, it is recommended to address the certificate issue using the follow
|
|
|
67
67
|
3. Properly configure the certificate chain in the code to ensure Node.js can validate to the root certificate.
|
|
68
68
|
|
|
69
69
|
Implementing these methods can resolve certificate validation issues without compromising security.
|
|
70
|
-
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Steps, Tabs } from 'nextra/components';
|
|
2
2
|
|
|
3
3
|
# Docker Compose Deployment Guide
|
|
4
4
|
|
|
@@ -7,110 +7,104 @@ import { Callout, Steps, Tabs } from 'nextra/components';
|
|
|
7
7
|
We provide a [Docker image][docker-release-link] for deploying the LobeChat service on your private device.
|
|
8
8
|
|
|
9
9
|
<Steps>
|
|
10
|
+
### Install Docker Container Environment
|
|
10
11
|
|
|
11
|
-
|
|
12
|
+
(Skip this step if already installed)
|
|
12
13
|
|
|
13
|
-
|
|
14
|
+
<Tabs items={['Ubuntu', 'CentOS']}>
|
|
15
|
+
<Tabs.Tab>
|
|
16
|
+
```fish
|
|
17
|
+
$ apt install docker.io
|
|
18
|
+
```
|
|
19
|
+
</Tabs.Tab>
|
|
14
20
|
|
|
15
|
-
<Tabs
|
|
16
|
-
|
|
21
|
+
<Tabs.Tab>
|
|
22
|
+
```fish
|
|
23
|
+
$ yum install docker
|
|
24
|
+
```
|
|
25
|
+
</Tabs.Tab>
|
|
26
|
+
</Tabs>
|
|
17
27
|
|
|
18
|
-
|
|
19
|
-
$ apt install docker.io
|
|
20
|
-
```
|
|
28
|
+
### Run Docker Compose Deployment Command
|
|
21
29
|
|
|
22
|
-
|
|
23
|
-
<Tabs.Tab>
|
|
30
|
+
When using `docker-compose`, the configuration file is as follows:
|
|
24
31
|
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
```
|
|
32
|
+
```yml
|
|
33
|
+
version: '3.8'
|
|
28
34
|
|
|
29
|
-
|
|
35
|
+
services:
|
|
36
|
+
lobe-chat:
|
|
37
|
+
image: lobehub/lobe-chat
|
|
38
|
+
container_name: lobe-chat
|
|
39
|
+
restart: always
|
|
40
|
+
ports:
|
|
41
|
+
- '3210:3210'
|
|
42
|
+
environment:
|
|
43
|
+
OPENAI_API_KEY: sk-xxxx
|
|
44
|
+
OPENAI_PROXY_URL: https://api-proxy.com/v1
|
|
45
|
+
ACCESS_CODE: lobe66
|
|
46
|
+
```
|
|
30
47
|
|
|
31
|
-
|
|
48
|
+
Run the following command to start the Lobe Chat service:
|
|
32
49
|
|
|
33
|
-
|
|
50
|
+
```bash
|
|
51
|
+
$ docker-compose up -d
|
|
52
|
+
```
|
|
34
53
|
|
|
35
|
-
|
|
54
|
+
### Crontab Automatic Update Script (Optional)
|
|
36
55
|
|
|
37
|
-
|
|
38
|
-
version: '3.8'
|
|
56
|
+
Similarly, you can use the following script to automatically update Lobe Chat. When using `Docker Compose`, no additional configuration of environment variables is required.
|
|
39
57
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
container_name: lobe-chat
|
|
44
|
-
restart: always
|
|
45
|
-
ports:
|
|
46
|
-
- '3210:3210'
|
|
47
|
-
environment:
|
|
48
|
-
OPENAI_API_KEY: sk-xxxx
|
|
49
|
-
OPENAI_PROXY_URL: https://api-proxy.com/v1
|
|
50
|
-
ACCESS_CODE: lobe66
|
|
51
|
-
```
|
|
58
|
+
```bash
|
|
59
|
+
#!/bin/bash
|
|
60
|
+
# auto-update-lobe-chat.sh
|
|
52
61
|
|
|
53
|
-
|
|
62
|
+
# Set proxy (optional)
|
|
63
|
+
export https_proxy=http://127.0.0.1:7890 http_proxy=http://127.0.0.1:7890 all_proxy=socks5://127.0.0.1:7890
|
|
54
64
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
```
|
|
65
|
+
# Pull the latest image and store the output in a variable
|
|
66
|
+
output=$(docker pull lobehub/lobe-chat:latest 2>&1)
|
|
58
67
|
|
|
59
|
-
|
|
68
|
+
# Check if the pull command was executed successfully
|
|
69
|
+
if [ $? -ne 0 ]; then
|
|
70
|
+
exit 1
|
|
71
|
+
fi
|
|
60
72
|
|
|
61
|
-
|
|
73
|
+
# Check if the output contains a specific string
|
|
74
|
+
echo "$output" | grep -q "Image is up to date for lobehub/lobe-chat:latest"
|
|
62
75
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
76
|
+
# If the image is already up to date, do nothing
|
|
77
|
+
if [ $? -eq 0 ]; then
|
|
78
|
+
exit 0
|
|
79
|
+
fi
|
|
66
80
|
|
|
67
|
-
|
|
68
|
-
export https_proxy=http://127.0.0.1:7890 http_proxy=http://127.0.0.1:7890 all_proxy=socks5://127.0.0.1:7890
|
|
81
|
+
echo "Detected Lobe-Chat update"
|
|
69
82
|
|
|
70
|
-
#
|
|
71
|
-
|
|
83
|
+
# Remove the old container
|
|
84
|
+
echo "Removed: $(docker rm -f Lobe-Chat)"
|
|
72
85
|
|
|
73
|
-
#
|
|
74
|
-
|
|
75
|
-
exit 1
|
|
76
|
-
fi
|
|
86
|
+
# You may need to navigate to the directory where `docker-compose.yml` is located first
|
|
87
|
+
# cd /path/to/docker-compose-folder
|
|
77
88
|
|
|
78
|
-
#
|
|
79
|
-
echo "$
|
|
89
|
+
# Run the new container
|
|
90
|
+
echo "Started: $(docker-compose up)"
|
|
80
91
|
|
|
81
|
-
#
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
fi
|
|
92
|
+
# Print the update time and version
|
|
93
|
+
echo "Update time: $(date)"
|
|
94
|
+
echo "Version: $(docker inspect lobehub/lobe-chat:latest | grep 'org.opencontainers.image.version' | awk -F'"' '{print $4}')"
|
|
85
95
|
|
|
86
|
-
|
|
96
|
+
# Clean up unused images
|
|
97
|
+
docker images | grep 'lobehub/lobe-chat' | grep -v 'latest' | awk '{print $3}' | xargs -r docker rmi > /dev/null 2>&1
|
|
98
|
+
echo "Removed old images."
|
|
99
|
+
```
|
|
87
100
|
|
|
88
|
-
|
|
89
|
-
echo "Removed: $(docker rm -f Lobe-Chat)"
|
|
101
|
+
This script can also be used in Crontab, but ensure that your Crontab can find the correct Docker command. It is recommended to use absolute paths.
|
|
90
102
|
|
|
91
|
-
|
|
92
|
-
# cd /path/to/docker-compose-folder
|
|
93
|
-
|
|
94
|
-
# Run the new container
|
|
95
|
-
echo "Started: $(docker-compose up)"
|
|
96
|
-
|
|
97
|
-
# Print the update time and version
|
|
98
|
-
echo "Update time: $(date)"
|
|
99
|
-
echo "Version: $(docker inspect lobehub/lobe-chat:latest | grep 'org.opencontainers.image.version' | awk -F'"' '{print $4}')"
|
|
100
|
-
|
|
101
|
-
# Clean up unused images
|
|
102
|
-
docker images | grep 'lobehub/lobe-chat' | grep -v 'latest' | awk '{print $3}' | xargs -r docker rmi > /dev/null 2>&1
|
|
103
|
-
echo "Removed old images."
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
This script can also be used in Crontab, but ensure that your Crontab can find the correct Docker command. It is recommended to use absolute paths.
|
|
107
|
-
|
|
108
|
-
Configure Crontab to execute the script every 5 minutes:
|
|
109
|
-
|
|
110
|
-
```bash
|
|
111
|
-
*/5 * * * * /path/to/auto-update-lobe-chat.sh >> /path/to/auto-update-lobe-chat.log 2>&1
|
|
112
|
-
```
|
|
103
|
+
Configure Crontab to execute the script every 5 minutes:
|
|
113
104
|
|
|
105
|
+
```bash
|
|
106
|
+
*/5 * * * * /path/to/auto-update-lobe-chat.sh >> /path/to/auto-update-lobe-chat.log 2>&1
|
|
107
|
+
```
|
|
114
108
|
</Steps>
|
|
115
109
|
|
|
116
110
|
[docker-pulls-link]: https://hub.docker.com/r/lobehub/lobe-chat
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Steps, Tabs } from 'nextra/components';
|
|
2
2
|
|
|
3
3
|
# Docker Compose 部署指引
|
|
4
4
|
|
|
@@ -6,116 +6,110 @@ import { Callout, Steps, Tabs } from 'nextra/components';
|
|
|
6
6
|
|
|
7
7
|
我们提供了 [Docker 镜像][docker-release-link],供你在自己的私有设备上部署 LobeChat 服务。
|
|
8
8
|
|
|
9
|
-
[docker-pulls-link]: https://hub.docker.com/r/lobehub/lobe-chat
|
|
10
|
-
[docker-pulls-shield]: https://img.shields.io/docker/pulls/lobehub/lobe-chat?color=45cc11&labelColor=black&style=flat-square
|
|
11
|
-
[docker-release-link]: https://hub.docker.com/r/lobehub/lobe-chat
|
|
12
|
-
[docker-release-shield]: https://img.shields.io/docker/v/lobehub/lobe-chat?color=369eff&label=docker&labelColor=black&logo=docker&logoColor=white&style=flat-square
|
|
13
|
-
[docker-size-link]: https://hub.docker.com/r/lobehub/lobe-chat
|
|
14
|
-
[docker-size-shield]: https://img.shields.io/docker/image-size/lobehub/lobe-chat?color=369eff&labelColor=black&style=flat-square
|
|
15
|
-
|
|
16
9
|
<Steps>
|
|
10
|
+
### 安装 Docker 容器环境
|
|
17
11
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
(如果已安装,请跳过此步)
|
|
21
|
-
|
|
22
|
-
<Tabs items={['Ubuntu', 'CentOS']}>
|
|
23
|
-
<Tabs.Tab>
|
|
24
|
-
|
|
25
|
-
```fish
|
|
26
|
-
$ apt install docker.io
|
|
27
|
-
```
|
|
12
|
+
(如果已安装,请跳过此步)
|
|
28
13
|
|
|
29
|
-
|
|
30
|
-
|
|
14
|
+
<Tabs items={['Ubuntu', 'CentOS']}>
|
|
15
|
+
<Tabs.Tab>
|
|
16
|
+
```fish
|
|
17
|
+
$ apt install docker.io
|
|
18
|
+
```
|
|
19
|
+
</Tabs.Tab>
|
|
31
20
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
21
|
+
<Tabs.Tab>
|
|
22
|
+
```fish
|
|
23
|
+
$ yum install docker
|
|
24
|
+
```
|
|
25
|
+
</Tabs.Tab>
|
|
26
|
+
</Tabs>
|
|
35
27
|
|
|
36
|
-
|
|
28
|
+
### 运行 Docker Compose 部署指令
|
|
37
29
|
|
|
38
|
-
|
|
30
|
+
使用 `docker-compose` 时配置文件如下:
|
|
39
31
|
|
|
40
|
-
|
|
32
|
+
```yml
|
|
33
|
+
version: '3.8'
|
|
41
34
|
|
|
42
|
-
|
|
35
|
+
services:
|
|
36
|
+
lobe-chat:
|
|
37
|
+
image: lobehub/lobe-chat
|
|
38
|
+
container_name: lobe-chat
|
|
39
|
+
restart: always
|
|
40
|
+
ports:
|
|
41
|
+
- '3210:3210'
|
|
42
|
+
environment:
|
|
43
|
+
OPENAI_API_KEY: sk-xxxx
|
|
44
|
+
OPENAI_PROXY_URL: https://api-proxy.com/v1
|
|
45
|
+
ACCESS_CODE: lobe66
|
|
46
|
+
```
|
|
43
47
|
|
|
44
|
-
|
|
45
|
-
version: '3.8'
|
|
48
|
+
运行以下命令启动 Lobe Chat 服务:
|
|
46
49
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
container_name: lobe-chat
|
|
51
|
-
restart: always
|
|
52
|
-
ports:
|
|
53
|
-
- '3210:3210'
|
|
54
|
-
environment:
|
|
55
|
-
OPENAI_API_KEY: sk-xxxx
|
|
56
|
-
OPENAI_PROXY_URL: https://api-proxy.com/v1
|
|
57
|
-
ACCESS_CODE: lobe66
|
|
58
|
-
```
|
|
50
|
+
```bash
|
|
51
|
+
$ docker-compose up -d
|
|
52
|
+
```
|
|
59
53
|
|
|
60
|
-
|
|
54
|
+
### Crontab 自动更新脚本(可选)
|
|
61
55
|
|
|
62
|
-
|
|
63
|
-
$ docker-compose up -d
|
|
64
|
-
```
|
|
56
|
+
类似地,你可以使用以下脚本来自动更新 Lobe Chat,使用 `Docker Compose` 时,环境变量无需额外配置。
|
|
65
57
|
|
|
66
|
-
|
|
58
|
+
```bash
|
|
59
|
+
#!/bin/bash
|
|
60
|
+
# auto-update-lobe-chat.sh
|
|
67
61
|
|
|
68
|
-
|
|
62
|
+
# 设置代理(可选)
|
|
63
|
+
export https_proxy=http://127.0.0.1:7890 http_proxy=http://127.0.0.1:7890 all_proxy=socks5://127.0.0.1:7890
|
|
69
64
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
# auto-update-lobe-chat.sh
|
|
65
|
+
# 拉取最新的镜像并将输出存储在变量中
|
|
66
|
+
output=$(docker pull lobehub/lobe-chat:latest 2>&1)
|
|
73
67
|
|
|
74
|
-
#
|
|
75
|
-
|
|
68
|
+
# 检查拉取命令是否成功执行
|
|
69
|
+
if [ $? -ne 0 ]; then
|
|
70
|
+
exit 1
|
|
71
|
+
fi
|
|
76
72
|
|
|
77
|
-
#
|
|
78
|
-
output
|
|
73
|
+
# 检查输出中是否包含特定的字符串
|
|
74
|
+
echo "$output" | grep -q "Image is up to date for lobehub/lobe-chat:latest"
|
|
79
75
|
|
|
80
|
-
#
|
|
81
|
-
if [ $? -
|
|
82
|
-
|
|
83
|
-
fi
|
|
76
|
+
# 如果镜像已经是最新的,则不执行任何操作
|
|
77
|
+
if [ $? -eq 0 ]; then
|
|
78
|
+
exit 0
|
|
79
|
+
fi
|
|
84
80
|
|
|
85
|
-
|
|
86
|
-
echo "$output" | grep -q "Image is up to date for lobehub/lobe-chat:latest"
|
|
81
|
+
echo "Detected Lobe-Chat update"
|
|
87
82
|
|
|
88
|
-
#
|
|
89
|
-
|
|
90
|
-
exit 0
|
|
91
|
-
fi
|
|
83
|
+
# 删除旧的容器
|
|
84
|
+
echo "Removed: $(docker rm -f Lobe-Chat)"
|
|
92
85
|
|
|
93
|
-
|
|
86
|
+
# 也许需要先进入 `docker-compose.yml` 所在的目录
|
|
87
|
+
# cd /path/to/docker-compose-folder
|
|
94
88
|
|
|
95
|
-
#
|
|
96
|
-
echo "
|
|
89
|
+
# 运行新的容器
|
|
90
|
+
echo "Started: $(docker-compose up)"
|
|
97
91
|
|
|
98
|
-
#
|
|
99
|
-
|
|
92
|
+
# 打印更新的时间和版本
|
|
93
|
+
echo "Update time: $(date)"
|
|
94
|
+
echo "Version: $(docker inspect lobehub/lobe-chat:latest | grep 'org.opencontainers.image.version' | awk -F'"' '{print $4}')"
|
|
100
95
|
|
|
101
|
-
#
|
|
102
|
-
|
|
96
|
+
# 清理不再使用的镜像
|
|
97
|
+
docker images | grep 'lobehub/lobe-chat' | grep -v 'latest' | awk '{print $3}' | xargs -r docker rmi > /dev/null 2>&1
|
|
98
|
+
echo "Removed old images."
|
|
99
|
+
```
|
|
103
100
|
|
|
104
|
-
|
|
105
|
-
echo "Update time: $(date)"
|
|
106
|
-
echo "Version: $(docker inspect lobehub/lobe-chat:latest | grep 'org.opencontainers.image.version' | awk -F'"' '{print $4}')"
|
|
101
|
+
此脚本亦可以在 Crontab 中使用,但请确认你的 Crontab 可以找到正确的 Docker 命令。建议使用绝对路径。
|
|
107
102
|
|
|
108
|
-
|
|
109
|
-
docker images | grep 'lobehub/lobe-chat' | grep -v 'latest' | awk '{print $3}' | xargs -r docker rmi > /dev/null 2>&1
|
|
110
|
-
echo "Removed old images."
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
此脚本亦可以在 Crontab 中使用,但请确认你的 Crontab 可以找到正确的 Docker 命令。建议使用绝对路径。
|
|
114
|
-
|
|
115
|
-
配置 Crontab,每 5 分钟执行一次脚本:
|
|
116
|
-
|
|
117
|
-
```bash
|
|
118
|
-
*/5 * * * * /path/to/auto-update-lobe-chat.sh >> /path/to/auto-update-lobe-chat.log 2>&1
|
|
119
|
-
```
|
|
103
|
+
配置 Crontab,每 5 分钟执行一次脚本:
|
|
120
104
|
|
|
105
|
+
```bash
|
|
106
|
+
*/5 * * * * /path/to/auto-update-lobe-chat.sh >> /path/to/auto-update-lobe-chat.log 2>&1
|
|
107
|
+
```
|
|
121
108
|
</Steps>
|
|
109
|
+
|
|
110
|
+
[docker-pulls-link]: https://hub.docker.com/r/lobehub/lobe-chat
|
|
111
|
+
[docker-pulls-shield]: https://img.shields.io/docker/pulls/lobehub/lobe-chat?color=45cc11&labelColor=black&style=flat-square
|
|
112
|
+
[docker-release-link]: https://hub.docker.com/r/lobehub/lobe-chat
|
|
113
|
+
[docker-release-shield]: https://img.shields.io/docker/v/lobehub/lobe-chat?color=369eff&label=docker&labelColor=black&logo=docker&logoColor=white&style=flat-square
|
|
114
|
+
[docker-size-link]: https://hub.docker.com/r/lobehub/lobe-chat
|
|
115
|
+
[docker-size-shield]: https://img.shields.io/docker/image-size/lobehub/lobe-chat?color=369eff&labelColor=black&style=flat-square
|