@lobehub/chat 1.22.1 → 1.22.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/docker-compose/local/docker-compose.yml +11 -9
- package/docker-compose/{local-logto → local/logto}/.env.example +2 -2
- package/docker-compose/{local-logto → local/logto}/.env.zh-CN.example +3 -3
- package/docker-compose/{local-logto → local/logto}/docker-compose.yml +8 -7
- package/docker-compose/local/setup.sh +31 -29
- package/docker-compose/local/zitadel/docker-compose.yml +8 -8
- package/docker-compose/production/{.env.example → logto/.env.example} +3 -3
- package/docker-compose/production/{.env.zh-CN.example → logto/.env.zh-CN.example} +3 -3
- package/docker-compose/production/{docker-compose.yml → logto/docker-compose.yml} +2 -1
- package/docker-compose/production/zitadel/docker-compose.yml +5 -5
- package/docs/self-hosting/advanced/auth/next-auth/authentik.zh-CN.mdx +2 -2
- package/docs/self-hosting/advanced/auth/next-auth/casdoor.mdx +120 -0
- package/docs/self-hosting/advanced/auth/next-auth/casdoor.zh-CN.mdx +121 -0
- package/docs/self-hosting/advanced/auth/next-auth/cloudflare-zero-trust.zh-CN.mdx +3 -3
- package/docs/self-hosting/advanced/auth/next-auth/logto.mdx +10 -8
- package/docs/self-hosting/advanced/auth/next-auth/logto.zh-CN.mdx +1 -1
- package/docs/self-hosting/advanced/auth.mdx +5 -1
- package/docs/self-hosting/advanced/auth.zh-CN.mdx +5 -1
- package/docs/self-hosting/environment-variables/auth.mdx +88 -63
- package/docs/self-hosting/environment-variables/auth.zh-CN.mdx +91 -68
- package/docs/self-hosting/server-database/docker-compose.mdx +163 -280
- package/docs/self-hosting/server-database/docker-compose.zh-CN.mdx +92 -210
- package/docs/usage/providers/ai21.mdx +3 -1
- package/docs/usage/providers/ai360.mdx +1 -1
- package/docs/usage/providers/fireworksai.mdx +3 -1
- package/docs/usage/providers/github.mdx +1 -1
- package/docs/usage/providers/hunyuan.mdx +3 -1
- package/docs/usage/providers/siliconcloud.mdx +3 -1
- package/docs/usage/providers/spark.mdx +1 -1
- package/docs/usage/providers/upstage.mdx +1 -1
- package/docs/usage/providers/wenxin.mdx +3 -1
- package/docs/usage/providers/zeroone.mdx +2 -2
- package/package.json +5 -5
- package/src/libs/next-auth/sso-providers/logto.ts +1 -1
- package/src/server/manifest.ts +0 -3
package/CHANGELOG.md
CHANGED
@@ -2,6 +2,56 @@
|
|
2
2
|
|
3
3
|
# Changelog
|
4
4
|
|
5
|
+
### [Version 1.22.3](https://github.com/lobehub/lobe-chat/compare/v1.22.2...v1.22.3)
|
6
|
+
|
7
|
+
<sup>Released on **2024-10-13**</sup>
|
8
|
+
|
9
|
+
#### 💄 Styles
|
10
|
+
|
11
|
+
- **misc**: Support multi-windows for PWA.
|
12
|
+
|
13
|
+
<br/>
|
14
|
+
|
15
|
+
<details>
|
16
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
17
|
+
|
18
|
+
#### Styles
|
19
|
+
|
20
|
+
- **misc**: Support multi-windows for PWA, closes [#4334](https://github.com/lobehub/lobe-chat/issues/4334) ([0284606](https://github.com/lobehub/lobe-chat/commit/0284606))
|
21
|
+
|
22
|
+
</details>
|
23
|
+
|
24
|
+
<div align="right">
|
25
|
+
|
26
|
+
[](#readme-top)
|
27
|
+
|
28
|
+
</div>
|
29
|
+
|
30
|
+
### [Version 1.22.2](https://github.com/lobehub/lobe-chat/compare/v1.22.1...v1.22.2)
|
31
|
+
|
32
|
+
<sup>Released on **2024-10-13**</sup>
|
33
|
+
|
34
|
+
#### 🐛 Bug Fixes
|
35
|
+
|
36
|
+
- **misc**: Allow use email as name in logto.
|
37
|
+
|
38
|
+
<br/>
|
39
|
+
|
40
|
+
<details>
|
41
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
42
|
+
|
43
|
+
#### What's fixed
|
44
|
+
|
45
|
+
- **misc**: Allow use email as name in logto, closes [#4350](https://github.com/lobehub/lobe-chat/issues/4350) ([d5a046a](https://github.com/lobehub/lobe-chat/commit/d5a046a))
|
46
|
+
|
47
|
+
</details>
|
48
|
+
|
49
|
+
<div align="right">
|
50
|
+
|
51
|
+
[](#readme-top)
|
52
|
+
|
53
|
+
</div>
|
54
|
+
|
5
55
|
### [Version 1.22.1](https://github.com/lobehub/lobe-chat/compare/v1.22.0...v1.22.1)
|
6
56
|
|
7
57
|
<sup>Released on **2024-10-12**</sup>
|
@@ -1,10 +1,11 @@
|
|
1
|
+
name: lobe-chat-database
|
1
2
|
services:
|
2
3
|
network-service:
|
3
4
|
image: alpine
|
4
5
|
container_name: lobe-network
|
5
6
|
ports:
|
6
|
-
- '${MINIO_PORT}:${MINIO_PORT}'
|
7
|
-
- '9001:9001'
|
7
|
+
- '${MINIO_PORT}:${MINIO_PORT}' # MinIO API
|
8
|
+
- '9001:9001' # MinIO Console
|
8
9
|
- '${CASDOOR_PORT}:${CASDOOR_PORT}' # Casdoor
|
9
10
|
- '${LOBE_PORT}:3210' # LobeChat
|
10
11
|
command: tail -f /dev/null
|
@@ -15,7 +16,7 @@ services:
|
|
15
16
|
image: pgvector/pgvector:pg16
|
16
17
|
container_name: lobe-postgres
|
17
18
|
ports:
|
18
|
-
-
|
19
|
+
- '5432:5432'
|
19
20
|
volumes:
|
20
21
|
- './data:/var/lib/postgresql/data'
|
21
22
|
environment:
|
@@ -44,6 +45,7 @@ services:
|
|
44
45
|
command: >
|
45
46
|
server /etc/minio/data --address ":${MINIO_PORT}" --console-address ":9001"
|
46
47
|
|
48
|
+
|
47
49
|
casdoor:
|
48
50
|
image: casbin/casdoor
|
49
51
|
container_name: lobe-casdoor
|
@@ -53,17 +55,17 @@ services:
|
|
53
55
|
postgresql:
|
54
56
|
condition: service_healthy
|
55
57
|
environment:
|
56
|
-
RUNNING_IN_DOCKER:
|
57
|
-
driverName:
|
58
|
-
dataSourceName:
|
59
|
-
origin:
|
60
|
-
runmode:
|
58
|
+
RUNNING_IN_DOCKER: 'true'
|
59
|
+
driverName: 'postgres'
|
60
|
+
dataSourceName: 'user=postgres password=${POSTGRES_PASSWORD} host=postgresql port=5432 sslmode=disable dbname=casdoor'
|
61
|
+
origin: 'http://localhost:${CASDOOR_PORT}'
|
62
|
+
runmode: 'dev'
|
61
63
|
volumes:
|
62
64
|
- ./init_data.json:/init_data.json
|
63
65
|
|
64
66
|
lobe:
|
65
67
|
image: lobehub/lobe-chat-database
|
66
|
-
container_name: lobe-
|
68
|
+
container_name: lobe-chat
|
67
69
|
network_mode: 'service:network-service'
|
68
70
|
depends_on:
|
69
71
|
postgresql:
|
@@ -1,12 +1,13 @@
|
|
1
|
+
name: lobe-chat-database
|
1
2
|
services:
|
2
3
|
network-service:
|
3
4
|
image: alpine
|
4
5
|
container_name: lobe-network
|
5
6
|
ports:
|
6
|
-
- '${MINIO_PORT}:${MINIO_PORT}'
|
7
|
-
- '9001:9001'
|
7
|
+
- '${MINIO_PORT}:${MINIO_PORT}' # MinIO API
|
8
|
+
- '9001:9001' # MinIO Console
|
8
9
|
- '${LOGTO_PORT}:${LOGTO_PORT}' # Logto
|
9
|
-
- '3002:3002'
|
10
|
+
- '3002:3002' # Logto Admin
|
10
11
|
- '${LOBE_PORT}:3210' # LobeChat
|
11
12
|
command: tail -f /dev/null
|
12
13
|
networks:
|
@@ -16,7 +17,7 @@ services:
|
|
16
17
|
image: pgvector/pgvector:pg16
|
17
18
|
container_name: lobe-postgres
|
18
19
|
ports:
|
19
|
-
-
|
20
|
+
- '5432:5432'
|
20
21
|
volumes:
|
21
22
|
- './data:/var/lib/postgresql/data'
|
22
23
|
environment:
|
@@ -45,6 +46,7 @@ services:
|
|
45
46
|
command: >
|
46
47
|
server /etc/minio/data --address ":${MINIO_PORT}" --console-address ":9001"
|
47
48
|
|
49
|
+
|
48
50
|
logto:
|
49
51
|
image: svhd/logto
|
50
52
|
container_name: lobe-logto
|
@@ -60,10 +62,9 @@ services:
|
|
60
62
|
- 'ADMIN_ENDPOINT=http://localhost:3002'
|
61
63
|
entrypoint: ['sh', '-c', 'npm run cli db seed -- --swe && npm start']
|
62
64
|
|
63
|
-
|
64
65
|
lobe:
|
65
66
|
image: lobehub/lobe-chat-database
|
66
|
-
container_name: lobe-
|
67
|
+
container_name: lobe-chat
|
67
68
|
network_mode: 'service:network-service'
|
68
69
|
depends_on:
|
69
70
|
postgresql:
|
@@ -81,7 +82,7 @@ services:
|
|
81
82
|
- 'KEY_VAULTS_SECRET=Kix2wcUONd4CX51E/ZPAd36BqM4wzJgKjPtz2sGztqQ='
|
82
83
|
- 'NEXT_AUTH_SECRET=NX2kaPE923dt6BL2U8e9oSre5RfoT7hg'
|
83
84
|
- 'NEXTAUTH_URL=http://localhost:${LOBE_PORT}/api/auth'
|
84
|
-
- '
|
85
|
+
- 'AUTH_LOGTO_ISSUER=http://localhost:${LOGTO_PORT}/oidc'
|
85
86
|
- 'DATABASE_URL=postgresql://postgres:${POSTGRES_PASSWORD}@postgresql:5432/${LOBE_DB_NAME}'
|
86
87
|
- 'S3_ENDPOINT=http://localhost:${MINIO_PORT}'
|
87
88
|
- 'S3_BUCKET=${MINIO_LOBE_BUCKET}'
|
@@ -9,7 +9,7 @@
|
|
9
9
|
# ======================
|
10
10
|
|
11
11
|
# 1. Default values of arguments
|
12
|
-
# Arg: -f
|
12
|
+
# Arg: -f
|
13
13
|
# Determine force download asserts, default is not
|
14
14
|
FORCE_DOWNLOAD=false
|
15
15
|
|
@@ -33,10 +33,12 @@ while getopts "fl:-:" opt; do
|
|
33
33
|
-)
|
34
34
|
case "${OPTARG}" in
|
35
35
|
lang)
|
36
|
-
LANGUAGE="${!OPTIND}"
|
36
|
+
LANGUAGE="${!OPTIND}"
|
37
|
+
OPTIND=$(($OPTIND + 1))
|
37
38
|
;;
|
38
39
|
url)
|
39
|
-
SOURCE_URL="${!OPTIND}"
|
40
|
+
SOURCE_URL="${!OPTIND}"
|
41
|
+
OPTIND=$(($OPTIND + 1))
|
40
42
|
;;
|
41
43
|
*)
|
42
44
|
echo "Usage: $0 [-f] [-l language|--lang language] [--url source]" >&2
|
@@ -51,7 +53,6 @@ while getopts "fl:-:" opt; do
|
|
51
53
|
esac
|
52
54
|
done
|
53
55
|
|
54
|
-
|
55
56
|
# ===============
|
56
57
|
# == Variables ==
|
57
58
|
# ===============
|
@@ -161,7 +162,7 @@ show_message() {
|
|
161
162
|
;;
|
162
163
|
esac
|
163
164
|
;;
|
164
|
-
|
165
|
+
esac
|
165
166
|
}
|
166
167
|
|
167
168
|
# Function to download files
|
@@ -186,7 +187,7 @@ extract_file() {
|
|
186
187
|
if [ $? -eq 0 ]; then
|
187
188
|
echo "$file_name" $(show_message "extracted_success") "$target_dir"
|
188
189
|
else
|
189
|
-
echo "$file_name" $(show_message "extracted_failed")
|
190
|
+
echo "$file_name" $(show_message "extracted_failed")
|
190
191
|
exit 1
|
191
192
|
fi
|
192
193
|
else
|
@@ -198,30 +199,30 @@ extract_file() {
|
|
198
199
|
# Define colors
|
199
200
|
declare -A colors
|
200
201
|
colors=(
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
202
|
+
[black]="\e[30m"
|
203
|
+
[red]="\e[31m"
|
204
|
+
[green]="\e[32m"
|
205
|
+
[yellow]="\e[33m"
|
206
|
+
[blue]="\e[34m"
|
207
|
+
[magenta]="\e[35m"
|
208
|
+
[cyan]="\e[36m"
|
209
|
+
[white]="\e[37m"
|
210
|
+
[reset]="\e[0m"
|
210
211
|
)
|
211
212
|
|
212
213
|
print_centered() {
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
214
|
+
local text="$1" # Get input texts
|
215
|
+
local color="${2:-reset}" # Get color, default to reset
|
216
|
+
local term_width=$(tput cols) # Get terminal width
|
217
|
+
local text_length=${#text} # Get text length
|
218
|
+
local padding=$(((term_width - text_length) / 2)) # Get padding
|
219
|
+
# Check if the color is valid
|
220
|
+
if [[ -z "${colors[$color]}" ]]; then
|
221
|
+
echo "Invalid color specified. Available colors: ${!colors[@]}"
|
222
|
+
return 1
|
223
|
+
fi
|
224
|
+
# Print the text with padding
|
225
|
+
printf "%*s${colors[$color]}%s${colors[reset]}\n" $padding "" "$text"
|
225
226
|
}
|
226
227
|
|
227
228
|
# Download files asynchronously
|
@@ -232,10 +233,11 @@ download_file "$SOURCE_URL/${FILES[3]}" "s3_data.tar.gz"
|
|
232
233
|
|
233
234
|
# Extract .tar.gz file without output
|
234
235
|
extract_file "s3_data.tar.gz" "."
|
236
|
+
rm s3_data.tar.gz
|
235
237
|
|
236
238
|
# Display final message
|
237
239
|
printf "\n%s\n\n" "$(show_message "tips_run_command")"
|
238
|
-
print_centered "docker compose
|
240
|
+
print_centered "docker compose up -d" "green"
|
239
241
|
printf "\n%s" "$(show_message "tips_show_documentation")"
|
240
242
|
printf "%s\n" $(show_message "tips_show_documentation_url")
|
241
|
-
printf "\n\e[33m%s\e[0m\n" "$(show_message "tips_warning")"
|
243
|
+
printf "\n\e[33m%s\e[0m\n" "$(show_message "tips_warning")"
|
@@ -1,10 +1,11 @@
|
|
1
|
+
name: lobe-chat-database
|
1
2
|
services:
|
2
3
|
network-service:
|
3
4
|
image: alpine
|
4
5
|
container_name: lobe-network
|
5
6
|
ports:
|
6
|
-
- '9000:9000'
|
7
|
-
- '9001:9001'
|
7
|
+
- '9000:9000' # MinIO API
|
8
|
+
- '9001:9001' # MinIO Console
|
8
9
|
- '8080:8080' # Zitadel Console
|
9
10
|
- '3210:3210' # LobeChat
|
10
11
|
command: tail -f /dev/null
|
@@ -15,7 +16,7 @@ services:
|
|
15
16
|
image: pgvector/pgvector:pg16
|
16
17
|
container_name: lobe-postgres
|
17
18
|
ports:
|
18
|
-
-
|
19
|
+
- '5432:5432'
|
19
20
|
volumes:
|
20
21
|
- './data:/var/lib/postgresql/data'
|
21
22
|
environment:
|
@@ -44,24 +45,23 @@ services:
|
|
44
45
|
command: >
|
45
46
|
server /etc/minio/data --address ":9000" --console-address ":9001"
|
46
47
|
|
48
|
+
|
47
49
|
zitadel:
|
48
50
|
restart: 'always'
|
49
51
|
image: 'ghcr.io/zitadel/zitadel:latest'
|
50
52
|
container_name: lobe-zitadel
|
51
53
|
network_mode: 'service:network-service'
|
52
|
-
command: start-from-init --config /zitadel-config.yaml --steps
|
53
|
-
/zitadel-init-steps.yaml --masterkey "cft3Tekr/rQBOqwoQSCPoncA9BHbn7QJ"
|
54
|
-
--tlsMode disabled #MasterkeyNeedsToHave32Characters
|
54
|
+
command: start-from-init --config /zitadel-config.yaml --steps /zitadel-init-steps.yaml --masterkey "cft3Tekr/rQBOqwoQSCPoncA9BHbn7QJ" --tlsMode disabled #MasterkeyNeedsToHave32Characters
|
55
55
|
volumes:
|
56
56
|
- ./zitadel-config.yaml:/zitadel-config.yaml:ro
|
57
|
-
- ./zitadel-init-steps.yaml:/zitadel-init-steps.yaml:ro
|
57
|
+
- ./zitadel-init-steps.yaml:/zitadel-init-steps.yaml:ro
|
58
58
|
depends_on:
|
59
59
|
postgresql:
|
60
60
|
condition: service_healthy
|
61
61
|
|
62
62
|
lobe:
|
63
63
|
image: lobehub/lobe-chat-database
|
64
|
-
container_name: lobe-
|
64
|
+
container_name: lobe-chat
|
65
65
|
network_mode: 'service:network-service'
|
66
66
|
depends_on:
|
67
67
|
postgresql:
|
@@ -23,9 +23,9 @@ NEXTAUTH_URL=https://lobe.example.com/api/auth
|
|
23
23
|
|
24
24
|
# NextAuth providers configuration (example using Logto)
|
25
25
|
# For other providers, see: https://lobehub.com/docs/self-hosting/environment-variables/auth
|
26
|
-
|
27
|
-
|
28
|
-
|
26
|
+
AUTH_LOGTO_CLIENT_ID=YOUR_LOGTO_CLIENT_ID
|
27
|
+
AUTH_LOGTO_CLIENT_SECRET=YOUR_LOGTO_CLIENT_SECRET
|
28
|
+
AUTH_LOGTO_ISSUER=https://lobe-auth-api.example.com/oidc
|
29
29
|
|
30
30
|
# Proxy settings (if needed, e.g., when using GitHub as an auth provider)
|
31
31
|
# HTTP_PROXY=http://localhost:7890
|
@@ -22,9 +22,9 @@ NEXTAUTH_URL=https://lobe.example.com/api/auth
|
|
22
22
|
|
23
23
|
# NextAuth 鉴权服务提供商部分,以 Logto 为例
|
24
24
|
# 其他鉴权服务提供商所需的环境变量,请参考:https://lobehub.com/zh/docs/self-hosting/environment-variables/auth
|
25
|
-
|
26
|
-
|
27
|
-
|
25
|
+
AUTH_LOGTO_CLIENT_ID=YOUR_LOGTO_CLIENT_ID
|
26
|
+
AUTH_LOGTO_CLIENT_SECRET=YOUR_LOGTO_CLIENT_SECRET
|
27
|
+
AUTH_LOGTO_ISSUER=https://lobe-auth-api.example.com/oidc
|
28
28
|
|
29
29
|
# 代理相关,如果你需要的话(比如你使用 GitHub 作为鉴权服务提供商)
|
30
30
|
# HTTP_PROXY=http://localhost:7890
|
@@ -1,3 +1,4 @@
|
|
1
|
+
name: lobe-chat-database
|
1
2
|
services:
|
2
3
|
postgresql:
|
3
4
|
image: pgvector/pgvector:pg16
|
@@ -52,7 +53,7 @@ services:
|
|
52
53
|
|
53
54
|
lobe:
|
54
55
|
image: lobehub/lobe-chat-database
|
55
|
-
container_name: lobe-
|
56
|
+
container_name: lobe-chat
|
56
57
|
ports:
|
57
58
|
- '3210:3210'
|
58
59
|
depends_on:
|
@@ -1,3 +1,4 @@
|
|
1
|
+
name: lobe-chat-database
|
1
2
|
services:
|
2
3
|
postgresql:
|
3
4
|
image: pgvector/pgvector:pg16
|
@@ -32,14 +33,13 @@ services:
|
|
32
33
|
restart: always
|
33
34
|
command: >
|
34
35
|
server /etc/minio/data --address ":9000" --console-address ":9001"
|
35
|
-
|
36
|
+
|
37
|
+
|
36
38
|
zitadel:
|
37
39
|
restart: always
|
38
40
|
image: ghcr.io/zitadel/zitadel:latest
|
39
41
|
container_name: lobe-zitadel
|
40
|
-
command: start-from-init --config /zitadel-config.yaml --steps
|
41
|
-
/zitadel-init-steps.yaml --masterkey "cft3Tekr/rQBOqwoQSCPoncA9BHbn7QJ"
|
42
|
-
--tlsMode external #MasterkeyNeedsToHave32Characters
|
42
|
+
command: start-from-init --config /zitadel-config.yaml --steps /zitadel-init-steps.yaml --masterkey "cft3Tekr/rQBOqwoQSCPoncA9BHbn7QJ" --tlsMode external #MasterkeyNeedsToHave32Characters
|
43
43
|
ports:
|
44
44
|
- 8080:8080
|
45
45
|
volumes:
|
@@ -51,7 +51,7 @@ services:
|
|
51
51
|
|
52
52
|
lobe:
|
53
53
|
image: lobehub/lobe-chat-database
|
54
|
-
container_name: lobe-
|
54
|
+
container_name: lobe-chat
|
55
55
|
ports:
|
56
56
|
- '3210:3210'
|
57
57
|
depends_on:
|
@@ -27,8 +27,8 @@ https://your-domain/api/auth/callback/authentik
|
|
27
27
|
```
|
28
28
|
|
29
29
|
<Callout type={'info'}>
|
30
|
-
- 可以之后再填写或修改 `重定向 URL/Origin(正则)`,但是务必保证填写的 URL 与部署的 URL 一致。
|
31
|
-
your-domain 请替换为自己的域名
|
30
|
+
- 可以之后再填写或修改 `重定向 URL/Origin(正则)`,但是务必保证填写的 URL 与部署的 URL 一致。
|
31
|
+
- your-domain 请替换为自己的域名
|
32
32
|
</Callout>
|
33
33
|
|
34
34
|
<Image
|
@@ -0,0 +1,120 @@
|
|
1
|
+
---
|
2
|
+
title: Configuring Casdoor Authentication Service in LobeChat
|
3
|
+
description: Learn how to configure the Casdoor authentication service in LobeChat, including deployment, creation, permission settings, and environment variables.
|
4
|
+
tags:
|
5
|
+
- Casdoor Authentication
|
6
|
+
- Environment Variable Configuration
|
7
|
+
- Single Sign-On
|
8
|
+
- LobeChat
|
9
|
+
---
|
10
|
+
|
11
|
+
# Configuring Casdoor Authentication Service
|
12
|
+
|
13
|
+
[Casdoor](https://github.com/casdoor/casdoor) is an open-source authentication service that is rich in features and easy to use.
|
14
|
+
|
15
|
+
<Callout type={'tip'}>
|
16
|
+
If you want to privately deploy Casdoor, we recommend using Docker Compose to deploy it together with the LobeChat database version, allowing LobeChat to share the same Postgres instance.
|
17
|
+
</Callout>
|
18
|
+
|
19
|
+
## Casdoor Configuration Process
|
20
|
+
|
21
|
+
If you are deploying using a local network IP, the following assumptions apply:
|
22
|
+
|
23
|
+
- Your LobeChat database version IP/port is `http://LOBECHAT_IP:3210`.
|
24
|
+
- You privately deploy Casdoor, and its domain is `http://CASDOOR_IP:8000`.
|
25
|
+
|
26
|
+
If you are deploying using a public network, the following assumptions apply:
|
27
|
+
|
28
|
+
- Your LobeChat database version domain is `https://lobe.example.com`.
|
29
|
+
- You privately deploy Casdoor, and its domain is `https://lobe-auth-api.example.com`.
|
30
|
+
|
31
|
+
<Steps>
|
32
|
+
### Create a Casdoor Application
|
33
|
+
|
34
|
+
Access your privately deployed Casdoor WebUI (default is `http://localhost:8000/`) to enter the console. The default account is `admin`, and the password is `123`.
|
35
|
+
|
36
|
+
Go to `Authentication` -> `Applications`, create a `LobeChat` application or directly modify the built-in `built-in` application. You can explore other fields, but you must configure at least the following fields:
|
37
|
+
|
38
|
+
- Name, Display Name: `LobeChat`
|
39
|
+
- Redirect URLs:
|
40
|
+
- Local Development Environment: `http://localhost:3210/api/auth/callback/casdoor`
|
41
|
+
- Local Network IP Deployment: `http://LOBECHAT_IP:3210/api/auth/callback/casdoor`
|
42
|
+
- Public Network Environment: `https://lobe.example.com/api/auth/callback/casdoor`
|
43
|
+
|
44
|
+
There are also some optional fields that can enhance user experience:
|
45
|
+
|
46
|
+
- Logo: `https://lobehub.com/icon-192x192.png`
|
47
|
+
- Form CSS, Form CSS (Mobile):
|
48
|
+
|
49
|
+
```html
|
50
|
+
<style>
|
51
|
+
.login-panel {
|
52
|
+
padding: 40px 70px 0 70px;
|
53
|
+
border-radius: 10px;
|
54
|
+
background-color: #ffffff;
|
55
|
+
box-shadow: rgba(17, 12, 46, 0.15) 0px 48px 100px 0px;
|
56
|
+
}
|
57
|
+
.panel-logo {
|
58
|
+
width: 64px;
|
59
|
+
}
|
60
|
+
.login-logo-box {
|
61
|
+
margin-top: 20px;
|
62
|
+
}
|
63
|
+
|
64
|
+
#parent-area
|
65
|
+
> main
|
66
|
+
> div
|
67
|
+
> div.login-content
|
68
|
+
> div.login-panel
|
69
|
+
> div.login-form
|
70
|
+
> div
|
71
|
+
> div
|
72
|
+
> button {
|
73
|
+
box-shadow: none !important;
|
74
|
+
border-radius: 10px !important;
|
75
|
+
transition-property: all;
|
76
|
+
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
77
|
+
transition-duration: 150ms;
|
78
|
+
border: 1px solid #eee !important;
|
79
|
+
}
|
80
|
+
|
81
|
+
@media (max-width: 640px) {
|
82
|
+
.login-panel {
|
83
|
+
padding: 40px 0 0 0;
|
84
|
+
box-shadow: none;
|
85
|
+
}
|
86
|
+
}
|
87
|
+
|
88
|
+
</style>
|
89
|
+
```
|
90
|
+
|
91
|
+
Then, copy the `Client ID` and `Client Secret` and save them.
|
92
|
+
|
93
|
+
### Configure Environment Variables
|
94
|
+
|
95
|
+
Set the obtained `Client ID` and `Client Secret` as `AUTH_CASDOOR_ID` and `AUTH_CASDOOR_SECRET` in the LobeChat environment variables.
|
96
|
+
|
97
|
+
Configure `AUTH_CASDOOR_ISSUER` in the LobeChat environment variables as follows:
|
98
|
+
|
99
|
+
- `http://localhost:8000/` if you are in a local development environment.
|
100
|
+
- `http://CASDOOR_IP:8000/` if you are privately deploying Casdoor in a local network.
|
101
|
+
- `https://lobe-auth-api.example.com/` if you are deploying Casdoor in a public network environment.
|
102
|
+
|
103
|
+
When deploying LobeChat, you need to configure the following environment variables:
|
104
|
+
|
105
|
+
| Environment Variable | Type | Description |
|
106
|
+
| --- | --- | --- |
|
107
|
+
| `NEXT_AUTH_SECRET` | Required | A key for encrypting Auth.js session tokens. You can generate a key using the command: `openssl rand -base64 32`. |
|
108
|
+
| `NEXT_AUTH_SSO_PROVIDERS` | Required | Select the single sign-on provider for LobeChat. Fill in `casdoor` for using Casdoor. |
|
109
|
+
| `AUTH_CASDOOR_ID` | Required | The client ID from the Casdoor application details page. |
|
110
|
+
| `AUTH_CASDOOR_SECRET` | Required | The client secret from the Casdoor application details page. |
|
111
|
+
| `AUTH_CASDOOR_ISSUER` | Required | The OpenID Connect issuer for the Casdoor provider. |
|
112
|
+
| `NEXTAUTH_URL` | Required | This URL specifies the callback address for Auth.js during OAuth verification and needs to be set only if the default generated redirect address is incorrect. `https://lobe.example.com/api/auth` |
|
113
|
+
|
114
|
+
<Callout type={'tip'}>
|
115
|
+
Visit [📘 Environment Variables](/docs/self-hosting/environment-variables/auth#casdoor) for details on related variables.
|
116
|
+
|
117
|
+
</Callout>
|
118
|
+
</Steps>
|
119
|
+
|
120
|
+
<Callout type={'info'}>Once deployed successfully, users will be able to authenticate via Casdoor and use LobeChat.</Callout>
|