@lobehub/chat 1.50.1 → 1.50.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/changelog/v1.json +18 -0
- package/docker-compose/local/.env.example +9 -3
- package/docker-compose/local/.env.zh-CN.example +8 -3
- package/docker-compose/local/docker-compose.yml +22 -12
- package/docker-compose/local/init_data.json +473 -12
- package/docker-compose/setup.sh +660 -0
- package/docs/self-hosting/server-database/docker-compose.mdx +549 -271
- package/docs/self-hosting/server-database/docker-compose.zh-CN.mdx +415 -124
- package/locales/ar/models.json +22 -34
- package/locales/bg-BG/models.json +22 -34
- package/locales/de-DE/models.json +22 -34
- package/locales/en-US/models.json +22 -34
- package/locales/es-ES/models.json +22 -34
- package/locales/fa-IR/models.json +22 -34
- package/locales/fr-FR/models.json +22 -34
- package/locales/it-IT/models.json +22 -34
- package/locales/ja-JP/models.json +22 -34
- package/locales/ko-KR/models.json +25 -38
- package/locales/nl-NL/models.json +22 -34
- package/locales/pl-PL/models.json +22 -34
- package/locales/pt-BR/models.json +22 -34
- package/locales/ru-RU/models.json +22 -34
- package/locales/tr-TR/models.json +22 -34
- package/locales/vi-VN/models.json +22 -34
- package/locales/zh-CN/models.json +39 -51
- package/locales/zh-TW/models.json +22 -34
- package/package.json +1 -1
- package/src/libs/agent-runtime/github/index.ts +2 -2
- package/src/libs/agent-runtime/openai/index.ts +31 -23
- package/docker-compose/local/s3_data.tar.gz +0 -0
- package/docker-compose/local/setup.sh +0 -375
@@ -1,375 +0,0 @@
|
|
1
|
-
#!/bin/bash
|
2
|
-
|
3
|
-
# ==================
|
4
|
-
# == Env settings ==
|
5
|
-
# ==================
|
6
|
-
|
7
|
-
# ======================
|
8
|
-
# == Process the args ==
|
9
|
-
# ======================
|
10
|
-
|
11
|
-
# 1. Default values of arguments
|
12
|
-
# Arg: -f
|
13
|
-
# Determine force download asserts, default is not
|
14
|
-
FORCE_DOWNLOAD=false
|
15
|
-
|
16
|
-
# Arg: -l or --lang
|
17
|
-
# Determine the language to show, default is en
|
18
|
-
LANGUAGE="en_US"
|
19
|
-
|
20
|
-
# Arg: --url
|
21
|
-
# Determine the source URL to download files
|
22
|
-
SOURCE_URL="https://raw.githubusercontent.com/lobehub/lobe-chat/main"
|
23
|
-
|
24
|
-
# Arg: --host
|
25
|
-
# Determine the server host
|
26
|
-
HOST=""
|
27
|
-
|
28
|
-
# 2. Parse script arguments
|
29
|
-
while getopts "fl:-:" opt; do
|
30
|
-
case $opt in
|
31
|
-
f)
|
32
|
-
FORCE_DOWNLOAD=true
|
33
|
-
;;
|
34
|
-
l)
|
35
|
-
LANGUAGE=$OPTARG
|
36
|
-
;;
|
37
|
-
-)
|
38
|
-
case "${OPTARG}" in
|
39
|
-
lang)
|
40
|
-
LANGUAGE="${!OPTIND}"
|
41
|
-
OPTIND=$(($OPTIND + 1))
|
42
|
-
;;
|
43
|
-
url)
|
44
|
-
SOURCE_URL="${!OPTIND}"
|
45
|
-
OPTIND=$(($OPTIND + 1))
|
46
|
-
;;
|
47
|
-
host)
|
48
|
-
HOST="${!OPTIND}"
|
49
|
-
OPTIND=$(($OPTIND + 1))
|
50
|
-
;;
|
51
|
-
*)
|
52
|
-
echo "Usage: $0 [-f] [-l language|--lang language] [--url source] [--host serverhost]" >&2
|
53
|
-
exit 1
|
54
|
-
;;
|
55
|
-
esac
|
56
|
-
;;
|
57
|
-
*)
|
58
|
-
echo "Usage: $0 [-f] [-l language|--lang language] [--url source]" >&2
|
59
|
-
exit 1
|
60
|
-
;;
|
61
|
-
esac
|
62
|
-
done
|
63
|
-
|
64
|
-
# ===============
|
65
|
-
# == Variables ==
|
66
|
-
# ===============
|
67
|
-
# File list
|
68
|
-
SUB_DIR="docker-compose/local"
|
69
|
-
FILES=(
|
70
|
-
"$SUB_DIR/docker-compose.yml"
|
71
|
-
"$SUB_DIR/.env.example"
|
72
|
-
"$SUB_DIR/init_data.json"
|
73
|
-
"$SUB_DIR/s3_data.tar.gz"
|
74
|
-
)
|
75
|
-
|
76
|
-
# Supported languages and messages
|
77
|
-
# Arg: -l --lang
|
78
|
-
# If the language is not supported, default to English
|
79
|
-
# Function to show messages
|
80
|
-
show_message() {
|
81
|
-
local key="$1"
|
82
|
-
case $key in
|
83
|
-
downloading)
|
84
|
-
case $LANGUAGE in
|
85
|
-
zh_CN)
|
86
|
-
echo "正在下载文件..."
|
87
|
-
;;
|
88
|
-
*)
|
89
|
-
echo "Downloading files..."
|
90
|
-
;;
|
91
|
-
esac
|
92
|
-
;;
|
93
|
-
downloaded)
|
94
|
-
case $LANGUAGE in
|
95
|
-
zh_CN)
|
96
|
-
echo " 已经存在,跳过下载。"
|
97
|
-
;;
|
98
|
-
*)
|
99
|
-
echo " already exists, skipping download."
|
100
|
-
;;
|
101
|
-
esac
|
102
|
-
;;
|
103
|
-
extracted_success)
|
104
|
-
case $LANGUAGE in
|
105
|
-
zh_CN)
|
106
|
-
echo " 解压成功到目录:"
|
107
|
-
;;
|
108
|
-
*)
|
109
|
-
echo " extracted successfully to directory: "
|
110
|
-
;;
|
111
|
-
esac
|
112
|
-
;;
|
113
|
-
extracted_failed)
|
114
|
-
case $LANGUAGE in
|
115
|
-
zh_CN)
|
116
|
-
echo " 解压失败。"
|
117
|
-
;;
|
118
|
-
*)
|
119
|
-
echo " extraction failed."
|
120
|
-
;;
|
121
|
-
esac
|
122
|
-
;;
|
123
|
-
file_not_exists)
|
124
|
-
case $LANGUAGE in
|
125
|
-
zh_CN)
|
126
|
-
echo " 不存在。"
|
127
|
-
;;
|
128
|
-
*)
|
129
|
-
echo " does not exist."
|
130
|
-
;;
|
131
|
-
esac
|
132
|
-
;;
|
133
|
-
security_secrect_regenerate)
|
134
|
-
case $LANGUAGE in
|
135
|
-
zh_CN)
|
136
|
-
echo "重新生成安全密钥..."
|
137
|
-
;;
|
138
|
-
*)
|
139
|
-
echo "Regenerate security secrets..."
|
140
|
-
;;
|
141
|
-
esac
|
142
|
-
;;
|
143
|
-
security_secrect_regenerate_failed)
|
144
|
-
case $LANGUAGE in
|
145
|
-
zh_CN)
|
146
|
-
echo "无法重新生成安全密钥:"
|
147
|
-
;;
|
148
|
-
*)
|
149
|
-
echo "Failed to regenerate security secrets: "
|
150
|
-
;;
|
151
|
-
esac
|
152
|
-
;;
|
153
|
-
security_secrect_regenerate_report)
|
154
|
-
case $LANGUAGE in
|
155
|
-
zh_CN)
|
156
|
-
echo "安全密钥生成结果如下:"
|
157
|
-
;;
|
158
|
-
*)
|
159
|
-
echo "Security secret generation results are as follows:"
|
160
|
-
;;
|
161
|
-
esac
|
162
|
-
;;
|
163
|
-
tips_run_command)
|
164
|
-
case $LANGUAGE in
|
165
|
-
zh_CN)
|
166
|
-
echo "您已经完成了所有配置。请运行以下命令启动LobeChat:"
|
167
|
-
;;
|
168
|
-
*)
|
169
|
-
echo "You have completed all configurations. Please run this command to start LobeChat:"
|
170
|
-
;;
|
171
|
-
esac
|
172
|
-
;;
|
173
|
-
tips_show_documentation)
|
174
|
-
case $LANGUAGE in
|
175
|
-
zh_CN)
|
176
|
-
echo "完整的环境变量在'.env'中可以在文档中找到:"
|
177
|
-
;;
|
178
|
-
*)
|
179
|
-
echo "Full environment variables in the '.env' can be found at the documentation on "
|
180
|
-
;;
|
181
|
-
esac
|
182
|
-
;;
|
183
|
-
tips_show_documentation_url)
|
184
|
-
case $LANGUAGE in
|
185
|
-
zh_CN)
|
186
|
-
echo "https://lobehub.com/zh/docs/self-hosting/environment-variables"
|
187
|
-
;;
|
188
|
-
*)
|
189
|
-
echo "https://lobehub.com/docs/self-hosting/environment-variables"
|
190
|
-
;;
|
191
|
-
esac
|
192
|
-
;;
|
193
|
-
tips_warning)
|
194
|
-
case $LANGUAGE in
|
195
|
-
zh_CN)
|
196
|
-
echo "警告:如果你正在生产环境中使用,请在日志中检查密钥是否已经生成!!!"
|
197
|
-
;;
|
198
|
-
*)
|
199
|
-
echo "Warning: If you are using it in a production environment, please check if the keys have been generated in the logs!!!"
|
200
|
-
;;
|
201
|
-
esac
|
202
|
-
;;
|
203
|
-
esac
|
204
|
-
}
|
205
|
-
|
206
|
-
# Function to download files
|
207
|
-
download_file() {
|
208
|
-
local file_url="$1"
|
209
|
-
local local_file="$2"
|
210
|
-
|
211
|
-
if [ "$FORCE_DOWNLOAD" = false ] && [ -e "$local_file" ]; then
|
212
|
-
echo "$local_file" $(show_message "downloaded")
|
213
|
-
return 0
|
214
|
-
fi
|
215
|
-
|
216
|
-
wget -q --show-progress "$file_url" -O "$local_file"
|
217
|
-
}
|
218
|
-
|
219
|
-
extract_file() {
|
220
|
-
local file_name=$1
|
221
|
-
local target_dir=$2
|
222
|
-
|
223
|
-
if [ -e "$file_name" ]; then
|
224
|
-
tar -zxvf "$file_name" -C "$target_dir" > /dev/null 2>&1
|
225
|
-
if [ $? -eq 0 ]; then
|
226
|
-
echo "$file_name" $(show_message "extracted_success") "$target_dir"
|
227
|
-
else
|
228
|
-
echo "$file_name" $(show_message "extracted_failed")
|
229
|
-
exit 1
|
230
|
-
fi
|
231
|
-
else
|
232
|
-
echo "$file_name" $(show_message "file_not_exists")
|
233
|
-
exit 1
|
234
|
-
fi
|
235
|
-
}
|
236
|
-
|
237
|
-
# Define colors
|
238
|
-
declare -A colors
|
239
|
-
colors=(
|
240
|
-
[black]="\e[30m"
|
241
|
-
[red]="\e[31m"
|
242
|
-
[green]="\e[32m"
|
243
|
-
[yellow]="\e[33m"
|
244
|
-
[blue]="\e[34m"
|
245
|
-
[magenta]="\e[35m"
|
246
|
-
[cyan]="\e[36m"
|
247
|
-
[white]="\e[37m"
|
248
|
-
[reset]="\e[0m"
|
249
|
-
)
|
250
|
-
|
251
|
-
print_centered() {
|
252
|
-
local text="$1" # Get input texts
|
253
|
-
local color="${2:-reset}" # Get color, default to reset
|
254
|
-
local term_width=$(tput cols) # Get terminal width
|
255
|
-
local text_length=${#text} # Get text length
|
256
|
-
local padding=$(((term_width - text_length) / 2)) # Get padding
|
257
|
-
# Check if the color is valid
|
258
|
-
if [[ -z "${colors[$color]}" ]]; then
|
259
|
-
echo "Invalid color specified. Available colors: ${!colors[@]}"
|
260
|
-
return 1
|
261
|
-
fi
|
262
|
-
# Print the text with padding
|
263
|
-
printf "%*s${colors[$color]}%s${colors[reset]}\n" $padding "" "$text"
|
264
|
-
}
|
265
|
-
|
266
|
-
# Download files asynchronously
|
267
|
-
download_file "$SOURCE_URL/${FILES[0]}" "docker-compose.yml"
|
268
|
-
download_file "$SOURCE_URL/${FILES[1]}" ".env"
|
269
|
-
download_file "$SOURCE_URL/${FILES[2]}" "init_data.json"
|
270
|
-
download_file "$SOURCE_URL/${FILES[3]}" "s3_data.tar.gz"
|
271
|
-
|
272
|
-
# Extract .tar.gz file without output
|
273
|
-
extract_file "s3_data.tar.gz" "."
|
274
|
-
rm s3_data.tar.gz
|
275
|
-
|
276
|
-
# ==========================
|
277
|
-
# === Regenerate Secrets ===
|
278
|
-
# ==========================
|
279
|
-
|
280
|
-
generate_key() {
|
281
|
-
if [[ -z "$1" ]]; then
|
282
|
-
echo "Usage: generate_key <length>"
|
283
|
-
return 1
|
284
|
-
fi
|
285
|
-
echo $(openssl rand -hex $1 | tr -d '\n' | fold -w $1 | head -n 1)
|
286
|
-
}
|
287
|
-
|
288
|
-
echo $(show_message "security_secrect_regenerate")
|
289
|
-
|
290
|
-
# check operating system
|
291
|
-
if [[ "$OSTYPE" == "darwin"* ]]; then
|
292
|
-
# macOS
|
293
|
-
SED_COMMAND="sed -i ''"
|
294
|
-
else
|
295
|
-
# not macOS
|
296
|
-
SED_COMMAND="sed -i"
|
297
|
-
fi
|
298
|
-
|
299
|
-
# Generate CASDOOR_SECRET
|
300
|
-
CASDOOR_SECRET=$(generate_key 32)
|
301
|
-
if [ $? -ne 0 ]; then
|
302
|
-
echo $(show_message "security_secrect_regenerate_failed") "CASDOOR_SECRET"
|
303
|
-
else
|
304
|
-
# Search and replace the value of CASDOOR_SECRET in .env
|
305
|
-
$SED_COMMAND "s#^AUTH_CASDOOR_SECRET=.*#AUTH_CASDOOR_SECRET=${CASDOOR_SECRET}#" .env
|
306
|
-
if [ $? -ne 0 ]; then
|
307
|
-
echo $(show_message "security_secrect_regenerate_failed") "AUTH_CASDOOR_SECRET in \`.env\`"
|
308
|
-
fi
|
309
|
-
# replace `clientSecrect` in init_data.json
|
310
|
-
$SED_COMMAND "s#dbf205949d704de81b0b5b3603174e23fbecc354#${CASDOOR_SECRET}#" init_data.json
|
311
|
-
if [ $? -ne 0 ]; then
|
312
|
-
echo $(show_message "security_secrect_regenerate_failed") "AUTH_CASDOOR_SECRET in \`init_data.json\`"
|
313
|
-
fi
|
314
|
-
fi
|
315
|
-
|
316
|
-
# Generate Casdoor User
|
317
|
-
CASDOOR_USER="admin"
|
318
|
-
CASDOOR_PASSWORD=$(generate_key 6)
|
319
|
-
if [ $? -ne 0 ]; then
|
320
|
-
echo $(show_message "security_secrect_regenerate_failed") "CASDOOR_PASSWORD"
|
321
|
-
else
|
322
|
-
# replace `password` in init_data.json
|
323
|
-
$SED_COMMAND "s/"123"/${CASDOOR_PASSWORD}/" init_data.json
|
324
|
-
if [ $? -ne 0 ]; then
|
325
|
-
echo $(show_message "security_secrect_regenerate_failed") "CASDOOR_PASSWORD in \`init_data.json\`"
|
326
|
-
fi
|
327
|
-
fi
|
328
|
-
|
329
|
-
# Generate Minio S3 access key
|
330
|
-
# Temporarily disable key gen for minio because
|
331
|
-
# minio can not start with a access key in envs
|
332
|
-
#S3_SECRET_ACCESS_KEY=$(generate_key 32)
|
333
|
-
#if [ $? -ne 0 ]; then
|
334
|
-
# echo $(show_message "security_secrect_regenerate_failed") "S3_SECRET_ACCESS_KEY"
|
335
|
-
#else
|
336
|
-
# # Search and replace the value of S3_SECRET_ACCESS_KEY in .env
|
337
|
-
# $SED_COMMAND "s#^S3_SECRET_ACCESS_KEY=.*#S3_SECRET_ACCESS_KEY=${S3_SECRET_ACCESS_KEY}#" .env
|
338
|
-
# if [ $? -ne 0 ]; then
|
339
|
-
# echo $(show_message "security_secrect_regenerate_failed") "S3_SECRET_ACCESS_KEY in \`.env\`"
|
340
|
-
# fi
|
341
|
-
#fi
|
342
|
-
|
343
|
-
# Modify the .env file if the host is specified
|
344
|
-
if [ -n "$HOST" ]; then
|
345
|
-
# Modify env
|
346
|
-
$SED_COMMAND "s/localhost/$HOST/g" .env
|
347
|
-
if [ $? -ne 0 ]; then
|
348
|
-
echo $(show_message "security_secrect_regenerate_failed") "HOST in \`.env\`"
|
349
|
-
fi
|
350
|
-
# Modify casdoor init data
|
351
|
-
$SED_COMMAND "s/localhost/$HOST/g" init_data.json
|
352
|
-
if [ $? -ne 0 ]; then
|
353
|
-
echo $(show_message "security_secrect_regenerate_failed") "HOST in \`init_data.json\`"
|
354
|
-
fi
|
355
|
-
fi
|
356
|
-
|
357
|
-
# Display configuration reports
|
358
|
-
|
359
|
-
echo $(show_message "security_secrect_regenerate_report")
|
360
|
-
|
361
|
-
if [ -n "$HOST" ]; then
|
362
|
-
echo -e "Server Host: $HOST"
|
363
|
-
fi
|
364
|
-
echo -e "Casdoor: \n - Username: admin\n - Password: ${CASDOOR_PASSWORD}\n - Client Secret: ${CASDOOR_SECRET}"
|
365
|
-
|
366
|
-
# ===========================
|
367
|
-
# == Display final message ==
|
368
|
-
# ===========================
|
369
|
-
|
370
|
-
printf "\n%s\n\n" "$(show_message "tips_run_command")"
|
371
|
-
print_centered "docker compose up -d" "green"
|
372
|
-
printf "\n%s" "$(show_message "tips_show_documentation")"
|
373
|
-
printf "%s\n" $(show_message "tips_show_documentation_url")
|
374
|
-
printf "\n\e[33m%s\e[0m\n" "$(show_message "tips_warning")"
|
375
|
-
|