@lobehub/chat 0.122.1 → 0.122.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/CHANGELOG.md +50 -0
- package/README.md +8 -8
- package/README.zh-CN.md +8 -8
- package/docs/Deployment/Docker-Deployment.md +118 -0
- package/docs/Deployment/Docker-Deployment.zh-CN.md +118 -0
- package/package.json +1 -4
- package/src/app/api/config/route.ts +3 -1
- package/src/app/chat/(mobile)/features/SessionHeader.tsx +2 -1
- package/src/app/chat/features/ChatHeader/ShareButton/ShareModal.tsx +2 -1
- package/src/app/chat/features/TopicListContent/Topic/TopicContent.tsx +2 -1
- package/src/app/chat/settings/features/SubmitAgentButton/SubmitAgentModal.tsx +2 -1
- package/src/app/settings/(mobile)/mobile/index.tsx +2 -1
- package/src/app/settings/common/Common.tsx +14 -3
- package/src/app/settings/features/ThemeSwatches/ThemeSwatchesNeutral.tsx +2 -1
- package/src/app/settings/features/ThemeSwatches/ThemeSwatchesPrimary.tsx +2 -1
- package/src/app/settings/llm/LLM/index.tsx +17 -10
- package/src/const/settings.ts +0 -1
- package/src/database/core/db.ts +41 -2
- package/src/database/core/migrations/migrateSettingsToUser/fixtures/input.json +55 -0
- package/src/database/core/migrations/migrateSettingsToUser/fixtures/output.json +60 -0
- package/src/database/core/migrations/migrateSettingsToUser/index.test.ts +13 -0
- package/src/database/core/migrations/migrateSettingsToUser/index.ts +39 -0
- package/src/database/core/schemas.ts +10 -0
- package/src/database/models/user.ts +54 -0
- package/src/database/schemas/user.ts +57 -0
- package/src/features/AgentSetting/AgentConfig/index.tsx +2 -2
- package/src/features/AvatarWithUpload/index.tsx +6 -2
- package/src/features/ChatInput/ActionBar/ModelSwitch.tsx +2 -2
- package/src/features/Conversation/Error/ApiKeyForm.tsx +3 -3
- package/src/features/Conversation/Error/InvalidAccess.tsx +5 -1
- package/src/features/Conversation/Extras/Translate.tsx +3 -4
- package/src/layout/GlobalLayout/AppTheme.tsx +4 -3
- package/src/layout/GlobalLayout/Locale.tsx +2 -1
- package/src/layout/GlobalLayout/StoreHydration.tsx +7 -2
- package/src/services/_header.ts +3 -2
- package/src/services/user.ts +31 -0
- package/src/store/chat/slices/message/selectors.test.ts +7 -2
- package/src/store/chat/slices/message/selectors.ts +2 -1
- package/src/store/global/hooks/index.ts +0 -1
- package/src/store/global/initialState.ts +3 -1
- package/src/store/global/selectors.ts +1 -0
- package/src/store/global/slices/common/action.test.ts +2 -79
- package/src/store/global/slices/common/action.ts +37 -61
- package/src/store/global/slices/common/initialState.ts +0 -34
- package/src/store/global/slices/common/selectors.ts +2 -7
- package/src/store/global/slices/preference/action.test.ts +92 -0
- package/src/store/global/slices/preference/action.ts +75 -0
- package/src/store/global/slices/preference/initialState.ts +45 -0
- package/src/store/global/slices/preference/selectors.ts +10 -0
- package/src/store/global/slices/settings/action.test.ts +68 -39
- package/src/store/global/slices/settings/action.ts +26 -50
- package/src/store/global/slices/settings/initialState.ts +8 -6
- package/src/store/global/slices/settings/selectors/__snapshots__/modelProvider.test.ts.snap +100 -0
- package/src/store/global/slices/settings/selectors/__snapshots__/selectors.test.ts.snap +132 -0
- package/src/store/global/slices/settings/selectors/index.ts +2 -0
- package/src/store/global/slices/settings/selectors/modelProvider.test.ts +100 -0
- package/src/store/global/slices/settings/selectors/modelProvider.ts +64 -0
- package/src/store/global/slices/settings/{selectors.test.ts → selectors/selectors.test.ts} +2 -97
- package/src/store/global/slices/settings/selectors/settings.ts +58 -0
- package/src/store/global/store.ts +11 -36
- package/src/store/session/slices/agent/action.ts +1 -1
- package/src/types/settings/base.ts +13 -0
- package/src/types/settings/index.ts +34 -0
- package/src/types/settings/modelProvider.ts +17 -0
- package/src/types/settings/tts.ts +10 -0
- package/src/utils/difference.ts +12 -0
- package/tests/utils.tsx +8 -0
- package/tsconfig.json +9 -8
- package/vitest.config.ts +1 -0
- package/src/store/global/hooks/useHydrated.ts +0 -18
- package/src/store/global/slices/settings/selectors.ts +0 -105
- package/src/types/settings.ts +0 -68
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,56 @@
|
|
|
2
2
|
|
|
3
3
|
# Changelog
|
|
4
4
|
|
|
5
|
+
### [Version 0.122.3](https://github.com/lobehub/lobe-chat/compare/v0.122.2...v0.122.3)
|
|
6
|
+
|
|
7
|
+
<sup>Released on **2024-01-30**</sup>
|
|
8
|
+
|
|
9
|
+
#### ♻ Code Refactoring
|
|
10
|
+
|
|
11
|
+
- **misc**: Refactor the setting storage from localStorage to indexedDB.
|
|
12
|
+
|
|
13
|
+
<br/>
|
|
14
|
+
|
|
15
|
+
<details>
|
|
16
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
|
17
|
+
|
|
18
|
+
#### Code refactoring
|
|
19
|
+
|
|
20
|
+
- **misc**: Refactor the setting storage from localStorage to indexedDB, closes [#1180](https://github.com/lobehub/lobe-chat/issues/1180) ([615e796](https://github.com/lobehub/lobe-chat/commit/615e796))
|
|
21
|
+
|
|
22
|
+
</details>
|
|
23
|
+
|
|
24
|
+
<div align="right">
|
|
25
|
+
|
|
26
|
+
[](#readme-top)
|
|
27
|
+
|
|
28
|
+
</div>
|
|
29
|
+
|
|
30
|
+
### [Version 0.122.2](https://github.com/lobehub/lobe-chat/compare/v0.122.1...v0.122.2)
|
|
31
|
+
|
|
32
|
+
<sup>Released on **2024-01-30**</sup>
|
|
33
|
+
|
|
34
|
+
#### 🐛 Bug Fixes
|
|
35
|
+
|
|
36
|
+
- **misc**: Fix unexpected topic switch when favoriting topic.
|
|
37
|
+
|
|
38
|
+
<br/>
|
|
39
|
+
|
|
40
|
+
<details>
|
|
41
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
|
42
|
+
|
|
43
|
+
#### What's fixed
|
|
44
|
+
|
|
45
|
+
- **misc**: Fix unexpected topic switch when favoriting topic, closes [#1186](https://github.com/lobehub/lobe-chat/issues/1186) ([ab4de13](https://github.com/lobehub/lobe-chat/commit/ab4de13))
|
|
46
|
+
|
|
47
|
+
</details>
|
|
48
|
+
|
|
49
|
+
<div align="right">
|
|
50
|
+
|
|
51
|
+
[](#readme-top)
|
|
52
|
+
|
|
53
|
+
</div>
|
|
54
|
+
|
|
5
55
|
### [Version 0.122.1](https://github.com/lobehub/lobe-chat/compare/v0.122.0...v0.122.1)
|
|
6
56
|
|
|
7
57
|
<sup>Released on **2024-01-29**</sup>
|
package/README.md
CHANGED
|
@@ -225,14 +225,14 @@ Our marketplace is not just a showcase platform but also a collaborative space.
|
|
|
225
225
|
|
|
226
226
|
<!-- AGENT LIST -->
|
|
227
227
|
|
|
228
|
-
| Recent Submits
|
|
229
|
-
|
|
|
230
|
-
| [
|
|
231
|
-
| [
|
|
232
|
-
| [
|
|
233
|
-
| [
|
|
234
|
-
|
|
235
|
-
> 📊 Total agents: [<kbd>**
|
|
228
|
+
| Recent Submits | Description |
|
|
229
|
+
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
230
|
+
| [English Proficiency Coach](https://chat-preview.lobehub.com/market?agent=english-c-2-level)<br/><sup>By **[MYSeaIT](https://github.com/MYSeaIT)** on **2024-01-30**</sup> | C2 Level English Conversation Partner<br/>`english-proficiency` `conversation-partner` `language-coaching` |
|
|
231
|
+
| [Entrepreneurship and Competitiveness Expert](https://chat-preview.lobehub.com/market?agent=entrepreneurship-and-competitiveness-expert)<br/><sup>By **[MYSeaIT](https://github.com/MYSeaIT)** on **2024-01-30**</sup> | Entrepreneurship and Competitiveness Expert: Guiding individuals to entrepreneurial success and market competitiveness.<br/>`entrepreneurship` `competitiveness` `consulting` `mentoring` `advising` |
|
|
232
|
+
| [Mathematical Research Advisor](https://chat-preview.lobehub.com/market?agent=mathematical-research-advisor)<br/><sup>By **[MYSeaIT](https://github.com/MYSeaIT)** on **2024-01-30**</sup> | Math Research Assistant: Assisting with mathematical research, problem-solving, and providing guidance in a wide range of mathematical concepts and techniques.<br/>`mathematics` `research` `assistance` `problem-solving` `communication` |
|
|
233
|
+
| [Territory Promotion Strategist](https://chat-preview.lobehub.com/market?agent=biskaya)<br/><sup>By **[MYSeaIT](https://github.com/MYSeaIT)** on **2024-01-29**</sup> | Territorial Competitiveness and Promotion Expert<br/>`territorial-competitiveness` `promotion` `consulting` `marketing` `event-coordination` |
|
|
234
|
+
|
|
235
|
+
> 📊 Total agents: [<kbd>**142**</kbd> ](https://github.com/lobehub/lobe-chat-agents)
|
|
236
236
|
|
|
237
237
|
<!-- AGENT LIST -->
|
|
238
238
|
|
package/README.zh-CN.md
CHANGED
|
@@ -205,14 +205,14 @@ LobeChat 的插件生态系统是其核心功能的重要扩展,它极大地
|
|
|
205
205
|
|
|
206
206
|
<!-- AGENT LIST -->
|
|
207
207
|
|
|
208
|
-
| 最近新增
|
|
209
|
-
|
|
|
210
|
-
| [
|
|
211
|
-
| [
|
|
212
|
-
| [
|
|
213
|
-
| [
|
|
214
|
-
|
|
215
|
-
> 📊 Total agents: [<kbd>**
|
|
208
|
+
| 最近新增 | 助手说明 |
|
|
209
|
+
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
|
|
210
|
+
| [英语熟练度教练](https://chat-preview.lobehub.com/market?agent=english-c-2-level)<br/><sup>By **[MYSeaIT](https://github.com/MYSeaIT)** on **2024-01-30**</sup> | C2 级别英语会话伙伴<br/>`英语熟练度` `会话伙伴` `语言辅导` |
|
|
211
|
+
| [创业和竞争力专家](https://chat-preview.lobehub.com/market?agent=entrepreneurship-and-competitiveness-expert)<br/><sup>By **[MYSeaIT](https://github.com/MYSeaIT)** on **2024-01-30**</sup> | 创业和竞争力专家:指导个人实现创业成功和市场竞争力。<br/>`创业` `竞争力` `咨询` `指导` `建议` |
|
|
212
|
+
| [数学研究顾问](https://chat-preview.lobehub.com/market?agent=mathematical-research-advisor)<br/><sup>By **[MYSeaIT](https://github.com/MYSeaIT)** on **2024-01-30**</sup> | 数学研究助理:协助进行数学研究、解决问题,并在各种数学概念和技术方面提供指导。<br/>`数学` `研究` `协助` `问题解决` `沟通` |
|
|
213
|
+
| [领土推广策略师](https://chat-preview.lobehub.com/market?agent=biskaya)<br/><sup>By **[MYSeaIT](https://github.com/MYSeaIT)** on **2024-01-29**</sup> | 领土竞争力和推广专家<br/>`territorial-competitiveness` `promotion` `consulting` `marketing` `event-coordination` |
|
|
214
|
+
|
|
215
|
+
> 📊 Total agents: [<kbd>**142**</kbd> ](https://github.com/lobehub/lobe-chat-agents)
|
|
216
216
|
|
|
217
217
|
<!-- AGENT LIST -->
|
|
218
218
|
|
|
@@ -71,6 +71,69 @@ $ docker run -d -p 3210:3210 \
|
|
|
71
71
|
>
|
|
72
72
|
> As the official Docker image build takes about half an hour, if there is a "update available" prompt after updating deployment, wait for the image to finish building before deploying again.
|
|
73
73
|
|
|
74
|
+
#### Crontab Auto-Update Script
|
|
75
|
+
|
|
76
|
+
If you want to automatically get the latest images, you can do the following.
|
|
77
|
+
|
|
78
|
+
First, create a `lobe.env` configuration file with various environment variables, for example:
|
|
79
|
+
|
|
80
|
+
```env
|
|
81
|
+
OPENAI_API_KEY=sk-xxxx
|
|
82
|
+
OPENAI_PROXY_URL=https://api-proxy.com/v1
|
|
83
|
+
ACCESS_CODE=arthals2333
|
|
84
|
+
CUSTOM_MODELS=-gpt-4,-gpt-4-32k,-gpt-3.5-turbo-16k,gpt-3.5-turbo-1106=gpt-3.5-turbo-16k,gpt-4-1106-preview=gpt-4-turbo,gpt-4-vision-preview=gpt-4-vision
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Then, you can use the following script to automatically update:
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
#!/bin/bash
|
|
91
|
+
# auto-update-lobe-chat.sh
|
|
92
|
+
|
|
93
|
+
# Set proxy (optional)
|
|
94
|
+
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
|
|
95
|
+
|
|
96
|
+
# Pull the latest image and store the output in a variable
|
|
97
|
+
output=$(docker pull lobehub/lobe-chat:latest 2>&1)
|
|
98
|
+
|
|
99
|
+
# Check if the pull command executed successfully
|
|
100
|
+
if [ $? -ne 0 ]; then
|
|
101
|
+
exit 1
|
|
102
|
+
fi
|
|
103
|
+
|
|
104
|
+
# Check if the output contains a specific string
|
|
105
|
+
echo "$output" | grep -q "Image is up to date for lobehub/lobe-chat:latest"
|
|
106
|
+
|
|
107
|
+
# If the image is already up to date, then do nothing
|
|
108
|
+
if [ $? -eq 0 ]; then
|
|
109
|
+
exit 0
|
|
110
|
+
fi
|
|
111
|
+
|
|
112
|
+
echo "Detected Lobe-Chat update"
|
|
113
|
+
|
|
114
|
+
# Remove old container
|
|
115
|
+
echo "Removed: $(docker rm -f Lobe-Chat)"
|
|
116
|
+
|
|
117
|
+
# Run new container
|
|
118
|
+
echo "Started: $(docker run -d --network=host --env-file /path/to/lobe.env --name=Lobe-Chat --restart=always lobehub/lobe-chat)"
|
|
119
|
+
|
|
120
|
+
# Print the update time and version
|
|
121
|
+
echo "Update time: $(date)"
|
|
122
|
+
echo "Version: $(docker inspect lobehub/lobe-chat:latest | grep 'org.opencontainers.image.version' | awk -F'"' '{print $4}')"
|
|
123
|
+
|
|
124
|
+
# Clean up unused images
|
|
125
|
+
docker images | grep 'lobehub/lobe-chat' | grep -v 'latest' | awk '{print $3}' | xargs -r docker rmi > /dev/null 2>&1
|
|
126
|
+
echo "Removed old images."
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
This script can be used in Crontab, but make sure your Crontab can find the correct Docker command. It's recommended to use absolute paths.
|
|
130
|
+
|
|
131
|
+
Configure Crontab to execute the script every 5 minutes:
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
*/5 * * * * /path/to/auto-update-lobe-chat.sh >> /path/to/auto-update-lobe-chat.log 2>&1
|
|
135
|
+
```
|
|
136
|
+
|
|
74
137
|
### `B` Docker Compose
|
|
75
138
|
|
|
76
139
|
The configuration file for using `docker-compose` is as follows:
|
|
@@ -91,6 +154,61 @@ services:
|
|
|
91
154
|
ACCESS_CODE: lobe66
|
|
92
155
|
```
|
|
93
156
|
|
|
157
|
+
#### Crontab Auto-Update Script
|
|
158
|
+
|
|
159
|
+
Similarly, you can use the following script to update Lobe Chat automatically. When using `Docker Compose`, environment variables do not need additional configuration.
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
#!/bin/bash
|
|
163
|
+
# auto-update-lobe-chat.sh
|
|
164
|
+
|
|
165
|
+
# Set proxy (optional)
|
|
166
|
+
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
|
|
167
|
+
|
|
168
|
+
# Pull the latest image and store the output in a variable
|
|
169
|
+
output=$(docker pull lobehub/lobe-chat:latest 2>&1)
|
|
170
|
+
|
|
171
|
+
# Check if the pull command executed successfully
|
|
172
|
+
if [ $? -ne 0 ]; then
|
|
173
|
+
exit 1
|
|
174
|
+
fi
|
|
175
|
+
|
|
176
|
+
# Check if the output contains a specific string
|
|
177
|
+
echo "$output" | grep -q "Image is up to date for lobehub/lobe-chat:latest"
|
|
178
|
+
|
|
179
|
+
# If the image is already up to date, then do nothing
|
|
180
|
+
if [ $? -eq 0 ]; then
|
|
181
|
+
exit 0
|
|
182
|
+
fi
|
|
183
|
+
|
|
184
|
+
echo "Detected Lobe-Chat update"
|
|
185
|
+
|
|
186
|
+
# Remove old container
|
|
187
|
+
echo "Removed: $(docker rm -f Lobe-Chat)"
|
|
188
|
+
|
|
189
|
+
# Maybe you need to enter the directory where `docker-compose.yml` is located first
|
|
190
|
+
# cd /path/to/docker-compose-folder
|
|
191
|
+
|
|
192
|
+
# Run new container
|
|
193
|
+
echo "Started: $(docker-compose up)"
|
|
194
|
+
|
|
195
|
+
# Print the update time and version
|
|
196
|
+
echo "Update time: $(date)"
|
|
197
|
+
echo "Version: $(docker inspect lobehub/lobe-chat:latest | grep 'org.opencontainers.image.version' | awk -F'"' '{print $4}')"
|
|
198
|
+
|
|
199
|
+
# Clean up unused images
|
|
200
|
+
docker images | grep 'lobehub/lobe-chat' | grep -v 'latest' | awk '{print $3}' | xargs -r docker rmi > /dev/null 2>&1
|
|
201
|
+
echo "Removed old images."
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
This script can also be used in Crontab, but make sure your Crontab can find the correct Docker command. It's recommended to use absolute paths.
|
|
205
|
+
|
|
206
|
+
Configure Crontab to execute the script every 5 minutes:
|
|
207
|
+
|
|
208
|
+
```bash
|
|
209
|
+
*/5 * * * * /path/to/auto-update-lobe-chat.sh >> /path/to/auto-update-lobe-chat.log 2>&1
|
|
210
|
+
```
|
|
211
|
+
|
|
94
212
|
<!-- LINK GROUP -->
|
|
95
213
|
|
|
96
214
|
[docker-pulls-link]: https://hub.docker.com/r/lobehub/lobe-chat
|
|
@@ -71,6 +71,69 @@ $ docker run -d -p 3210:3210 \
|
|
|
71
71
|
>
|
|
72
72
|
> 由于官方的 Docker 镜像构建大约需要半小时左右,如果在更新部署后会出现「存在更新」的提示,可以等待镜像构建完成后再次部署。
|
|
73
73
|
|
|
74
|
+
#### Crontab 自动更新脚本
|
|
75
|
+
|
|
76
|
+
如果你想自动获得最新的镜像,你可以如下操作。
|
|
77
|
+
|
|
78
|
+
首先,新建一个 `lobe.env` 配置文件,内容为各种环境变量,例如:
|
|
79
|
+
|
|
80
|
+
```env
|
|
81
|
+
OPENAI_API_KEY=sk-xxxx
|
|
82
|
+
OPENAI_PROXY_URL=https://api-proxy.com/v1
|
|
83
|
+
ACCESS_CODE=arthals2333
|
|
84
|
+
CUSTOM_MODELS=-gpt-4,-gpt-4-32k,-gpt-3.5-turbo-16k,gpt-3.5-turbo-1106=gpt-3.5-turbo-16k,gpt-4-1106-preview=gpt-4-turbo,gpt-4-vision-preview=gpt-4-vision
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
然后,你可以使用以下脚本来自动更新:
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
#!/bin/bash
|
|
91
|
+
# auto-update-lobe-chat.sh
|
|
92
|
+
|
|
93
|
+
# 设置代理(可选)
|
|
94
|
+
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
|
|
95
|
+
|
|
96
|
+
# 拉取最新的镜像并将输出存储在变量中
|
|
97
|
+
output=$(docker pull lobehub/lobe-chat:latest 2>&1)
|
|
98
|
+
|
|
99
|
+
# 检查拉取命令是否成功执行
|
|
100
|
+
if [ $? -ne 0 ]; then
|
|
101
|
+
exit 1
|
|
102
|
+
fi
|
|
103
|
+
|
|
104
|
+
# 检查输出中是否包含特定的字符串
|
|
105
|
+
echo "$output" | grep -q "Image is up to date for lobehub/lobe-chat:latest"
|
|
106
|
+
|
|
107
|
+
# 如果镜像已经是最新的,则不执行任何操作
|
|
108
|
+
if [ $? -eq 0 ]; then
|
|
109
|
+
exit 0
|
|
110
|
+
fi
|
|
111
|
+
|
|
112
|
+
echo "Detected Lobe-Chat update"
|
|
113
|
+
|
|
114
|
+
# 删除旧的容器
|
|
115
|
+
echo "Removed: $(docker rm -f Lobe-Chat)"
|
|
116
|
+
|
|
117
|
+
# 运行新的容器
|
|
118
|
+
echo "Started: $(docker run -d --network=host --env-file /path/to/lobe.env --name=Lobe-Chat --restart=always lobehub/lobe-chat)"
|
|
119
|
+
|
|
120
|
+
# 打印更新的时间和版本
|
|
121
|
+
echo "Update time: $(date)"
|
|
122
|
+
echo "Version: $(docker inspect lobehub/lobe-chat:latest | grep 'org.opencontainers.image.version' | awk -F'"' '{print $4}')"
|
|
123
|
+
|
|
124
|
+
# 清理不再使用的镜像
|
|
125
|
+
docker images | grep 'lobehub/lobe-chat' | grep -v 'latest' | awk '{print $3}' | xargs -r docker rmi > /dev/null 2>&1
|
|
126
|
+
echo "Removed old images."
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
此脚本可以在 Crontab 中使用,但请确认你的 Crontab 可以找到正确的 Docker 命令。建议使用绝对路径。
|
|
130
|
+
|
|
131
|
+
配置 Crontab,每 5 分钟执行一次脚本:
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
*/5 * * * * /path/to/auto-update-lobe-chat.sh >> /path/to/auto-update-lobe-chat.log 2>&1
|
|
135
|
+
```
|
|
136
|
+
|
|
74
137
|
### `B` Docker Compose
|
|
75
138
|
|
|
76
139
|
使用 `docker-compose` 时配置文件如下:
|
|
@@ -91,6 +154,61 @@ services:
|
|
|
91
154
|
ACCESS_CODE: lobe66
|
|
92
155
|
```
|
|
93
156
|
|
|
157
|
+
#### Crontab 自动更新脚本
|
|
158
|
+
|
|
159
|
+
类似地,你可以使用以下脚本来自动更新 Lobe Chat,使用 `Docker Compose` 时,环境变量无需额外配置。
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
#!/bin/bash
|
|
163
|
+
# auto-update-lobe-chat.sh
|
|
164
|
+
|
|
165
|
+
# 设置代理(可选)
|
|
166
|
+
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
|
|
167
|
+
|
|
168
|
+
# 拉取最新的镜像并将输出存储在变量中
|
|
169
|
+
output=$(docker pull lobehub/lobe-chat:latest 2>&1)
|
|
170
|
+
|
|
171
|
+
# 检查拉取命令是否成功执行
|
|
172
|
+
if [ $? -ne 0 ]; then
|
|
173
|
+
exit 1
|
|
174
|
+
fi
|
|
175
|
+
|
|
176
|
+
# 检查输出中是否包含特定的字符串
|
|
177
|
+
echo "$output" | grep -q "Image is up to date for lobehub/lobe-chat:latest"
|
|
178
|
+
|
|
179
|
+
# 如果镜像已经是最新的,则不执行任何操作
|
|
180
|
+
if [ $? -eq 0 ]; then
|
|
181
|
+
exit 0
|
|
182
|
+
fi
|
|
183
|
+
|
|
184
|
+
echo "Detected Lobe-Chat update"
|
|
185
|
+
|
|
186
|
+
# 删除旧的容器
|
|
187
|
+
echo "Removed: $(docker rm -f Lobe-Chat)"
|
|
188
|
+
|
|
189
|
+
# 也许需要先进入 `docker-compose.yml` 所在的目录
|
|
190
|
+
# cd /path/to/docker-compose-folder
|
|
191
|
+
|
|
192
|
+
# 运行新的容器
|
|
193
|
+
echo "Started: $(docker-compose up)"
|
|
194
|
+
|
|
195
|
+
# 打印更新的时间和版本
|
|
196
|
+
echo "Update time: $(date)"
|
|
197
|
+
echo "Version: $(docker inspect lobehub/lobe-chat:latest | grep 'org.opencontainers.image.version' | awk -F'"' '{print $4}')"
|
|
198
|
+
|
|
199
|
+
# 清理不再使用的镜像
|
|
200
|
+
docker images | grep 'lobehub/lobe-chat' | grep -v 'latest' | awk '{print $3}' | xargs -r docker rmi > /dev/null 2>&1
|
|
201
|
+
echo "Removed old images."
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
此脚本亦可以在 Crontab 中使用,但请确认你的 Crontab 可以找到正确的 Docker 命令。建议使用绝对路径。
|
|
205
|
+
|
|
206
|
+
配置 Crontab,每 5 分钟执行一次脚本:
|
|
207
|
+
|
|
208
|
+
```bash
|
|
209
|
+
*/5 * * * * /path/to/auto-update-lobe-chat.sh >> /path/to/auto-update-lobe-chat.log 2>&1
|
|
210
|
+
```
|
|
211
|
+
|
|
94
212
|
[docker-pulls-link]: https://hub.docker.com/r/lobehub/lobe-chat
|
|
95
213
|
[docker-pulls-shield]: https://img.shields.io/docker/pulls/lobehub/lobe-chat?color=45cc11&labelColor=black&style=flat-square
|
|
96
214
|
[docker-release-link]: https://hub.docker.com/r/lobehub/lobe-chat
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lobehub/chat",
|
|
3
|
-
"version": "0.122.
|
|
3
|
+
"version": "0.122.3",
|
|
4
4
|
"description": "Lobe Chat - an open-source, high-performance chatbot framework that supports speech synthesis, multimodal, and extensible Function Call plugin system. Supports one-click free deployment of your private ChatGPT/LLM web application.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"framework",
|
|
@@ -86,14 +86,12 @@
|
|
|
86
86
|
"antd-style": "^3",
|
|
87
87
|
"brotli-wasm": "^2",
|
|
88
88
|
"chroma-js": "^2",
|
|
89
|
-
"copy-to-clipboard": "^3",
|
|
90
89
|
"dayjs": "^1",
|
|
91
90
|
"dexie": "^3",
|
|
92
91
|
"fast-deep-equal": "^3",
|
|
93
92
|
"gpt-tokenizer": "^2",
|
|
94
93
|
"i18next": "^23",
|
|
95
94
|
"i18next-browser-languagedetector": "^7",
|
|
96
|
-
"i18next-resources-for-ts": "^1",
|
|
97
95
|
"i18next-resources-to-backend": "^1",
|
|
98
96
|
"idb-keyval": "^6",
|
|
99
97
|
"immer": "^10",
|
|
@@ -111,7 +109,6 @@
|
|
|
111
109
|
"react-dom": "^18",
|
|
112
110
|
"react-hotkeys-hook": "^4",
|
|
113
111
|
"react-i18next": "^14",
|
|
114
|
-
"react-intersection-observer": "^9",
|
|
115
112
|
"react-layout-kit": "^1",
|
|
116
113
|
"react-lazy-load": "^4",
|
|
117
114
|
"react-virtuoso": "^4.6.2",
|
|
@@ -9,7 +9,9 @@ export const runtime = 'edge';
|
|
|
9
9
|
export const GET = async () => {
|
|
10
10
|
const { CUSTOM_MODELS } = getServerConfig();
|
|
11
11
|
|
|
12
|
-
const config: GlobalServerConfig = {
|
|
12
|
+
const config: GlobalServerConfig = {
|
|
13
|
+
customModelName: CUSTOM_MODELS,
|
|
14
|
+
};
|
|
13
15
|
|
|
14
16
|
return new Response(JSON.stringify(config));
|
|
15
17
|
};
|
|
@@ -6,6 +6,7 @@ import { memo } from 'react';
|
|
|
6
6
|
|
|
7
7
|
import { MOBILE_HEADER_ICON_SIZE } from '@/const/layoutTokens';
|
|
8
8
|
import { useGlobalStore } from '@/store/global';
|
|
9
|
+
import { commonSelectors } from '@/store/global/selectors';
|
|
9
10
|
import { useSessionStore } from '@/store/session';
|
|
10
11
|
|
|
11
12
|
export const useStyles = createStyles(({ css, token }) => ({
|
|
@@ -21,7 +22,7 @@ export const useStyles = createStyles(({ css, token }) => ({
|
|
|
21
22
|
const Header = memo(() => {
|
|
22
23
|
const [createSession] = useSessionStore((s) => [s.createSession]);
|
|
23
24
|
const router = useRouter();
|
|
24
|
-
const avatar = useGlobalStore(
|
|
25
|
+
const avatar = useGlobalStore(commonSelectors.userAvatar);
|
|
25
26
|
return (
|
|
26
27
|
<MobileNavBar
|
|
27
28
|
center={<Logo type={'text'} />}
|
|
@@ -7,6 +7,7 @@ import { Flexbox } from 'react-layout-kit';
|
|
|
7
7
|
import { FORM_STYLE } from '@/const/layoutTokens';
|
|
8
8
|
import { useChatStore } from '@/store/chat';
|
|
9
9
|
import { useGlobalStore } from '@/store/global';
|
|
10
|
+
import { commonSelectors } from '@/store/global/selectors';
|
|
10
11
|
|
|
11
12
|
import Preview from './Preview';
|
|
12
13
|
import { FieldType, ImageType } from './type';
|
|
@@ -48,7 +49,7 @@ const ShareModal = memo<ModalProps>(({ onCancel, open }) => {
|
|
|
48
49
|
const [fieldValue, setFieldValue] = useState<FieldType>(DEFAULT_FIELD_VALUE);
|
|
49
50
|
const [tab, setTab] = useState<Tab>(Tab.Screenshot);
|
|
50
51
|
const { t } = useTranslation('chat');
|
|
51
|
-
const avatar = useGlobalStore(
|
|
52
|
+
const avatar = useGlobalStore(commonSelectors.userAvatar);
|
|
52
53
|
const [shareLoading, shareToShareGPT] = useChatStore((s) => [s.shareLoading, s.shareToShareGPT]);
|
|
53
54
|
const { loading, onDownload, title } = useScreenshot(fieldValue.imageType);
|
|
54
55
|
|
|
@@ -140,7 +140,8 @@ const TopicContent = memo<TopicContentProps>(({ id, title, fav, showMore }) => {
|
|
|
140
140
|
color={fav ? theme.colorWarning : undefined}
|
|
141
141
|
fill={fav ? theme.colorWarning : 'transparent'}
|
|
142
142
|
icon={Star}
|
|
143
|
-
onClick={() => {
|
|
143
|
+
onClick={(e) => {
|
|
144
|
+
e.stopPropagation();
|
|
144
145
|
if (!id) return;
|
|
145
146
|
favoriteTopic(id, !fav);
|
|
146
147
|
}}
|
|
@@ -11,6 +11,7 @@ import { Flexbox } from 'react-layout-kit';
|
|
|
11
11
|
import { AGENTS_INDEX_GITHUB_ISSUE } from '@/const/url';
|
|
12
12
|
import AgentInfo from '@/features/AgentInfo';
|
|
13
13
|
import { useGlobalStore } from '@/store/global';
|
|
14
|
+
import { settingsSelectors } from '@/store/global/selectors';
|
|
14
15
|
import { useSessionStore } from '@/store/session';
|
|
15
16
|
import { agentSelectors } from '@/store/session/selectors';
|
|
16
17
|
|
|
@@ -20,7 +21,7 @@ const SubmitAgentModal = memo<ModalProps>(({ open, onCancel }) => {
|
|
|
20
21
|
const systemRole = useSessionStore(agentSelectors.currentAgentSystemRole);
|
|
21
22
|
const theme = useTheme();
|
|
22
23
|
const meta = useSessionStore(agentSelectors.currentAgentMeta, isEqual);
|
|
23
|
-
const language = useGlobalStore((s) => s.
|
|
24
|
+
const language = useGlobalStore((s) => settingsSelectors.currentSettings(s).language);
|
|
24
25
|
|
|
25
26
|
const isMetaPass = Boolean(
|
|
26
27
|
meta && meta.title && meta.description && (meta.tags as string[])?.length > 0 && meta.avatar,
|
|
@@ -9,6 +9,7 @@ import { CURRENT_VERSION } from '@/const/version';
|
|
|
9
9
|
import AvatarWithUpload from '@/features/AvatarWithUpload';
|
|
10
10
|
import { useGlobalStore, useSwitchSideBarOnInit } from '@/store/global';
|
|
11
11
|
import { SidebarTabKey } from '@/store/global/initialState';
|
|
12
|
+
import { commonSelectors } from '@/store/global/selectors';
|
|
12
13
|
|
|
13
14
|
import List from '../../features/SideBar/List';
|
|
14
15
|
import AvatarBanner from '../features/AvatarBanner';
|
|
@@ -28,7 +29,7 @@ const useStyles = createStyles(({ css, token }) => ({
|
|
|
28
29
|
|
|
29
30
|
const Setting = memo(() => {
|
|
30
31
|
useSwitchSideBarOnInit(SidebarTabKey.Setting);
|
|
31
|
-
const avatar = useGlobalStore(
|
|
32
|
+
const avatar = useGlobalStore(commonSelectors.userAvatar);
|
|
32
33
|
const { styles } = useStyles();
|
|
33
34
|
|
|
34
35
|
return (
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { Form, type ItemGroup, SelectWithImg, SliderWithInput } from '@lobehub/ui';
|
|
2
2
|
import { Form as AntForm, App, Button, Input, Select } from 'antd';
|
|
3
3
|
import isEqual from 'fast-deep-equal';
|
|
4
|
-
import { debounce } from 'lodash-es';
|
|
5
4
|
import { AppWindow, Monitor, Moon, Palette, Sun } from 'lucide-react';
|
|
6
|
-
import { memo, useCallback } from 'react';
|
|
5
|
+
import { memo, useCallback, useEffect } from 'react';
|
|
7
6
|
import { useTranslation } from 'react-i18next';
|
|
8
7
|
|
|
9
8
|
import { FORM_STYLE } from '@/const/layoutTokens';
|
|
@@ -222,12 +221,24 @@ const Common = memo<SettingsCommonProps>(({ showAccessCodeConfig }) => {
|
|
|
222
221
|
title: t('settingSystem.title'),
|
|
223
222
|
};
|
|
224
223
|
|
|
224
|
+
useEffect(() => {
|
|
225
|
+
const unsubscribe = useGlobalStore.subscribe(
|
|
226
|
+
(s) => s.settings,
|
|
227
|
+
(settings) => {
|
|
228
|
+
form.setFieldsValue(settings);
|
|
229
|
+
},
|
|
230
|
+
);
|
|
231
|
+
return () => {
|
|
232
|
+
unsubscribe();
|
|
233
|
+
};
|
|
234
|
+
}, []);
|
|
235
|
+
|
|
225
236
|
return (
|
|
226
237
|
<Form
|
|
227
238
|
form={form}
|
|
228
239
|
initialValues={settings}
|
|
229
240
|
items={[theme, system]}
|
|
230
|
-
onValuesChange={
|
|
241
|
+
onValuesChange={setSettings}
|
|
231
242
|
{...FORM_STYLE}
|
|
232
243
|
/>
|
|
233
244
|
);
|
|
@@ -8,10 +8,11 @@ import {
|
|
|
8
8
|
import { memo } from 'react';
|
|
9
9
|
|
|
10
10
|
import { useGlobalStore } from '@/store/global';
|
|
11
|
+
import { settingsSelectors } from '@/store/global/selectors';
|
|
11
12
|
|
|
12
13
|
const ThemeSwatchesNeutral = memo(() => {
|
|
13
14
|
const [neutralColor, setSettings] = useGlobalStore((s) => [
|
|
14
|
-
s.
|
|
15
|
+
settingsSelectors.currentSettings(s).neutralColor,
|
|
15
16
|
s.setSettings,
|
|
16
17
|
]);
|
|
17
18
|
|
|
@@ -8,10 +8,11 @@ import {
|
|
|
8
8
|
import { memo } from 'react';
|
|
9
9
|
|
|
10
10
|
import { useGlobalStore } from '@/store/global';
|
|
11
|
+
import { settingsSelectors } from '@/store/global/selectors';
|
|
11
12
|
|
|
12
13
|
const ThemeSwatchesPrimary = memo(() => {
|
|
13
14
|
const [primaryColor, setSettings] = useGlobalStore((s) => [
|
|
14
|
-
s.
|
|
15
|
+
settingsSelectors.currentSettings(s).primaryColor,
|
|
15
16
|
s.setSettings,
|
|
16
17
|
]);
|
|
17
18
|
|
|
@@ -3,12 +3,12 @@ import { Form as AntForm, AutoComplete, Input, Switch } from 'antd';
|
|
|
3
3
|
import { createStyles } from 'antd-style';
|
|
4
4
|
import { debounce } from 'lodash-es';
|
|
5
5
|
import { Webhook } from 'lucide-react';
|
|
6
|
-
import { memo } from 'react';
|
|
6
|
+
import { memo, useEffect } from 'react';
|
|
7
7
|
import { useTranslation } from 'react-i18next';
|
|
8
8
|
|
|
9
9
|
import { FORM_STYLE } from '@/const/layoutTokens';
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
10
|
+
import { useGlobalStore } from '@/store/global';
|
|
11
|
+
import { modelProviderSelectors } from '@/store/global/selectors';
|
|
12
12
|
|
|
13
13
|
import Checker from './Checker';
|
|
14
14
|
|
|
@@ -35,16 +35,23 @@ const LLM = memo(() => {
|
|
|
35
35
|
const { t } = useTranslation('setting');
|
|
36
36
|
const [form] = AntForm.useForm();
|
|
37
37
|
const { styles } = useStyles();
|
|
38
|
-
const [setSettings] = useGlobalStore((s) => [
|
|
38
|
+
const [useAzure, setSettings] = useGlobalStore((s) => [
|
|
39
|
+
modelProviderSelectors.enableAzure(s),
|
|
40
|
+
s.setSettings,
|
|
41
|
+
]);
|
|
39
42
|
|
|
40
|
-
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
const unsubscribe = useGlobalStore.subscribe(
|
|
45
|
+
(s) => s.settings,
|
|
46
|
+
(settings) => {
|
|
47
|
+
form.setFieldsValue(settings);
|
|
48
|
+
},
|
|
49
|
+
);
|
|
50
|
+
return () => {
|
|
51
|
+
unsubscribe();
|
|
52
|
+
};
|
|
44
53
|
}, []);
|
|
45
54
|
|
|
46
|
-
const useAzure = useGlobalStore((s) => s.settings.languageModel.openAI.useAzure);
|
|
47
|
-
|
|
48
55
|
const openAI: ItemGroup = {
|
|
49
56
|
children: [
|
|
50
57
|
{
|