@lobehub/chat 0.147.0 → 0.147.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/CHANGELOG.md +50 -0
- package/README.md +8 -8
- package/README.zh-CN.md +8 -8
- package/docs/self-hosting/advanced/analytics.mdx +1 -0
- package/docs/self-hosting/advanced/analytics.zh-CN.mdx +1 -0
- package/docs/self-hosting/advanced/authentication.mdx +7 -6
- package/docs/self-hosting/advanced/authentication.zh-CN.mdx +7 -6
- package/docs/self-hosting/advanced/sso-providers/auth0.mdx +58 -32
- package/docs/self-hosting/advanced/sso-providers/auth0.zh-CN.mdx +60 -32
- package/docs/self-hosting/advanced/sso-providers/authentik.mdx +33 -29
- package/docs/self-hosting/advanced/sso-providers/authentik.zh-CN.mdx +30 -27
- package/docs/self-hosting/advanced/sso-providers/github.mdx +49 -20
- package/docs/self-hosting/advanced/sso-providers/github.zh-CN.mdx +57 -31
- package/docs/self-hosting/advanced/sso-providers/microsoft-entra-id.mdx +53 -35
- package/docs/self-hosting/advanced/sso-providers/microsoft-entra-id.zh-CN.mdx +43 -31
- package/docs/self-hosting/advanced/sso-providers/zitadel.mdx +64 -34
- package/docs/self-hosting/advanced/sso-providers/zitadel.zh-CN.mdx +62 -36
- package/docs/self-hosting/advanced/upstream-sync.mdx +32 -23
- package/docs/self-hosting/advanced/upstream-sync.zh-CN.mdx +32 -23
- package/docs/self-hosting/environment-variables/analytics.mdx +1 -0
- package/docs/self-hosting/environment-variables/analytics.zh-CN.mdx +1 -0
- package/docs/self-hosting/environment-variables/auth.mdx +1 -0
- package/docs/self-hosting/environment-variables/auth.zh-CN.mdx +1 -0
- package/docs/self-hosting/environment-variables/basic.mdx +1 -0
- package/docs/self-hosting/environment-variables/basic.zh-CN.mdx +1 -0
- package/docs/self-hosting/environment-variables/model-provider.mdx +1 -0
- package/docs/self-hosting/environment-variables/model-provider.zh-CN.mdx +1 -0
- package/docs/self-hosting/environment-variables.mdx +1 -0
- package/docs/self-hosting/environment-variables.zh-CN.mdx +1 -0
- package/docs/self-hosting/examples/azure-openai.mdx +12 -8
- package/docs/self-hosting/examples/azure-openai.zh-CN.mdx +12 -8
- package/docs/self-hosting/examples/ollama.mdx +1 -0
- package/docs/self-hosting/examples/ollama.zh-CN.mdx +1 -0
- package/docs/self-hosting/faq/no-v1-suffix.mdx +1 -0
- package/docs/self-hosting/faq/no-v1-suffix.zh-CN.mdx +1 -0
- package/docs/self-hosting/faq/proxy-with-unable-to-verify-leaf-signature.mdx +1 -0
- package/docs/self-hosting/faq/proxy-with-unable-to-verify-leaf-signature.zh-CN.mdx +1 -0
- package/docs/self-hosting/platform/docker-compose.mdx +80 -73
- package/docs/self-hosting/platform/docker-compose.zh-CN.mdx +79 -73
- package/docs/self-hosting/platform/docker.mdx +85 -85
- package/docs/self-hosting/platform/docker.zh-CN.mdx +84 -85
- package/docs/self-hosting/platform/netlify.mdx +91 -42
- package/docs/self-hosting/platform/netlify.zh-CN.mdx +88 -38
- package/docs/self-hosting/platform/railway.mdx +8 -6
- package/docs/self-hosting/platform/railway.zh-CN.mdx +8 -6
- package/docs/self-hosting/platform/repocloud.mdx +8 -6
- package/docs/self-hosting/platform/repocloud.zh-CN.mdx +8 -6
- package/docs/self-hosting/platform/sealos.mdx +8 -6
- package/docs/self-hosting/platform/sealos.zh-CN.mdx +8 -6
- package/docs/self-hosting/platform/vercel.mdx +9 -7
- package/docs/self-hosting/platform/vercel.zh-CN.mdx +9 -7
- package/docs/self-hosting/platform/zeabur.mdx +8 -6
- package/docs/self-hosting/platform/zeabur.zh-CN.mdx +8 -6
- package/docs/self-hosting/start.mdx +11 -1
- package/docs/self-hosting/start.zh-CN.mdx +2 -1
- package/docs/usage/agents/concepts.mdx +13 -2
- package/docs/usage/agents/concepts.zh-CN.mdx +13 -2
- package/docs/usage/agents/custom-agent.mdx +9 -2
- package/docs/usage/agents/custom-agent.zh-CN.mdx +8 -4
- package/docs/usage/agents/model.mdx +3 -3
- package/docs/usage/agents/model.zh-CN.mdx +6 -5
- package/docs/usage/agents/prompt.mdx +7 -5
- package/docs/usage/agents/prompt.zh-CN.mdx +7 -5
- package/docs/usage/agents/topics.mdx +9 -1
- package/docs/usage/agents/topics.zh-CN.mdx +9 -1
- package/docs/usage/features/agent-market.mdx +5 -5
- package/docs/usage/features/agent-market.zh-CN.mdx +1 -0
- package/docs/usage/features/local-llm.mdx +6 -1
- package/docs/usage/features/local-llm.zh-CN.mdx +6 -1
- package/docs/usage/features/mobile.mdx +5 -1
- package/docs/usage/features/mobile.zh-CN.mdx +6 -1
- package/docs/usage/features/more.mdx +1 -0
- package/docs/usage/features/more.zh-CN.mdx +1 -0
- package/docs/usage/features/multi-ai-providers.mdx +11 -2
- package/docs/usage/features/multi-ai-providers.zh-CN.mdx +12 -2
- package/docs/usage/features/plugin-system.mdx +8 -7
- package/docs/usage/features/plugin-system.zh-CN.mdx +9 -7
- package/docs/usage/features/pwa.mdx +10 -4
- package/docs/usage/features/pwa.zh-CN.mdx +11 -4
- package/docs/usage/features/text-to-image.zh-CN.mdx +1 -0
- package/docs/usage/features/theme.mdx +6 -1
- package/docs/usage/features/theme.zh-CN.mdx +7 -1
- package/docs/usage/features/tts.zh-CN.mdx +1 -0
- package/docs/usage/features/vision.zh-CN.mdx +1 -0
- package/docs/usage/plugins/basic-usage.mdx +31 -7
- package/docs/usage/plugins/basic-usage.zh-CN.mdx +31 -7
- package/docs/usage/plugins/custom-plugin.mdx +1 -0
- package/docs/usage/plugins/custom-plugin.zh-CN.mdx +1 -0
- package/docs/usage/plugins/development.mdx +79 -30
- package/docs/usage/plugins/development.zh-CN.mdx +80 -31
- package/docs/usage/plugins/store.mdx +11 -2
- package/docs/usage/plugins/store.zh-CN.mdx +11 -2
- package/docs/usage/providers/groq.mdx +32 -12
- package/docs/usage/providers/groq.zh-CN.mdx +30 -12
- package/docs/usage/providers/ollama/gemma.mdx +27 -11
- package/docs/usage/providers/ollama/gemma.zh-CN.mdx +28 -11
- package/docs/usage/providers/ollama/qwen.mdx +30 -16
- package/docs/usage/providers/ollama/qwen.zh-CN.mdx +25 -11
- package/docs/usage/providers/ollama.mdx +27 -14
- package/docs/usage/providers/ollama.zh-CN.mdx +27 -14
- package/package.json +1 -1
- package/src/app/settings/llm/Azure/index.tsx +1 -1
- package/src/app/settings/llm/components/ProviderConfig/index.tsx +1 -1
- package/src/app/settings/llm/components/ProviderModelList/CustomModelOption.tsx +1 -1
- package/src/app/settings/llm/components/ProviderModelList/ModelConfigModal.tsx +1 -1
- package/src/app/settings/llm/components/ProviderModelList/ModelFetcher.tsx +3 -3
- package/src/app/settings/llm/components/ProviderModelList/index.tsx +2 -2
- package/src/features/AgentSetting/AgentConfig/ModelSelect.tsx +1 -1
- package/src/features/Conversation/Error/APIKeyForm/ProviderApiKeyForm.tsx +2 -2
- package/src/features/ModelSwitchPanel/index.tsx +1 -1
- package/src/locales/resources.test.ts +49 -0
- package/src/locales/resources.ts +7 -20
- package/src/services/_auth.ts +5 -3
- package/src/services/_header.ts +3 -4
- package/src/services/chat.ts +1 -1
- package/src/services/ollama.ts +3 -2
- package/src/store/global/slices/settings/actions/llm.test.ts +1 -1
- package/src/store/global/slices/settings/actions/llm.ts +2 -2
- package/src/store/global/slices/settings/selectors/modelConfig.test.ts +35 -14
- package/src/store/global/slices/settings/selectors/modelConfig.ts +55 -118
|
@@ -10,14 +10,16 @@ tags:
|
|
|
10
10
|
- Proxy Configuration
|
|
11
11
|
- Automatic Update Script
|
|
12
12
|
---
|
|
13
|
+
|
|
13
14
|
# Docker Deployment Guide
|
|
14
15
|
|
|
15
16
|
<div style={{display:"flex", gap: 4}}>
|
|
16
17
|
[![][docker-release-shield]][docker-release-link]
|
|
17
18
|
|
|
18
|
-
|
|
19
|
+
[![][docker-size-shield]][docker-size-link]
|
|
20
|
+
|
|
21
|
+
[![][docker-pulls-shield]][docker-pulls-link]
|
|
19
22
|
|
|
20
|
-
[![][docker-pulls-shield]][docker-pulls-link]
|
|
21
23
|
</div>
|
|
22
24
|
|
|
23
25
|
We provide a [Docker image][docker-release-link] for you to deploy the LobeChat service on your private device.
|
|
@@ -25,7 +27,7 @@ We provide a [Docker image][docker-release-link] for you to deploy the LobeChat
|
|
|
25
27
|
<Steps>
|
|
26
28
|
### Install Docker Container Environment
|
|
27
29
|
|
|
28
|
-
|
|
30
|
+
(If already installed, skip this step)
|
|
29
31
|
|
|
30
32
|
<Tabs items={['Ubuntu', 'CentOS']}>
|
|
31
33
|
<Tab>
|
|
@@ -39,126 +41,124 @@ We provide a [Docker image][docker-release-link] for you to deploy the LobeChat
|
|
|
39
41
|
```fish
|
|
40
42
|
$ yum install docker
|
|
41
43
|
```
|
|
42
|
-
|
|
44
|
+
|
|
43
45
|
</Tab>
|
|
44
46
|
|
|
45
47
|
</Tabs>
|
|
46
48
|
|
|
47
|
-
|
|
49
|
+
### Docker Command Deployment
|
|
48
50
|
|
|
49
|
-
|
|
51
|
+
Use the following command to start the LobeChat service with one click:
|
|
50
52
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
53
|
+
```fish
|
|
54
|
+
$ docker run -d -p 3210:3210 \
|
|
55
|
+
-e OPENAI_API_KEY=sk-xxxx \
|
|
56
|
+
-e ACCESS_CODE=lobe66 \
|
|
57
|
+
--name lobe-chat \
|
|
58
|
+
lobehub/lobe-chat
|
|
59
|
+
```
|
|
58
60
|
|
|
59
|
-
|
|
61
|
+
Command explanation:
|
|
60
62
|
|
|
61
|
-
|
|
63
|
+
- The default port mapping is `3210`, please ensure it is not occupied or manually change the port mapping.
|
|
62
64
|
|
|
63
|
-
|
|
65
|
+
- Replace `sk-xxxx` in the above command with your OpenAI API Key.
|
|
64
66
|
|
|
65
|
-
|
|
67
|
+
- For the complete list of environment variables supported by LobeChat, please refer to the [Environment Variables](/zh/self-hosting/environment-ariable) section.
|
|
66
68
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
<Callout type="tip">
|
|
70
|
+
Since the official Docker image build takes about half an hour, if you see the "update available"
|
|
71
|
+
prompt after deployment, you can wait for the image to finish building before deploying again.
|
|
71
72
|
</Callout>
|
|
72
73
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
74
|
+
<Callout type="warning">
|
|
75
|
+
The official Docker image does not have a password set. It is strongly recommended to add a
|
|
76
|
+
password to enhance security, otherwise you may encounter situations like [My API Key was
|
|
77
|
+
stolen!!!](https://github.com/lobehub/lobe-chat/issues/1123).
|
|
78
78
|
</Callout>
|
|
79
79
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
80
|
+
<Callout type="important">
|
|
81
|
+
Note that when the **deployment architecture is inconsistent with the image**, you need to
|
|
82
|
+
cross-compile **Sharp**, see [Sharp
|
|
83
|
+
Cross-Compilation](https://sharp.pixelplumbing.com/install#cross-platform) for details.
|
|
85
84
|
</Callout>
|
|
86
85
|
|
|
87
|
-
|
|
86
|
+
#### Using a Proxy Address
|
|
87
|
+
|
|
88
|
+
If you need to use the OpenAI service through a proxy, you can configure the proxy address using the `OPENAI_PROXY_URL` environment variable:
|
|
88
89
|
|
|
89
|
-
|
|
90
|
+
```fish
|
|
91
|
+
$ docker run -d -p 3210:3210 \
|
|
92
|
+
-e OPENAI_API_KEY=sk-xxxx \
|
|
93
|
+
-e OPENAI_PROXY_URL=https://api-proxy.com/v1 \
|
|
94
|
+
-e ACCESS_CODE=lobe66 \
|
|
95
|
+
--name lobe-chat \
|
|
96
|
+
lobehub/lobe-chat
|
|
97
|
+
```
|
|
90
98
|
|
|
91
|
-
|
|
92
|
-
$ docker run -d -p 3210:3210 \
|
|
93
|
-
-e OPENAI_API_KEY=sk-xxxx \
|
|
94
|
-
-e OPENAI_PROXY_URL=https://api-proxy.com/v1 \
|
|
95
|
-
-e ACCESS_CODE=lobe66 \
|
|
96
|
-
--name lobe-chat \
|
|
97
|
-
lobehub/lobe-chat
|
|
98
|
-
```
|
|
99
|
+
### Crontab Automatic Update Script (Optional)
|
|
99
100
|
|
|
100
|
-
|
|
101
|
+
If you want to automatically obtain the latest image, you can follow these steps.
|
|
101
102
|
|
|
102
|
-
|
|
103
|
+
First, create a `lobe.env` configuration file with various environment variables, for example:
|
|
103
104
|
|
|
104
|
-
|
|
105
|
+
```env
|
|
106
|
+
OPENAI_API_KEY=sk-xxxx
|
|
107
|
+
OPENAI_PROXY_URL=https://api-proxy.com/v1
|
|
108
|
+
ACCESS_CODE=arthals2333
|
|
109
|
+
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
|
|
110
|
+
```
|
|
105
111
|
|
|
106
|
-
|
|
107
|
-
OPENAI_API_KEY=sk-xxxx
|
|
108
|
-
OPENAI_PROXY_URL=https://api-proxy.com/v1
|
|
109
|
-
ACCESS_CODE=arthals2333
|
|
110
|
-
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
|
|
111
|
-
```
|
|
112
|
+
Then, you can use the following script to automate the update:
|
|
112
113
|
|
|
113
|
-
|
|
114
|
+
```bash
|
|
115
|
+
#!/bin/bash
|
|
116
|
+
# auto-update-lobe-chat.sh
|
|
114
117
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
# auto-update-lobe-chat.sh
|
|
118
|
+
# Set up proxy (optional)
|
|
119
|
+
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
|
|
118
120
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
+
# Pull the latest image and store the output in a variable
|
|
122
|
+
output=$(docker pull lobehub/lobe-chat:latest 2>&1)
|
|
121
123
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
+
# Check if the pull command was executed successfully
|
|
125
|
+
if [ $? -ne 0 ]; then
|
|
126
|
+
exit 1
|
|
127
|
+
fi
|
|
124
128
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
exit 1
|
|
128
|
-
fi
|
|
129
|
+
# Check if the output contains a specific string
|
|
130
|
+
echo "$output" | grep -q "Image is up to date for lobehub/lobe-chat:latest"
|
|
129
131
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
+
# If the image is already up to date, do nothing
|
|
133
|
+
if [ $? -eq 0 ]; then
|
|
134
|
+
exit 0
|
|
135
|
+
fi
|
|
132
136
|
|
|
133
|
-
|
|
134
|
-
if [ $? -eq 0 ]; then
|
|
135
|
-
exit 0
|
|
136
|
-
fi
|
|
137
|
+
echo "Detected Lobe-Chat update"
|
|
137
138
|
|
|
138
|
-
|
|
139
|
+
# Remove the old container
|
|
140
|
+
echo "Removed: $(docker rm -f Lobe-Chat)"
|
|
139
141
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
+
# Run the new container
|
|
143
|
+
echo "Started: $(docker run -d --network=host --env-file /path/to/lobe.env --name=Lobe-Chat --restart=always lobehub/lobe-chat)"
|
|
142
144
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
+
# Print the update time and version
|
|
146
|
+
echo "Update time: $(date)"
|
|
147
|
+
echo "Version: $(docker inspect lobehub/lobe-chat:latest | grep 'org.opencontainers.image.version' | awk -F'"' '{print $4}')"
|
|
145
148
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
+
# Clean up unused images
|
|
150
|
+
docker images | grep 'lobehub/lobe-chat' | grep -v 'latest' | awk '{print $3}' | xargs -r docker rmi > /dev/null 2>&1
|
|
151
|
+
echo "Removed old images."
|
|
152
|
+
```
|
|
149
153
|
|
|
150
|
-
|
|
151
|
-
docker images | grep 'lobehub/lobe-chat' | grep -v 'latest' | awk '{print $3}' | xargs -r docker rmi > /dev/null 2>&1
|
|
152
|
-
echo "Removed old images."
|
|
153
|
-
```
|
|
154
|
+
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.
|
|
154
155
|
|
|
155
|
-
|
|
156
|
+
Configure Crontab to execute the script every 5 minutes:
|
|
156
157
|
|
|
157
|
-
|
|
158
|
+
```bash
|
|
159
|
+
*/5 * * * * /path/to/auto-update-lobe-chat.sh >> /path/to/auto-update-lobe-chat.log 2>&1
|
|
160
|
+
```
|
|
158
161
|
|
|
159
|
-
```bash
|
|
160
|
-
*/5 * * * * /path/to/auto-update-lobe-chat.sh >> /path/to/auto-update-lobe-chat.log 2>&1
|
|
161
|
-
```
|
|
162
162
|
</Steps>
|
|
163
163
|
|
|
164
164
|
[docker-pulls-link]: https://hub.docker.com/r/lobehub/lobe-chat
|
|
@@ -9,14 +9,16 @@ tags:
|
|
|
9
9
|
- 代理地址
|
|
10
10
|
- 自动更新脚本
|
|
11
11
|
---
|
|
12
|
+
|
|
12
13
|
# Docker 部署指引
|
|
13
14
|
|
|
14
15
|
<div style={{display:"flex", gap: 4}}>
|
|
15
16
|
[![][docker-release-shield]][docker-release-link]
|
|
16
17
|
|
|
17
|
-
|
|
18
|
+
[![][docker-size-shield]][docker-size-link]
|
|
19
|
+
|
|
20
|
+
[![][docker-pulls-shield]][docker-pulls-link]
|
|
18
21
|
|
|
19
|
-
[![][docker-pulls-shield]][docker-pulls-link]
|
|
20
22
|
</div>
|
|
21
23
|
|
|
22
24
|
我们提供了 [Docker 镜像][docker-release-link],供你在自己的私有设备上部署 LobeChat 服务。
|
|
@@ -24,7 +26,7 @@ tags:
|
|
|
24
26
|
<Steps>
|
|
25
27
|
### 安装 Docker 容器环境
|
|
26
28
|
|
|
27
|
-
|
|
29
|
+
(如果已安装,请跳过此步)
|
|
28
30
|
|
|
29
31
|
<Tabs items={['Ubuntu', 'CentOS']}>
|
|
30
32
|
<Tab>
|
|
@@ -38,126 +40,123 @@ tags:
|
|
|
38
40
|
```fish
|
|
39
41
|
$ yum install docker
|
|
40
42
|
```
|
|
41
|
-
|
|
43
|
+
|
|
42
44
|
</Tab>
|
|
43
45
|
|
|
44
46
|
</Tabs>
|
|
45
47
|
|
|
46
|
-
|
|
48
|
+
### Docker 指令部署
|
|
47
49
|
|
|
48
|
-
|
|
50
|
+
使用以下命令即可使用一键启动 LobeChat 服务:
|
|
49
51
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
52
|
+
```fish
|
|
53
|
+
$ docker run -d -p 3210:3210 \
|
|
54
|
+
-e OPENAI_API_KEY=sk-xxxx \
|
|
55
|
+
-e ACCESS_CODE=lobe66 \
|
|
56
|
+
--name lobe-chat \
|
|
57
|
+
lobehub/lobe-chat
|
|
58
|
+
```
|
|
57
59
|
|
|
58
|
-
|
|
60
|
+
指令说明:
|
|
59
61
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
+
- 默认映射端口为 `3210`, 请确保未被占用或手动更改端口映射
|
|
63
|
+
- 使用你的 OpenAI API Key 替换上述命令中的 `sk-xxxx`
|
|
62
64
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
65
|
+
<Callout type={'tip'}>
|
|
66
|
+
LobeChat 支持的完整环境变量列表请参考 [📘 环境变量](/zh/self-hosting/environment-variables) 部分
|
|
66
67
|
</Callout>
|
|
67
68
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
69
|
+
<Callout>
|
|
70
|
+
由于官方的 Docker
|
|
71
|
+
镜像构建大约需要半小时左右,如果在更新部署后会出现「存在更新」的提示,可以等待镜像构建完成后再次部署。
|
|
72
72
|
</Callout>
|
|
73
73
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
74
|
+
<Callout type="warning">
|
|
75
|
+
官方 Docker 镜像中未设定密码,强烈建议添加密码以提升安全性,否则你可能会遇到 [My API Key was
|
|
76
|
+
stolen!!!](https://github.com/lobehub/lobe-chat/issues/1123) 这样的情况
|
|
78
77
|
</Callout>
|
|
79
78
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
79
|
+
<Callout type="important">
|
|
80
|
+
注意,当**部署架构与镜像的不一致时**,需要对 **Sharp** 进行交叉编译,详见 [Sharp
|
|
81
|
+
交叉编译](https://sharp.pixelplumbing.com/install#cross-platform)
|
|
84
82
|
</Callout>
|
|
85
83
|
|
|
86
|
-
|
|
84
|
+
#### 使用代理地址
|
|
85
|
+
|
|
86
|
+
如果你需要通过代理使用 OpenAI 服务,你可以使用 `OPENAI_PROXY_URL` 环境变量来配置代理地址:
|
|
87
87
|
|
|
88
|
-
|
|
88
|
+
```fish
|
|
89
|
+
$ docker run -d -p 3210:3210 \
|
|
90
|
+
-e OPENAI_API_KEY=sk-xxxx \
|
|
91
|
+
-e OPENAI_PROXY_URL=https://api-proxy.com/v1 \
|
|
92
|
+
-e ACCESS_CODE=lobe66 \
|
|
93
|
+
--name lobe-chat \
|
|
94
|
+
lobehub/lobe-chat
|
|
95
|
+
```
|
|
89
96
|
|
|
90
|
-
|
|
91
|
-
$ docker run -d -p 3210:3210 \
|
|
92
|
-
-e OPENAI_API_KEY=sk-xxxx \
|
|
93
|
-
-e OPENAI_PROXY_URL=https://api-proxy.com/v1 \
|
|
94
|
-
-e ACCESS_CODE=lobe66 \
|
|
95
|
-
--name lobe-chat \
|
|
96
|
-
lobehub/lobe-chat
|
|
97
|
-
```
|
|
97
|
+
### Crontab 自动更新脚本(可选)
|
|
98
98
|
|
|
99
|
-
|
|
99
|
+
如果你想自动获得最新的镜像,你可以如下操作。
|
|
100
100
|
|
|
101
|
-
|
|
101
|
+
首先,新建一个 `lobe.env` 配置文件,内容为各种环境变量,例如:
|
|
102
102
|
|
|
103
|
-
|
|
103
|
+
```env
|
|
104
|
+
OPENAI_API_KEY=sk-xxxx
|
|
105
|
+
OPENAI_PROXY_URL=https://api-proxy.com/v1
|
|
106
|
+
ACCESS_CODE=arthals2333
|
|
107
|
+
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
|
|
108
|
+
```
|
|
104
109
|
|
|
105
|
-
|
|
106
|
-
OPENAI_API_KEY=sk-xxxx
|
|
107
|
-
OPENAI_PROXY_URL=https://api-proxy.com/v1
|
|
108
|
-
ACCESS_CODE=arthals2333
|
|
109
|
-
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
|
|
110
|
-
```
|
|
110
|
+
然后,你可以使用以下脚本来自动更新:
|
|
111
111
|
|
|
112
|
-
|
|
112
|
+
```bash
|
|
113
|
+
#!/bin/bash
|
|
114
|
+
# auto-update-lobe-chat.sh
|
|
113
115
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
# auto-update-lobe-chat.sh
|
|
116
|
+
# 设置代理(可选)
|
|
117
|
+
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
|
|
117
118
|
|
|
118
|
-
|
|
119
|
-
|
|
119
|
+
# 拉取最新的镜像并将输出存储在变量中
|
|
120
|
+
output=$(docker pull lobehub/lobe-chat:latest 2>&1)
|
|
120
121
|
|
|
121
|
-
|
|
122
|
-
|
|
122
|
+
# 检查拉取命令是否成功执行
|
|
123
|
+
if [ $? -ne 0 ]; then
|
|
124
|
+
exit 1
|
|
125
|
+
fi
|
|
123
126
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
exit 1
|
|
127
|
-
fi
|
|
127
|
+
# 检查输出中是否包含特定的字符串
|
|
128
|
+
echo "$output" | grep -q "Image is up to date for lobehub/lobe-chat:latest"
|
|
128
129
|
|
|
129
|
-
|
|
130
|
-
|
|
130
|
+
# 如果镜像已经是最新的,则不执行任何操作
|
|
131
|
+
if [ $? -eq 0 ]; then
|
|
132
|
+
exit 0
|
|
133
|
+
fi
|
|
131
134
|
|
|
132
|
-
|
|
133
|
-
if [ $? -eq 0 ]; then
|
|
134
|
-
exit 0
|
|
135
|
-
fi
|
|
135
|
+
echo "Detected Lobe-Chat update"
|
|
136
136
|
|
|
137
|
-
|
|
137
|
+
# 删除旧的容器
|
|
138
|
+
echo "Removed: $(docker rm -f Lobe-Chat)"
|
|
138
139
|
|
|
139
|
-
|
|
140
|
-
|
|
140
|
+
# 运行新的容器
|
|
141
|
+
echo "Started: $(docker run -d --network=host --env-file /path/to/lobe.env --name=Lobe-Chat --restart=always lobehub/lobe-chat)"
|
|
141
142
|
|
|
142
|
-
|
|
143
|
-
|
|
143
|
+
# 打印更新的时间和版本
|
|
144
|
+
echo "Update time: $(date)"
|
|
145
|
+
echo "Version: $(docker inspect lobehub/lobe-chat:latest | grep 'org.opencontainers.image.version' | awk -F'"' '{print $4}')"
|
|
144
146
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
147
|
+
# 清理不再使用的镜像
|
|
148
|
+
docker images | grep 'lobehub/lobe-chat' | grep -v 'latest' | awk '{print $3}' | xargs -r docker rmi > /dev/null 2>&1
|
|
149
|
+
echo "Removed old images."
|
|
150
|
+
```
|
|
148
151
|
|
|
149
|
-
|
|
150
|
-
docker images | grep 'lobehub/lobe-chat' | grep -v 'latest' | awk '{print $3}' | xargs -r docker rmi > /dev/null 2>&1
|
|
151
|
-
echo "Removed old images."
|
|
152
|
-
```
|
|
152
|
+
此脚本可以在 Crontab 中使用,但请确认你的 Crontab 可以找到正确的 Docker 命令。建议使用绝对路径。
|
|
153
153
|
|
|
154
|
-
|
|
154
|
+
配置 Crontab,每 5 分钟执行一次脚本:
|
|
155
155
|
|
|
156
|
-
|
|
156
|
+
```bash
|
|
157
|
+
*/5 * * * * /path/to/auto-update-lobe-chat.sh >> /path/to/auto-update-lobe-chat.log 2>&1
|
|
158
|
+
```
|
|
157
159
|
|
|
158
|
-
```bash
|
|
159
|
-
*/5 * * * * /path/to/auto-update-lobe-chat.sh >> /path/to/auto-update-lobe-chat.log 2>&1
|
|
160
|
-
```
|
|
161
160
|
</Steps>
|
|
162
161
|
|
|
163
162
|
[docker-pulls-link]: https://hub.docker.com/r/lobehub/lobe-chat
|
|
@@ -12,6 +12,7 @@ tags:
|
|
|
12
12
|
- Environment Variables
|
|
13
13
|
- Custom Domain Setup
|
|
14
14
|
---
|
|
15
|
+
|
|
15
16
|
# Deploy LobeChat with Netlify
|
|
16
17
|
|
|
17
18
|
If you want to deploy LobeChat on Netlify, you can follow these steps:
|
|
@@ -21,81 +22,129 @@ If you want to deploy LobeChat on Netlify, you can follow these steps:
|
|
|
21
22
|
<Steps>
|
|
22
23
|
### Fork the LobeChat Repository
|
|
23
24
|
|
|
24
|
-
|
|
25
|
+
Click the Fork button to fork the LobeChat repository to your GitHub account.
|
|
25
26
|
|
|
26
|
-
|
|
27
|
+
### Prepare your OpenAI API Key
|
|
27
28
|
|
|
28
|
-
|
|
29
|
+
Go to [OpenAI API Key](https://platform.openai.com/account/api-keys) to obtain your OpenAI API Key.
|
|
29
30
|
|
|
30
|
-
|
|
31
|
+
### Import to Netlify Workspace
|
|
31
32
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
<Callout>
|
|
34
|
+
After testing, it is currently not supported to have a one-click deployment button similar to
|
|
35
|
+
Vercel/Zeabur. The reason is unknown. Therefore, manual import is required.
|
|
36
36
|
</Callout>
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
Click "Import from git"
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
<Image
|
|
41
|
+
alt={'Click "Import from git" in the Netlify workspace'}
|
|
42
|
+
height={362}
|
|
43
|
+
inStep
|
|
44
|
+
src={'https://github.com/lobehub/lobe-chat/assets/28616219/31b999e5-2a74-45fc-935b-f036e72a684d'}
|
|
45
|
+
/>
|
|
41
46
|
|
|
42
|
-
|
|
47
|
+
Then click "Deploy with Github" and authorize Netlify to access your GitHub account.
|
|
43
48
|
|
|
44
|
-
|
|
49
|
+
<Image
|
|
50
|
+
alt={'Authorize Netlify to access your GitHub account'}
|
|
51
|
+
height={273}
|
|
52
|
+
inStep
|
|
53
|
+
src={'https://github.com/lobehub/lobe-chat/assets/28616219/c9c58141-5ec6-43f1-8d97-0a84a04dcdba'}
|
|
54
|
+
/>
|
|
45
55
|
|
|
46
|
-
|
|
56
|
+
Next, select the LobeChat project:
|
|
47
57
|
|
|
48
|
-
|
|
58
|
+
<Image
|
|
59
|
+
alt={'Select the LobeChat github project'}
|
|
60
|
+
height={228}
|
|
61
|
+
inStep
|
|
62
|
+
src={'https://github.com/lobehub/lobe-chat/assets/28616219/6c3968a8-fbbb-4268-a587-edaced2d96af'}
|
|
63
|
+
/>
|
|
49
64
|
|
|
50
|
-
|
|
65
|
+
### Configure Site Name and Environment Variables
|
|
51
66
|
|
|
52
|
-
|
|
67
|
+
In this step, you need to configure your site, including the site name, build command, and publish directory. Fill in your site name in the "Site Name" field. If there are no special requirements, you do not need to modify the remaining configurations as we have already set the default configurations.
|
|
53
68
|
|
|
54
|
-
|
|
69
|
+
<Image
|
|
70
|
+
alt={'Configure LobeChat site name'}
|
|
71
|
+
height={712}
|
|
72
|
+
inStep
|
|
73
|
+
src={'https://github.com/lobehub/lobe-chat/assets/28616219/f3885537-6d43-422f-b1b8-e70732401025'}
|
|
74
|
+
/>
|
|
55
75
|
|
|
56
|
-
|
|
76
|
+
Click the "Add environment variables" button to add site environment variables:
|
|
57
77
|
|
|
58
|
-
|
|
78
|
+
<Image
|
|
79
|
+
alt={'Add LobeChat site environment variables'}
|
|
80
|
+
height={537}
|
|
81
|
+
inStep
|
|
82
|
+
src={'https://github.com/lobehub/lobe-chat/assets/28616219/3b607482-4d99-455a-bc10-3090dd4fe3c5'}
|
|
83
|
+
/>
|
|
59
84
|
|
|
60
|
-
|
|
85
|
+
Taking OpenAI as an example, the environment variables you need to add are as follows:
|
|
61
86
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
87
|
+
| Environment Variable | Type | Description | Example |
|
|
88
|
+
| --- | --- | --- | --- |
|
|
89
|
+
| `OPENAI_API_KEY` | Required | This is the API key you applied for on the OpenAI account page | `sk-xxxxxx...xxxxxx` |
|
|
90
|
+
| `ACCESS_CODE` | Required | 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` |
|
|
91
|
+
| `OPENAI_PROXY_URL` | Optional | If you manually configure the OpenAI interface proxy, you can use this configuration to override the default OpenAI API request base URL | `https://aihubmix.com/v1`, default value: `https://api.openai.com/v1` |
|
|
67
92
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
93
|
+
<Callout type={'tip'}>
|
|
94
|
+
For a complete list of environment variables supported by LobeChat, please refer to the [📘
|
|
95
|
+
Environment Variables](/en/self-hosting/environment-variables)
|
|
72
96
|
</Callout>
|
|
73
97
|
|
|
74
|
-
|
|
98
|
+
Afteradding the variables, finally click "Deploy lobe-chat" to enter the deployment phase
|
|
75
99
|
|
|
76
|
-
|
|
100
|
+
<Image
|
|
101
|
+
alt={'Environment variables added'}
|
|
102
|
+
height={600}
|
|
103
|
+
inStep
|
|
104
|
+
src={'https://github.com/lobehub/lobe-chat/assets/28616219/c9f74ec4-ce63-4ce9-b9e2-34bda6fda10b'}
|
|
105
|
+
/>
|
|
77
106
|
|
|
78
|
-
|
|
107
|
+
### Wait for Deployment to Complete
|
|
79
108
|
|
|
80
|
-
|
|
109
|
+
After clicking deploy, you will enter the site details page, where you can click the "Deploying your site" in blue or the "Building" in yellow to view the deployment progress.
|
|
81
110
|
|
|
82
|
-
|
|
111
|
+
<Image
|
|
112
|
+
alt={'Netlify site details page'}
|
|
113
|
+
height={396}
|
|
114
|
+
inStep
|
|
115
|
+
src={'https://github.com/lobehub/lobe-chat/assets/28616219/a7fd85d5-fd32-4756-814e-ff7ab7567fe1'}
|
|
116
|
+
/>
|
|
83
117
|
|
|
84
|
-
|
|
118
|
+
Upon entering the deployment details, you will see the following interface, indicating that your LobeChat is currently being deployed. Simply wait for the deployment to complete.
|
|
85
119
|
|
|
86
|
-
|
|
120
|
+
<Image
|
|
121
|
+
alt={'LobeChat deployment in progress'}
|
|
122
|
+
height={325}
|
|
123
|
+
inStep
|
|
124
|
+
src={'https://github.com/lobehub/lobe-chat/assets/28616219/1ed8b13d-046e-47c8-bd61-116ffdf5d01b'}
|
|
125
|
+
/>
|
|
87
126
|
|
|
88
|
-
|
|
127
|
+
During the deployment and build process:
|
|
89
128
|
|
|
90
|
-
|
|
129
|
+
<Image
|
|
130
|
+
alt={'Deployment in progress'}
|
|
131
|
+
height={558}
|
|
132
|
+
inStep
|
|
133
|
+
src={'https://github.com/lobehub/lobe-chat/assets/28616219/1c82d707-cb6f-4924-b246-a5235a919864'}
|
|
134
|
+
/>
|
|
91
135
|
|
|
92
|
-
|
|
136
|
+
### Deployment Successful, Start Using
|
|
93
137
|
|
|
94
|
-
|
|
138
|
+
If your Deploy Log in the interface looks like the following, it means your LobeChat has been successfully deployed.
|
|
95
139
|
|
|
96
|
-
|
|
140
|
+
<Image
|
|
141
|
+
alt={'Deployment Successful'}
|
|
142
|
+
height={558}
|
|
143
|
+
inStep
|
|
144
|
+
src={'https://github.com/lobehub/lobe-chat/assets/28616219/c1f945d1-f3e2-4100-b6bb-24d4cb13c438'}
|
|
145
|
+
/>
|
|
97
146
|
|
|
98
|
-
|
|
147
|
+
At this point, you can click on "Open production deploy" to access your LobeChat site.
|
|
99
148
|
|
|
100
149
|
<Image alt={'Access Your LobeChat Site'} height={527} inStep src={'https://github.com/lobehub/lobe-chat/assets/28616219/b04723eb-64ad-4028-a901-dc4e4ee2d0c1'} />
|
|
101
150
|
</Steps>
|