@lobehub/chat 0.128.2 → 0.128.3
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/.github/workflows/issue-close-require.yml +3 -3
- package/.github/workflows/issues-translate.yml +3 -3
- package/.github/workflows/wiki-sync.yml +2 -2
- package/.i18nrc.js +2 -2
- package/CHANGELOG.md +25 -0
- package/README.md +3 -3
- package/README.zh-CN.md +3 -3
- package/contributing/Basic/Feature-Development.md +713 -0
- package/{docs/Development → contributing/Basic}/Feature-Development.zh-CN.md +2 -2
- package/{docs/Development → contributing/Basic}/Intro.zh-CN.md +5 -5
- package/{docs → contributing}/Home.md +20 -29
- package/{docs/Development → contributing/Internationalization}/Internationalization-Implementation.zh-CN.md +1 -1
- package/{docs → contributing}/_Sidebar.md +18 -29
- package/docs/agents/concepts.mdx +18 -0
- package/docs/agents/concepts.zh-CN.mdx +17 -0
- package/docs/agents/custom-agent.mdx +34 -0
- package/docs/agents/custom-agent.zh-CN.mdx +31 -0
- package/docs/agents/model.mdx +68 -0
- package/docs/agents/model.zh-CN.mdx +64 -0
- package/docs/agents/prompt.mdx +96 -0
- package/docs/agents/prompt.zh-CN.mdx +97 -0
- package/docs/agents/topics.mdx +7 -0
- package/docs/agents/topics.zh-CN.mdx +6 -0
- package/docs/common-errors/no-v1-suffix.mdx +18 -0
- package/docs/common-errors/no-v1-suffix.zh-CN.mdx +17 -0
- package/docs/common-errors/proxy-with-unable-to-verify-leaf-signature.mdx +70 -0
- package/docs/{Deployment/Common-Error.zh-CN.md → common-errors/proxy-with-unable-to-verify-leaf-signature.zh-CN.mdx} +8 -26
- package/docs/environment-variables/common.mdx +215 -0
- package/docs/environment-variables/common.zh-CN.mdx +214 -0
- package/docs/environment-variables/model-provider.mdx +135 -0
- package/docs/environment-variables/model-provider.zh-CN.mdx +133 -0
- package/docs/package.json +5 -0
- package/docs/plugins/basic-usage.mdx +40 -0
- package/docs/{Usage/Plugins.zh-CN.md → plugins/basic-usage.zh-CN.mdx} +7 -21
- package/docs/plugins/custom-plugin.mdx +27 -0
- package/docs/plugins/custom-plugin.zh-CN.mdx +26 -0
- package/docs/plugins/plugin-development.mdx +262 -0
- package/docs/{Plugins/Plugin-Development.zh-CN.md → plugins/plugin-development.zh-CN.mdx} +9 -33
- package/docs/plugins/plugin-store.mdx +10 -0
- package/docs/plugins/plugin-store.zh-CN.mdx +9 -0
- package/docs/self-hosting/analytics.mdx +20 -0
- package/docs/{Deployment/Analytics.zh-CN.md → self-hosting/analytics.zh-CN.mdx} +5 -8
- package/docs/self-hosting/authentication.mdx +94 -0
- package/docs/self-hosting/authentication.zh-CN.mdx +90 -0
- package/docs/self-hosting/deploy-with-azure-openai.mdx +48 -0
- package/docs/{Deployment/Deploy-with-Azure-OpenAI.zh-CN.md → self-hosting/deploy-with-azure-openai.zh-CN.mdx} +16 -21
- package/docs/self-hosting/docker-compose.mdx +121 -0
- package/docs/self-hosting/docker-compose.zh-CN.mdx +121 -0
- package/docs/self-hosting/docker.mdx +152 -0
- package/docs/self-hosting/docker.zh-CN.mdx +149 -0
- package/docs/self-hosting/environment-variable.mdx +340 -0
- package/docs/{Deployment/Environment-Variable.zh-CN.md → self-hosting/environment-variable.zh-CN.mdx} +43 -57
- package/docs/self-hosting/upstream-sync.mdx +66 -0
- package/docs/{Deployment/Upstream-Sync.zh-CN.md → self-hosting/upstream-sync.zh-CN.mdx} +23 -21
- package/docs/self-hosting/vercel.mdx +39 -0
- package/docs/self-hosting/vercel.zh-CN.mdx +39 -0
- package/docs/usage/agent-market.mdx +35 -0
- package/docs/usage/agent-market.zh-CN.mdx +32 -0
- package/docs/usage/mobile.mdx +8 -0
- package/docs/usage/mobile.zh-CN.mdx +7 -0
- package/docs/usage/more.mdx +21 -0
- package/docs/usage/more.zh-CN.mdx +19 -0
- package/docs/usage/plugin-system.mdx +84 -0
- package/docs/usage/plugin-system.zh-CN.mdx +77 -0
- package/docs/usage/pwa.mdx +21 -0
- package/docs/usage/pwa.zh-CN.mdx +21 -0
- package/docs/usage/text-to-image.mdx +5 -0
- package/docs/usage/text-to-image.zh-CN.mdx +6 -0
- package/docs/usage/theme.mdx +17 -0
- package/docs/usage/theme.zh-CN.mdx +15 -0
- package/docs/usage/tts.mdx +26 -0
- package/docs/usage/tts.zh-CN.mdx +24 -0
- package/docs/usage/vision.mdx +8 -0
- package/docs/usage/vision.zh-CN.mdx +7 -0
- package/next.config.mjs +5 -0
- package/package.json +4 -3
- package/scripts/docsWorkflow/const.ts +1 -1
- package/scripts/docsWorkflow/toc.ts +6 -6
- package/src/app/welcome/(desktop)/features/Footer.tsx +5 -3
- package/src/config/client.ts +6 -0
- package/src/const/url.ts +10 -1
- package/src/features/SideBar/BottomActions.tsx +11 -10
- package/src/locales/default/common.ts +1 -0
- package/docs/Deployment/Analytics.md +0 -20
- package/docs/Deployment/Authentication.md +0 -80
- package/docs/Deployment/Authentication.zh-CN.md +0 -80
- package/docs/Deployment/Common-Error.md +0 -87
- package/docs/Deployment/Deploy-with-Azure-OpenAI.md +0 -54
- package/docs/Deployment/Docker-Deployment.md +0 -219
- package/docs/Deployment/Docker-Deployment.zh-CN.md +0 -217
- package/docs/Deployment/Environment-Variable.md +0 -362
- package/docs/Deployment/Upstream-Sync.md +0 -62
- package/docs/Plugins/Plugin-Development.md +0 -287
- package/docs/Usage/Plugins.md +0 -53
- package/docs/Usage/Usage-Agents.md +0 -201
- package/docs/Usage/Usage-Agents.zh-CN.md +0 -202
- package/docs/Usage/Usage-Topics.md +0 -31
- package/docs/Usage/Usage-Topics.zh-CN.md +0 -31
- /package/{docs/Development → contributing/Basic}/Add-New-Authentication-Providers.md +0 -0
- /package/{docs/Development → contributing/Basic}/Add-New-Authentication-Providers.zh-CN.md +0 -0
- /package/{docs/Development → contributing/Basic}/Architecture.md +0 -0
- /package/{docs/Development → contributing/Basic}/Architecture.zh-CN.md +0 -0
- /package/{docs/Development → contributing/Basic}/Chat-API.md +0 -0
- /package/{docs/Development → contributing/Basic}/Chat-API.zh-CN.md +0 -0
- /package/{docs/Development → contributing/Basic}/Contributing-Guidelines.md +0 -0
- /package/{docs/Development → contributing/Basic}/Contributing-Guidelines.zh-CN.md +0 -0
- /package/{docs/Development → contributing/Basic}/Feature-Development-Frontend.md +0 -0
- /package/{docs/Development → contributing/Basic}/Feature-Development-Frontend.zh-CN.md +0 -0
- /package/{docs/Development → contributing/Basic}/Folder-Structure.md +0 -0
- /package/{docs/Development → contributing/Basic}/Folder-Structure.zh-CN.md +0 -0
- /package/{docs/Development → contributing/Basic}/Intro.md +0 -0
- /package/{docs/Development → contributing/Basic}/Resources.md +0 -0
- /package/{docs/Development → contributing/Basic}/Resources.zh-CN.md +0 -0
- /package/{docs/Development → contributing/Basic}/Setup-Development.md +0 -0
- /package/{docs/Development → contributing/Basic}/Setup-Development.zh-CN.md +0 -0
- /package/{docs/Development → contributing/Basic}/Test.md +0 -0
- /package/{docs/Development → contributing/Basic}/Test.zh-CN.md +0 -0
- /package/{docs/Development → contributing/Internationalization}/Add-New-Locale.md +0 -0
- /package/{docs/Development → contributing/Internationalization}/Add-New-Locale.zh-CN.md +0 -0
- /package/{docs/Development → contributing/Internationalization}/Internationalization-Implementation.md +0 -0
- /package/{docs → contributing}/Others/Lighthouse.md +0 -0
- /package/{docs → contributing}/Others/Lighthouse.zh-CN.md +0 -0
- /package/{docs/Development → contributing/State-Management}/State-Management-Intro.md +0 -0
- /package/{docs/Development → contributing/State-Management}/State-Management-Intro.zh-CN.md +0 -0
- /package/{docs/Development → contributing/State-Management}/State-Management-Selectors.md +0 -0
- /package/{docs/Development → contributing/State-Management}/State-Management-Selectors.zh-CN.md +0 -0
- /package/{docs → contributing}/_Footer.md +0 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Callout } from 'nextra/components';
|
|
2
|
+
|
|
3
|
+
# Integrating with Azure OpenAI
|
|
4
|
+
|
|
5
|
+
LobeChat supports using [Azure OpenAI][azure-openai-url] as the model service provider for OpenAI. This article will explain how to configure Azure OpenAI.
|
|
6
|
+
|
|
7
|
+
## Usage Limitations
|
|
8
|
+
|
|
9
|
+
Due to development costs ([#178][rfc]), the current version of LobeChat does not fully comply with the implementation model of Azure OpenAI. Instead, it adopts a solution based on `openai` to be compatible with Azure OpenAI. As a result, the following limitations exist:
|
|
10
|
+
|
|
11
|
+
- Only one of OpenAI and Azure OpenAI can be selected. Once you enable Azure OpenAI, you will not be able to use OpenAI as the model service provider.
|
|
12
|
+
- LobeChat requires the deployment name to be the same as the model name in order to function properly. For example, the deployment name for the `gpt-35-turbo` model must be `gpt-35-turbo`. Otherwise, LobeChat will not be able to match the corresponding model correctly. 
|
|
13
|
+
- Due to the complexity of integrating with Azure OpenAI's SDK, it is currently not possible to query the list of configured models.
|
|
14
|
+
|
|
15
|
+
## Configuring in the Interface
|
|
16
|
+
|
|
17
|
+
Click in the bottom left corner "Actions" - "Settings", then switch to the "Language Model" tab and enable the "Azure OpenAI" switch to start using Azure OpenAI.
|
|
18
|
+
|
|
19
|
+

|
|
20
|
+
|
|
21
|
+
You can fill in the corresponding configuration items as needed:
|
|
22
|
+
|
|
23
|
+
- **API Key**: The API key you applied for on the Azure OpenAI account page, which can be found in the "Keys and Endpoints" section.
|
|
24
|
+
- **API Address**: Azure API address, which can be found in the "Keys and Endpoints" section when checking resources in the Azure portal.
|
|
25
|
+
- **Azure API Version**: The API version of Azure, following the format YYYY-MM-DD. Refer to the [latest version][azure-api-verion-url].
|
|
26
|
+
|
|
27
|
+
After completing the configuration of the above fields, click "Check". If it prompts "Check passed", it means the configuration was successful.
|
|
28
|
+
|
|
29
|
+
## Configuration during Deployment
|
|
30
|
+
|
|
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
|
+
|
|
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
|
+
|
|
41
|
+
<Callout>
|
|
42
|
+
When you enable `USE_AZURE_OPENAI` on the server, users will be unable to modify and use the
|
|
43
|
+
OpenAI API key in the frontend configuration.
|
|
44
|
+
</Callout>
|
|
45
|
+
|
|
46
|
+
[azure-api-verion-url]: https://learn.microsoft.com/zh-cn/azure/ai-services/openai/reference#chat-completions
|
|
47
|
+
[azure-openai-url]: https://learn.microsoft.com/zh-cn/azure/ai-services/openai/concepts/models
|
|
48
|
+
[rfc]: https://github.com/lobehub/lobe-chat/discussions/178
|
|
@@ -1,20 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
import { Callout } from 'nextra/components';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
#### TOC
|
|
3
|
+
# 与 Azure OpenAI 集成使用
|
|
6
4
|
|
|
7
|
-
|
|
8
|
-
- [在界面中配置](#在界面中配置)
|
|
9
|
-
- [在部署时配置](#在部署时配置)
|
|
5
|
+
LobeChat 支持使用 [Azure OpenAI][azure-openai-url] 作为 OpenAI 的模型服务商,本文将介绍如何配置 Azure OpenAI。
|
|
10
6
|
|
|
11
7
|
## 使用限制
|
|
12
8
|
|
|
13
9
|
从研发成本考虑 ([#178][rfc]),目前阶段的 LobeChat 并没有 100% 完全符合 Azure OpenAI 的实现模型,采用了以 `openai` 为基座,兼容 Azure OpeAI 的解决方案。因此会带来以下局限性:
|
|
14
10
|
|
|
15
11
|
- OpenAI 与 Azure OpenAI 只能二选一,当你开启使用 Azure OpenAI 后,将无法使用 OpenAI 作为模型服务商;
|
|
16
|
-
- LobeChat 约定了与模型同名的部署名才能正常使用,比如 `gpt-35-turbo` 模型的部署名,必须为 `gpt-35-turbo`,否则 LobeChat 将无法正常正确匹配到相应模型
|
|
17
|
-

|
|
12
|
+
- LobeChat 约定了与模型同名的部署名才能正常使用,比如 `gpt-35-turbo` 模型的部署名,必须为 `gpt-35-turbo`,否则 LobeChat 将无法正常正确匹配到相应模型 
|
|
18
13
|
- 由于 Azure OpenAI 的 SDK 接入复杂度,当前无法查询配置资源的模型列表;
|
|
19
14
|
|
|
20
15
|
## 在界面中配置
|
|
@@ -31,23 +26,23 @@ LobeChat 支持使用 [Azure OpenAI][azure-openai-url] 作为 OpenAI 的模型
|
|
|
31
26
|
|
|
32
27
|
完成上述字段配置后,点击「检查」,如果提示「检查通过」,则说明配置成功。
|
|
33
28
|
|
|
34
|
-
<br/>
|
|
29
|
+
<br />
|
|
35
30
|
|
|
36
31
|
## 在部署时配置
|
|
37
32
|
|
|
38
33
|
如果你希望部署的版本直接配置好 Azure OpenAI,让终端用户直接使用,那么你需要在部署时配置以下环境变量:
|
|
39
34
|
|
|
40
|
-
| 环境变量
|
|
41
|
-
|
|
|
42
|
-
| `USE_AZURE_OPENAI`
|
|
43
|
-
| `AZURE_API_KEY`
|
|
44
|
-
| `OPENAI_PROXY_URL`
|
|
45
|
-
| `AZURE_API_VERSION` | 可选 | Azure 的 API 版本,遵循 YYYY-MM-DD 格式
|
|
46
|
-
| `ACCESS_CODE`
|
|
47
|
-
|
|
48
|
-
>
|
|
49
|
-
|
|
50
|
-
>
|
|
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
|
+
|
|
43
|
+
<Callout>
|
|
44
|
+
当你在服务端开启 `USE_AZURE_OPENAI` 后,用户将无法在前端配置中修改并使用 OpenAI API key。
|
|
45
|
+
</Callout>
|
|
51
46
|
|
|
52
47
|
[azure-api-verion-url]: https://learn.microsoft.com/zh-cn/azure/ai-services/openai/reference#chat-completions
|
|
53
48
|
[azure-openai-url]: https://learn.microsoft.com/zh-cn/azure/ai-services/openai/concepts/models
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { Callout, Steps, Tabs } from 'nextra/components';
|
|
2
|
+
|
|
3
|
+
# Docker Compose Deployment Guide
|
|
4
|
+
|
|
5
|
+
[![][docker-release-shield]][docker-release-link][![][docker-size-shield]][docker-size-link][![][docker-pulls-shield]][docker-pulls-link]
|
|
6
|
+
|
|
7
|
+
We provide a [Docker image][docker-release-link] for deploying the LobeChat service on your private device.
|
|
8
|
+
|
|
9
|
+
<Steps>
|
|
10
|
+
|
|
11
|
+
### Install Docker Container Environment
|
|
12
|
+
|
|
13
|
+
(Skip this step if already installed)
|
|
14
|
+
|
|
15
|
+
<Tabs items={['Ubuntu', 'CentOS']}>
|
|
16
|
+
<Tabs.Tab>
|
|
17
|
+
|
|
18
|
+
```fish
|
|
19
|
+
$ apt install docker.io
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
</Tabs.Tab>
|
|
23
|
+
<Tabs.Tab>
|
|
24
|
+
|
|
25
|
+
```fish
|
|
26
|
+
$ yum install docker
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
</Tabs.Tab>
|
|
30
|
+
|
|
31
|
+
</Tabs>
|
|
32
|
+
|
|
33
|
+
### Run Docker Compose Deployment Command
|
|
34
|
+
|
|
35
|
+
When using `docker-compose`, the configuration file is as follows:
|
|
36
|
+
|
|
37
|
+
```yml
|
|
38
|
+
version: '3.8'
|
|
39
|
+
|
|
40
|
+
services:
|
|
41
|
+
lobe-chat:
|
|
42
|
+
image: lobehub/lobe-chat
|
|
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
|
+
```
|
|
52
|
+
|
|
53
|
+
Run the following command to start the Lobe Chat service:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
$ docker-compose up -d
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Crontab Automatic Update Script (Optional)
|
|
60
|
+
|
|
61
|
+
Similarly, you can use the following script to automatically update Lobe Chat. When using `Docker Compose`, no additional configuration of environment variables is required.
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
#!/bin/bash
|
|
65
|
+
# auto-update-lobe-chat.sh
|
|
66
|
+
|
|
67
|
+
# Set proxy (optional)
|
|
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
|
|
69
|
+
|
|
70
|
+
# Pull the latest image and store the output in a variable
|
|
71
|
+
output=$(docker pull lobehub/lobe-chat:latest 2>&1)
|
|
72
|
+
|
|
73
|
+
# Check if the pull command was executed successfully
|
|
74
|
+
if [ $? -ne 0 ]; then
|
|
75
|
+
exit 1
|
|
76
|
+
fi
|
|
77
|
+
|
|
78
|
+
# Check if the output contains a specific string
|
|
79
|
+
echo "$output" | grep -q "Image is up to date for lobehub/lobe-chat:latest"
|
|
80
|
+
|
|
81
|
+
# If the image is already up to date, do nothing
|
|
82
|
+
if [ $? -eq 0 ]; then
|
|
83
|
+
exit 0
|
|
84
|
+
fi
|
|
85
|
+
|
|
86
|
+
echo "Detected Lobe-Chat update"
|
|
87
|
+
|
|
88
|
+
# Remove the old container
|
|
89
|
+
echo "Removed: $(docker rm -f Lobe-Chat)"
|
|
90
|
+
|
|
91
|
+
# You may need to navigate to the directory where `docker-compose.yml` is located first
|
|
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
|
+
```
|
|
113
|
+
|
|
114
|
+
</Steps>
|
|
115
|
+
|
|
116
|
+
[docker-pulls-link]: https://hub.docker.com/r/lobehub/lobe-chat
|
|
117
|
+
[docker-pulls-shield]: https://img.shields.io/docker/pulls/lobehub/lobe-chat?color=45cc11&labelColor=black&style=flat-square
|
|
118
|
+
[docker-release-link]: https://hub.docker.com/r/lobehub/lobe-chat
|
|
119
|
+
[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
|
|
120
|
+
[docker-size-link]: https://hub.docker.com/r/lobehub/lobe-chat
|
|
121
|
+
[docker-size-shield]: https://img.shields.io/docker/image-size/lobehub/lobe-chat?color=369eff&labelColor=black&style=flat-square
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { Callout, Steps, Tabs } from 'nextra/components';
|
|
2
|
+
|
|
3
|
+
# Docker Compose 部署指引
|
|
4
|
+
|
|
5
|
+
[![][docker-release-shield]][docker-release-link][![][docker-size-shield]][docker-size-link][![][docker-pulls-shield]][docker-pulls-link]
|
|
6
|
+
|
|
7
|
+
我们提供了 [Docker 镜像][docker-release-link],供你在自己的私有设备上部署 LobeChat 服务。
|
|
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
|
+
<Steps>
|
|
17
|
+
|
|
18
|
+
### 安装 Docker 容器环境
|
|
19
|
+
|
|
20
|
+
(如果已安装,请跳过此步)
|
|
21
|
+
|
|
22
|
+
<Tabs items={['Ubuntu', 'CentOS']}>
|
|
23
|
+
<Tabs.Tab>
|
|
24
|
+
|
|
25
|
+
```fish
|
|
26
|
+
$ apt install docker.io
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
</Tabs.Tab>
|
|
30
|
+
<Tabs.Tab>
|
|
31
|
+
|
|
32
|
+
```fish
|
|
33
|
+
$ yum install docker
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
</Tabs.Tab>
|
|
37
|
+
|
|
38
|
+
</Tabs>
|
|
39
|
+
|
|
40
|
+
### 运行 Docker Compose 部署指令
|
|
41
|
+
|
|
42
|
+
使用 `docker-compose` 时配置文件如下:
|
|
43
|
+
|
|
44
|
+
```yml
|
|
45
|
+
version: '3.8'
|
|
46
|
+
|
|
47
|
+
services:
|
|
48
|
+
lobe-chat:
|
|
49
|
+
image: lobehub/lobe-chat
|
|
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
|
+
```
|
|
59
|
+
|
|
60
|
+
运行以下命令启动 Lobe Chat 服务:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
$ docker-compose up -d
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Crontab 自动更新脚本(可选)
|
|
67
|
+
|
|
68
|
+
类似地,你可以使用以下脚本来自动更新 Lobe Chat,使用 `Docker Compose` 时,环境变量无需额外配置。
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
#!/bin/bash
|
|
72
|
+
# auto-update-lobe-chat.sh
|
|
73
|
+
|
|
74
|
+
# 设置代理(可选)
|
|
75
|
+
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
|
|
76
|
+
|
|
77
|
+
# 拉取最新的镜像并将输出存储在变量中
|
|
78
|
+
output=$(docker pull lobehub/lobe-chat:latest 2>&1)
|
|
79
|
+
|
|
80
|
+
# 检查拉取命令是否成功执行
|
|
81
|
+
if [ $? -ne 0 ]; then
|
|
82
|
+
exit 1
|
|
83
|
+
fi
|
|
84
|
+
|
|
85
|
+
# 检查输出中是否包含特定的字符串
|
|
86
|
+
echo "$output" | grep -q "Image is up to date for lobehub/lobe-chat:latest"
|
|
87
|
+
|
|
88
|
+
# 如果镜像已经是最新的,则不执行任何操作
|
|
89
|
+
if [ $? -eq 0 ]; then
|
|
90
|
+
exit 0
|
|
91
|
+
fi
|
|
92
|
+
|
|
93
|
+
echo "Detected Lobe-Chat update"
|
|
94
|
+
|
|
95
|
+
# 删除旧的容器
|
|
96
|
+
echo "Removed: $(docker rm -f Lobe-Chat)"
|
|
97
|
+
|
|
98
|
+
# 也许需要先进入 `docker-compose.yml` 所在的目录
|
|
99
|
+
# cd /path/to/docker-compose-folder
|
|
100
|
+
|
|
101
|
+
# 运行新的容器
|
|
102
|
+
echo "Started: $(docker-compose up)"
|
|
103
|
+
|
|
104
|
+
# 打印更新的时间和版本
|
|
105
|
+
echo "Update time: $(date)"
|
|
106
|
+
echo "Version: $(docker inspect lobehub/lobe-chat:latest | grep 'org.opencontainers.image.version' | awk -F'"' '{print $4}')"
|
|
107
|
+
|
|
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
|
+
```
|
|
120
|
+
|
|
121
|
+
</Steps>
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { Callout, Steps, Tabs } from 'nextra/components';
|
|
2
|
+
|
|
3
|
+
# Docker Deployment Guide
|
|
4
|
+
|
|
5
|
+
[![][docker-release-shield]][docker-release-link][![][docker-size-shield]][docker-size-link][![][docker-pulls-shield]][docker-pulls-link]
|
|
6
|
+
|
|
7
|
+
We provide a [Docker image][docker-release-link] for you to deploy the LobeChat service on your private device.
|
|
8
|
+
|
|
9
|
+
<Steps>
|
|
10
|
+
|
|
11
|
+
### Install Docker Container Environment
|
|
12
|
+
|
|
13
|
+
(If already installed, skip this step)
|
|
14
|
+
|
|
15
|
+
<Tabs items={['Ubuntu', 'CentOS']}>
|
|
16
|
+
<Tabs.Tab>
|
|
17
|
+
|
|
18
|
+
```fish
|
|
19
|
+
$ apt install docker.io
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
</Tabs.Tab>
|
|
23
|
+
<Tabs.Tab>
|
|
24
|
+
|
|
25
|
+
```fish
|
|
26
|
+
$ yum install docker
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
</Tabs.Tab>
|
|
30
|
+
</Tabs>
|
|
31
|
+
|
|
32
|
+
### Docker Command Deployment
|
|
33
|
+
|
|
34
|
+
Use the following command to start the LobeChat service with one click:
|
|
35
|
+
|
|
36
|
+
```fish
|
|
37
|
+
$ docker run -d -p 3210:3210 \
|
|
38
|
+
-e OPENAI_API_KEY=sk-xxxx \
|
|
39
|
+
-e ACCESS_CODE=lobe66 \
|
|
40
|
+
--name lobe-chat \
|
|
41
|
+
lobehub/lobe-chat
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Command explanation:
|
|
45
|
+
|
|
46
|
+
- The default port mapping is `3210`, please ensure it is not occupied or manually change the port mapping.
|
|
47
|
+
|
|
48
|
+
- Replace `sk-xxxx` in the above command with your OpenAI API Key.
|
|
49
|
+
|
|
50
|
+
- For the complete list of environment variables supported by LobeChat, please refer to the [Environment Variables](/zh/self-hosting/environment-ariable) section.
|
|
51
|
+
|
|
52
|
+
<Callout>
|
|
53
|
+
Since the official Docker image build takes about half an hour, if you see the "update available"
|
|
54
|
+
prompt after deployment, you can wait for the image to finish building before deploying again.
|
|
55
|
+
</Callout>
|
|
56
|
+
|
|
57
|
+
<Callout type="warning">
|
|
58
|
+
The official Docker image does not have a password set. It is strongly recommended to add a
|
|
59
|
+
password to enhance security, otherwise you may encounter situations like [My API Key was
|
|
60
|
+
stolen!!!](https://github.com/lobehub/lobe-chat/issues/1123).
|
|
61
|
+
</Callout>
|
|
62
|
+
|
|
63
|
+
<Callout type="info">
|
|
64
|
+
Note that when the **deployment architecture is inconsistent with the image**, you need to
|
|
65
|
+
cross-compile **Sharp**, see [Sharp
|
|
66
|
+
Cross-Compilation](https://sharp.pixelplumbing.com/install#cross-platform) for details.
|
|
67
|
+
</Callout>
|
|
68
|
+
|
|
69
|
+
#### Using a Proxy Address
|
|
70
|
+
|
|
71
|
+
If you need to use the OpenAI service through a proxy, you can configure the proxy address using the `OPENAI_PROXY_URL` environment variable:
|
|
72
|
+
|
|
73
|
+
```fish
|
|
74
|
+
$ docker run -d -p 3210:3210 \
|
|
75
|
+
-e OPENAI_API_KEY=sk-xxxx \
|
|
76
|
+
-e OPENAI_PROXY_URL=https://api-proxy.com/v1 \
|
|
77
|
+
-e ACCESS_CODE=lobe66 \
|
|
78
|
+
--name lobe-chat \
|
|
79
|
+
lobehub/lobe-chat
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Crontab Automatic Update Script (Optional)
|
|
83
|
+
|
|
84
|
+
If you want to automatically obtain the latest image, you can follow these steps.
|
|
85
|
+
|
|
86
|
+
First, create a `lobe.env` configuration file with various environment variables, for example:
|
|
87
|
+
|
|
88
|
+
```env
|
|
89
|
+
OPENAI_API_KEY=sk-xxxx
|
|
90
|
+
OPENAI_PROXY_URL=https://api-proxy.com/v1
|
|
91
|
+
ACCESS_CODE=arthals2333
|
|
92
|
+
CUSTOM_MODELS=-gpt-4,-gpt-4-32k,-gpt-3.5-turbo-16k,gpt-3.5-turbo-1106=gpt-3.5-turbo-16k,gpt-4-0125-preview=gpt-4-turbo,gpt-4-vision-preview=gpt-4-vision
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Then, you can use the following script to automate the update:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
#!/bin/bash
|
|
99
|
+
# auto-update-lobe-chat.sh
|
|
100
|
+
|
|
101
|
+
# Set up proxy (optional)
|
|
102
|
+
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
|
|
103
|
+
|
|
104
|
+
# Pull the latest image and store the output in a variable
|
|
105
|
+
output=$(docker pull lobehub/lobe-chat:latest 2>&1)
|
|
106
|
+
|
|
107
|
+
# Check if the pull command was executed successfully
|
|
108
|
+
if [ $? -ne 0 ]; then
|
|
109
|
+
exit 1
|
|
110
|
+
fi
|
|
111
|
+
|
|
112
|
+
# Check if the output contains a specific string
|
|
113
|
+
echo "$output" | grep -q "Image is up to date for lobehub/lobe-chat:latest"
|
|
114
|
+
|
|
115
|
+
# If the image is already up to date, do nothing
|
|
116
|
+
if [ $? -eq 0 ]; then
|
|
117
|
+
exit 0
|
|
118
|
+
fi
|
|
119
|
+
|
|
120
|
+
echo "Detected Lobe-Chat update"
|
|
121
|
+
|
|
122
|
+
# Remove the old container
|
|
123
|
+
echo "Removed: $(docker rm -f Lobe-Chat)"
|
|
124
|
+
|
|
125
|
+
# Run the new container
|
|
126
|
+
echo "Started: $(docker run -d --network=host --env-file /path/to/lobe.env --name=Lobe-Chat --restart=always lobehub/lobe-chat)"
|
|
127
|
+
|
|
128
|
+
# Print the update time and version
|
|
129
|
+
echo "Update time: $(date)"
|
|
130
|
+
echo "Version: $(docker inspect lobehub/lobe-chat:latest | grep 'org.opencontainers.image.version' | awk -F'"' '{print $4}')"
|
|
131
|
+
|
|
132
|
+
# Clean up unused images
|
|
133
|
+
docker images | grep 'lobehub/lobe-chat' | grep -v 'latest' | awk '{print $3}' | xargs -r docker rmi > /dev/null 2>&1
|
|
134
|
+
echo "Removed old images."
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
This script can be used in Crontab, but please ensure that your Crontab can find the correct Docker command. It is recommended to use absolute paths.
|
|
138
|
+
|
|
139
|
+
Configure Crontab to execute the script every 5 minutes:
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
*/5 * * * * /path/to/auto-update-lobe-chat.sh >> /path/to/auto-update-lobe-chat.log 2>&1
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
[docker-pulls-link]: https://hub.docker.com/r/lobehub/lobe-chat
|
|
146
|
+
[docker-pulls-shield]: https://img.shields.io/docker/pulls/lobehub/lobe-chat?color=45cc11&labelColor=black&style=flat-square
|
|
147
|
+
[docker-release-link]: https://hub.docker.com/r/lobehub/lobe-chat
|
|
148
|
+
[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
|
|
149
|
+
[docker-size-link]: https://hub.docker.com/r/lobehub/lobe-chat
|
|
150
|
+
[docker-size-shield]: https://img.shields.io/docker/image-size/lobehub/lobe-chat?color=369eff&labelColor=black&style=flat-square
|
|
151
|
+
|
|
152
|
+
</Steps>
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { Callout, Steps, Tabs } from 'nextra/components';
|
|
2
|
+
|
|
3
|
+
# Docker 部署指引
|
|
4
|
+
|
|
5
|
+
[![][docker-release-shield]][docker-release-link][![][docker-size-shield]][docker-size-link][![][docker-pulls-shield]][docker-pulls-link]
|
|
6
|
+
|
|
7
|
+
我们提供了 [Docker 镜像][docker-release-link],供你在自己的私有设备上部署 LobeChat 服务。
|
|
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
|
+
<Steps>
|
|
17
|
+
|
|
18
|
+
### 安装 Docker 容器环境
|
|
19
|
+
|
|
20
|
+
(如果已安装,请跳过此步)
|
|
21
|
+
|
|
22
|
+
<Tabs items={['Ubuntu', 'CentOS']}>
|
|
23
|
+
<Tabs.Tab>
|
|
24
|
+
|
|
25
|
+
```fish
|
|
26
|
+
$ apt install docker.io
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
</Tabs.Tab>
|
|
30
|
+
<Tabs.Tab>
|
|
31
|
+
|
|
32
|
+
```fish
|
|
33
|
+
$ yum install docker
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
</Tabs.Tab>
|
|
37
|
+
</Tabs>
|
|
38
|
+
|
|
39
|
+
### Docker 指令部署
|
|
40
|
+
|
|
41
|
+
使用以下命令即可使用一键启动 LobeChat 服务:
|
|
42
|
+
|
|
43
|
+
```fish
|
|
44
|
+
$ docker run -d -p 3210:3210 \
|
|
45
|
+
-e OPENAI_API_KEY=sk-xxxx \
|
|
46
|
+
-e ACCESS_CODE=lobe66 \
|
|
47
|
+
--name lobe-chat \
|
|
48
|
+
lobehub/lobe-chat
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
指令说明:
|
|
52
|
+
|
|
53
|
+
- 默认映射端口为 `3210`, 请确保未被占用或手动更改端口映射
|
|
54
|
+
- 使用你的 OpenAI API Key 替换上述命令中的 `sk-xxxx`
|
|
55
|
+
|
|
56
|
+
- LobeChat 支持的完整环境变量列表请参考 [环境变量](/zh/self-hosting/environment-ariable) 部分
|
|
57
|
+
|
|
58
|
+
<Callout>
|
|
59
|
+
由于官方的 Docker
|
|
60
|
+
镜像构建大约需要半小时左右,如果在更新部署后会出现「存在更新」的提示,可以等待镜像构建完成后再次部署。
|
|
61
|
+
</Callout>
|
|
62
|
+
|
|
63
|
+
<Callout type="warning">
|
|
64
|
+
官方 Docker 镜像中未设定密码,强烈建议添加密码以提升安全性,否则你可能会遇到 [My API Key was
|
|
65
|
+
stolen!!!](https://github.com/lobehub/lobe-chat/issues/1123) 这样的情况
|
|
66
|
+
</Callout>
|
|
67
|
+
|
|
68
|
+
<Callout type="info">
|
|
69
|
+
注意,当**部署架构与镜像的不一致时**,需要对 **Sharp** 进行交叉编译,详见 [Sharp
|
|
70
|
+
交叉编译](https://sharp.pixelplumbing.com/install#cross-platform)
|
|
71
|
+
</Callout>
|
|
72
|
+
|
|
73
|
+
#### 使用代理地址
|
|
74
|
+
|
|
75
|
+
如果你需要通过代理使用 OpenAI 服务,你可以使用 `OPENAI_PROXY_URL` 环境变量来配置代理地址:
|
|
76
|
+
|
|
77
|
+
```fish
|
|
78
|
+
$ docker run -d -p 3210:3210 \
|
|
79
|
+
-e OPENAI_API_KEY=sk-xxxx \
|
|
80
|
+
-e OPENAI_PROXY_URL=https://api-proxy.com/v1 \
|
|
81
|
+
-e ACCESS_CODE=lobe66 \
|
|
82
|
+
--name lobe-chat \
|
|
83
|
+
lobehub/lobe-chat
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Crontab 自动更新脚本(可选)
|
|
87
|
+
|
|
88
|
+
如果你想自动获得最新的镜像,你可以如下操作。
|
|
89
|
+
|
|
90
|
+
首先,新建一个 `lobe.env` 配置文件,内容为各种环境变量,例如:
|
|
91
|
+
|
|
92
|
+
```env
|
|
93
|
+
OPENAI_API_KEY=sk-xxxx
|
|
94
|
+
OPENAI_PROXY_URL=https://api-proxy.com/v1
|
|
95
|
+
ACCESS_CODE=arthals2333
|
|
96
|
+
CUSTOM_MODELS=-gpt-4,-gpt-4-32k,-gpt-3.5-turbo-16k,gpt-3.5-turbo-1106=gpt-3.5-turbo-16k,gpt-4-0125-preview=gpt-4-turbo,gpt-4-vision-preview=gpt-4-vision
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
然后,你可以使用以下脚本来自动更新:
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
#!/bin/bash
|
|
103
|
+
# auto-update-lobe-chat.sh
|
|
104
|
+
|
|
105
|
+
# 设置代理(可选)
|
|
106
|
+
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
|
|
107
|
+
|
|
108
|
+
# 拉取最新的镜像并将输出存储在变量中
|
|
109
|
+
output=$(docker pull lobehub/lobe-chat:latest 2>&1)
|
|
110
|
+
|
|
111
|
+
# 检查拉取命令是否成功执行
|
|
112
|
+
if [ $? -ne 0 ]; then
|
|
113
|
+
exit 1
|
|
114
|
+
fi
|
|
115
|
+
|
|
116
|
+
# 检查输出中是否包含特定的字符串
|
|
117
|
+
echo "$output" | grep -q "Image is up to date for lobehub/lobe-chat:latest"
|
|
118
|
+
|
|
119
|
+
# 如果镜像已经是最新的,则不执行任何操作
|
|
120
|
+
if [ $? -eq 0 ]; then
|
|
121
|
+
exit 0
|
|
122
|
+
fi
|
|
123
|
+
|
|
124
|
+
echo "Detected Lobe-Chat update"
|
|
125
|
+
|
|
126
|
+
# 删除旧的容器
|
|
127
|
+
echo "Removed: $(docker rm -f Lobe-Chat)"
|
|
128
|
+
|
|
129
|
+
# 运行新的容器
|
|
130
|
+
echo "Started: $(docker run -d --network=host --env-file /path/to/lobe.env --name=Lobe-Chat --restart=always lobehub/lobe-chat)"
|
|
131
|
+
|
|
132
|
+
# 打印更新的时间和版本
|
|
133
|
+
echo "Update time: $(date)"
|
|
134
|
+
echo "Version: $(docker inspect lobehub/lobe-chat:latest | grep 'org.opencontainers.image.version' | awk -F'"' '{print $4}')"
|
|
135
|
+
|
|
136
|
+
# 清理不再使用的镜像
|
|
137
|
+
docker images | grep 'lobehub/lobe-chat' | grep -v 'latest' | awk '{print $3}' | xargs -r docker rmi > /dev/null 2>&1
|
|
138
|
+
echo "Removed old images."
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
此脚本可以在 Crontab 中使用,但请确认你的 Crontab 可以找到正确的 Docker 命令。建议使用绝对路径。
|
|
142
|
+
|
|
143
|
+
配置 Crontab,每 5 分钟执行一次脚本:
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
*/5 * * * * /path/to/auto-update-lobe-chat.sh >> /path/to/auto-update-lobe-chat.log 2>&1
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
</Steps>
|