@lobehub/chat 1.14.7 → 1.14.9

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 CHANGED
@@ -2,6 +2,48 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ### [Version 1.14.9](https://github.com/lobehub/lobe-chat/compare/v1.14.8...v1.14.9)
6
+
7
+ <sup>Released on **2024-08-29**</sup>
8
+
9
+ <br/>
10
+
11
+ <details>
12
+ <summary><kbd>Improvements and Fixes</kbd></summary>
13
+
14
+ </details>
15
+
16
+ <div align="right">
17
+
18
+ [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
19
+
20
+ </div>
21
+
22
+ ### [Version 1.14.8](https://github.com/lobehub/lobe-chat/compare/v1.14.7...v1.14.8)
23
+
24
+ <sup>Released on **2024-08-29**</sup>
25
+
26
+ #### 🐛 Bug Fixes
27
+
28
+ - **misc**: Fix whisper-1 typo.
29
+
30
+ <br/>
31
+
32
+ <details>
33
+ <summary><kbd>Improvements and Fixes</kbd></summary>
34
+
35
+ #### What's fixed
36
+
37
+ - **misc**: Fix whisper-1 typo, closes [#3665](https://github.com/lobehub/lobe-chat/issues/3665) ([084c971](https://github.com/lobehub/lobe-chat/commit/084c971))
38
+
39
+ </details>
40
+
41
+ <div align="right">
42
+
43
+ [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
44
+
45
+ </div>
46
+
5
47
  ### [Version 1.14.7](https://github.com/lobehub/lobe-chat/compare/v1.14.6...v1.14.7)
6
48
 
7
49
  <sup>Released on **2024-08-28**</sup>
@@ -1,35 +1,33 @@
1
- # LobeChat domain
2
- APP_URL=https://localhost:3210
1
+ # Logto secret
2
+ LOGTO_CLIENT_ID=
3
+ LOGTO_CLIENT_SECRET=
3
4
 
4
- # Postgres related, which are the necessary environment variables for DB
5
- # Key used to encrypt sensitive information; can be generated using openssl rand -base64 32
6
- KEY_VAULTS_SECRET=Kix2wcUONd4CX51E/ZPAd36BqM4wzJgKjPtz2sGztqQ=
7
- # Postgres database connection string
8
- # Format: postgres://username:password@host:port/dbname; if your pg instance is a Docker container, use the container name
9
- DATABASE_URL=postgresql://postgres:uWNZugjBqixf8dxC@postgresql:5432/postgres
10
-
11
- # NEXT_AUTH related; can use auth0, Azure AD, GitHub, Authentik, Zitadel, Logto, etc. If you have other integration requests, feel free to submit a PR.
12
- # Here we take Logto as an example
13
- NEXT_AUTH_SECRET=NX2kaPE923dt6BL2U8e9oSre5RfoT7hg
14
- NEXT_AUTH_SSO_PROVIDERS=logto
15
- NEXTAUTH_URL=http://localhost:3210/api/auth
16
- LOGTO_CLIENT_ID=YOUR_LOGTO_CLIENT_ID
17
- LOGTO_CLIENT_SECRET=YOUR_LOGTO_CLIENT_SECRET
18
- LOGTO_ISSUER=http://localhost:3001/oidc
19
- # Note: If you have ACCESS_CODE, be sure to clear it. We use NEXT_AUTH as the only authentication source.
20
- # Proxy, if you need it (e.g., if you use GitHub as an authentication service provider)
5
+ # MinIO S3 configuration
6
+ MINIO_ROOT_USER=YOUR_MINIO_USER
7
+ MINIO_ROOT_PASSWORD=YOUR_MINIO_PASSWORD
8
+
9
+ # 在下方配置 minio 中添加的桶
10
+ MINIO_LOBE_BUCKET=lobe
11
+ S3_ACCESS_KEY_ID=
12
+ S3_SECRET_ACCESS_KEY=
13
+
14
+ # Proxy, if you need it
21
15
  # HTTP_PROXY=http://localhost:7890
22
16
  # HTTPS_PROXY=http://localhost:7890
23
17
 
24
- # MinIO S3 configuration
25
- S3_ACCESS_KEY_ID=YOUR_S3_ACCESS_KEY_ID # Invalid until manually created in MinIO UI
26
- S3_SECRET_ACCESS_KEY=YOUR_S3_SECRET_ACCESS_KEY # Invalid until manually created in MinIO UI
27
- S3_ENDPOINT=http://localhost:9000
28
- S3_BUCKET=lobe # Invalid until manually created in MinIO UI
29
- S3_ENDPOINT=http://localhost:9000
30
- S3_ENABLE_PATH_STYLE=1
31
18
 
32
19
  # Other environment variables, as needed. You can refer to the environment variables configuration for the client version, making sure not to have ACCESS_CODE.
33
20
  # OPEANAI_API_KEY=sk-xxxx
34
21
  # OPENAI_PROXY_URL=https://api.openai.com/v1
35
22
  # OPENAI_MODEL_LIST=...
23
+
24
+
25
+ # ----- Other config -----
26
+ # if no special requirements, no need to change
27
+ LOBE_PORT=3210
28
+ LOGTO_PORT=3001
29
+ MINIO_PORT=9000
30
+
31
+ # Postgres related, which are the necessary environment variables for DB
32
+ LOBE_DB_NAME=lobechat
33
+ POSTGRES_PASSWORD=uWNZugjBqixf8dxC
@@ -1,35 +1,33 @@
1
- # LobeChat 域名
2
- APP_URL=https://localhost:3210
1
+ # Logto secret
2
+ LOGTO_CLIENT_ID=
3
+ LOGTO_CLIENT_SECRET=
4
+
5
+ # MinIO S3 配置
6
+ MINIO_ROOT_USER=YOUR_MINIO_USER
7
+ MINIO_ROOT_PASSWORD=YOUR_MINIO_PASSWORD
8
+
9
+ # 在下方配置 minio 中添加的桶
10
+ MINIO_LOBE_BUCKET=lobe
11
+ S3_ACCESS_KEY_ID=
12
+ S3_SECRET_ACCESS_KEY=
13
+
3
14
 
4
- # Postgres 相关,也即 DB 必须的环境变量
5
- # 用于加密敏感信息的密钥,可以使用 openssl rand -base64 32 生成
6
- KEY_VAULTS_SECRET=Kix2wcUONd4CX51E/ZPAd36BqM4wzJgKjPtz2sGztqQ=
7
- # Postgres 数据库连接字符串
8
- # 格式:postgres://username:password@host:port/dbname,如果你的 pg 实例与 LobeChat 服务在同一 Docker 网络中,可以使用容器名作为 host
9
- DATABASE_URL=postgresql://postgres:uWNZugjBqixf8dxC@localhost:5432/postgres
10
-
11
- # NEXT_AUTH 相关,可以使用 auth0、Azure AD、GitHub、Authentik、Zitadel、Logto 等,如有其他接入诉求欢迎提 PR
12
- # 这里以 Logto 为例
13
- NEXT_AUTH_SECRET=NX2kaPE923dt6BL2U8e9oSre5RfoT7hg
14
- NEXT_AUTH_SSO_PROVIDERS=logto
15
- NEXTAUTH_URL=http://localhost:3210/api/auth
16
- LOGTO_CLIENT_ID=YOUR_LOGTO_CLIENT_ID
17
- LOGTO_CLIENT_SECRET=YOUR_LOGTO_CLIENT_SECRET
18
- LOGTO_ISSUER=http://localhost:3001/oidc
19
- # 注:如果你有 ACCESS_CODE,请务必清空,我们以 NEXT_AUTH 作为唯一鉴权来源
20
15
  # Proxy,如果你需要的话(比如你使用 GitHub 作为鉴权服务提供商)
21
16
  # HTTP_PROXY=http://localhost:7890
22
17
  # HTTPS_PROXY=http://localhost:7890
23
18
 
24
- # MinIO S3 配置
25
- S3_ACCESS_KEY_ID=YOUR_S3_ACCESS_KEY_ID # 直到在 MinIO UI 中手动创建之前都是无效的
26
- S3_SECRET_ACCESS_KEY=YOUR_S3_SECRET_ACCESS_KEY # 直到在 MinIO UI 中手动创建之前都是无效的
27
- S3_ENDPOINT=http://localhost:9000
28
- S3_BUCKET=lobe # 直到在 MinIO UI 中手动创建之前都是无效的
29
- S3_PUBLIC_DOMAIN=http://localhost:9000
30
- S3_ENABLE_PATH_STYLE=1
31
-
32
19
  # 其他环境变量,视需求而定,可以参照客户端版本的环境变量配置,注意不要有 ACCESS_CODE
33
20
  # OPEANAI_API_KEY=sk-xxxx
34
21
  # OPENAI_PROXY_URL=https://api.openai.com/v1
35
22
  # OPENAI_MODEL_LIST=...
23
+
24
+
25
+ # ----- 相关配置 start -----
26
+ # 如没有特殊需要不用更改
27
+ LOBE_PORT=3210
28
+ LOGTO_PORT=3001
29
+ MINIO_PORT=9000
30
+
31
+ # Postgres 相关,也即 DB 必须的环境变量
32
+ LOBE_DB_NAME=lobechat
33
+ POSTGRES_PASSWORD=uWNZugjBqixf8dxC
@@ -1,58 +1,92 @@
1
1
  services:
2
+ network-service:
3
+ image: alpine
4
+ container_name: lobe-network
5
+ ports:
6
+ - '${MINIO_PORT}:${MINIO_PORT}' # MinIO API
7
+ - '9001:9001' # MinIO Console
8
+ - '${LOGTO_PORT}:${LOGTO_PORT}' # Logto
9
+ - '3002:3002' # Logto Admin
10
+ - '${LOBE_PORT}:3210' # LobeChat
11
+ command: tail -f /dev/null
12
+ networks:
13
+ - lobe-network
14
+
2
15
  postgresql:
3
16
  image: pgvector/pgvector:pg16
4
17
  container_name: lobe-postgres
5
- network_mode: 'host'
18
+ ports:
19
+ - "5432:5432"
6
20
  volumes:
7
21
  - './data:/var/lib/postgresql/data'
8
22
  environment:
9
- - 'POSTGRES_DB=lobe'
10
- - 'POSTGRES_PASSWORD=uWNZugjBqixf8dxC'
23
+ - 'POSTGRES_DB=${LOBE_DB_NAME}'
24
+ - 'POSTGRES_PASSWORD=${POSTGRES_PASSWORD}'
11
25
  healthcheck:
12
26
  test: ['CMD-SHELL', 'pg_isready -U postgres']
13
27
  interval: 5s
14
28
  timeout: 5s
15
29
  retries: 5
16
30
  restart: always
31
+ networks:
32
+ - lobe-network
17
33
 
18
34
  minio:
19
35
  image: minio/minio
20
36
  container_name: lobe-minio
21
- network_mode: 'host'
37
+ network_mode: 'service:network-service'
22
38
  volumes:
23
39
  - './s3_data:/etc/minio/data'
24
40
  environment:
25
- - 'MINIO_ROOT_USER=YOUR_MINIO_USER'
26
- - 'MINIO_ROOT_PASSWORD=YOUR_MINIO_PASSWORD'
27
- - 'MINIO_DOMAIN=localhost:9000'
28
- - 'MINIO_API_CORS_ALLOW_ORIGIN=http://localhost:3210'
41
+ - 'MINIO_ROOT_USER=${MINIO_ROOT_USER}'
42
+ - 'MINIO_ROOT_PASSWORD=${MINIO_ROOT_PASSWORD}'
43
+ - 'MINIO_API_CORS_ALLOW_ORIGIN=http://localhost:${LOBE_PORT}'
29
44
  restart: always
30
45
  command: >
31
- server /etc/minio/data --address ":9000" --console-address ":9001"
32
-
46
+ server /etc/minio/data --address ":${MINIO_PORT}" --console-address ":9001"
33
47
 
34
48
  logto:
35
49
  image: svhd/logto
36
50
  container_name: lobe-logto
37
- network_mode: 'host'
51
+ network_mode: 'service:network-service'
38
52
  depends_on:
39
53
  postgresql:
40
54
  condition: service_healthy
41
55
  environment:
42
56
  - 'TRUST_PROXY_HEADER=1'
43
- - 'DB_URL=postgresql://postgres:uWNZugjBqixf8dxC@localhost:5432/logto'
44
- - 'ENDPOINT=http://localhost:3001'
57
+ - 'PORT=${LOGTO_PORT}'
58
+ - 'DB_URL=postgresql://postgres:${POSTGRES_PASSWORD}@postgresql:5432/logto'
59
+ - 'ENDPOINT=http://localhost:${LOGTO_PORT}'
45
60
  - 'ADMIN_ENDPOINT=http://localhost:3002'
46
61
  entrypoint: ['sh', '-c', 'npm run cli db seed -- --swe && npm start']
47
62
 
63
+
48
64
  lobe:
49
65
  image: lobehub/lobe-chat-database
50
66
  container_name: lobe-database
51
- network_mode: 'host'
67
+ network_mode: 'service:network-service'
52
68
  depends_on:
53
- - postgresql
54
- - minio
55
- - logto
69
+ postgresql:
70
+ condition: service_healthy
71
+ network-service:
72
+ condition: service_started
73
+ minio:
74
+ condition: service_started
75
+ logto:
76
+ condition: service_started
77
+
78
+ environment:
79
+ - 'APP_URL=http://localhost:3210'
80
+ - 'NEXT_AUTH_SSO_PROVIDERS=logto'
81
+ - 'KEY_VAULTS_SECRET=Kix2wcUONd4CX51E/ZPAd36BqM4wzJgKjPtz2sGztqQ='
82
+ - 'NEXT_AUTH_SECRET=NX2kaPE923dt6BL2U8e9oSre5RfoT7hg'
83
+ - 'NEXTAUTH_URL=http://localhost:${LOBE_PORT}/api/auth'
84
+ - 'LOGTO_ISSUER=http://localhost:${LOGTO_PORT}/oidc'
85
+ - 'DATABASE_URL=postgresql://postgres:${POSTGRES_PASSWORD}@postgresql:5432/${LOBE_DB_NAME}'
86
+ - 'S3_ENDPOINT=http://localhost:${MINIO_PORT}'
87
+ - 'S3_BUCKET=${MINIO_LOBE_BUCKET}'
88
+ - 'S3_PUBLIC_DOMAIN=http://localhost:${MINIO_PORT}'
89
+ - 'S3_ENABLE_PATH_STYLE=1'
56
90
  env_file:
57
91
  - .env
58
92
  restart: always
@@ -62,3 +96,7 @@ volumes:
62
96
  driver: local
63
97
  s3_data:
64
98
  driver: local
99
+
100
+ networks:
101
+ lobe-network:
102
+ driver: bridge
@@ -137,22 +137,45 @@ LobeChat provides a complete authentication service capability when deployed. Th
137
137
  #### `CLOUDFLARE_ZERO_TRUST_CLIENT_ID`
138
138
 
139
139
  - Type: Required
140
- - Description: Client ID of the Cloudflare Zero Trust provider application. You can access it [here][auth0-client-page] and navigate to the application settings to view.
140
+ - Description: Client ID of the Cloudflare Zero Trust provider application.
141
141
  - Default: `-`
142
- - Example: `lobe-chat`
142
+ - Example: `711963a58df8c943cfd6c487cac99ce9f6ee0c88c0b7bf94584b8ff052fcb09c`
143
143
 
144
144
  #### `CLOUDFLARE_ZERO_TRUST_CLIENT_SECRET`
145
145
 
146
146
  - Type: Required
147
147
  - Description: The plaintext of the Client Secret for the Cloudflare Zero Trust provider
148
148
  - Default: `-`
149
- - Example: `insecure_secret`
149
+ - Example: `8f26d4ef834a828045b401e032ae128dbb00471bca53f0d25332323f525dfa30`
150
150
 
151
151
  #### `CLOUDFLARE_ZERO_TRUST_ISSUER`
152
152
 
153
153
  - Type: Required
154
154
  - Description: Issuer of the Cloudflare Zero Trust provider application.
155
155
  - Default: `-`
156
+ - Example: `https://example.cloudflareaccess.com/cdn-cgi/access/sso/oidc/711963a58df8c943cfd6c487cac99ce9f6ee0c88c0b7bf94584b8ff052fcb09c`
157
+
158
+ ### Generic OIDC
159
+
160
+ #### `GENERIC_OIDC_CLIENT_ID`
161
+
162
+ - Type: Required
163
+ - Description: Client ID of the Generic OIDC provider application.
164
+ - Default: `-`
165
+ - Example: `_client_id_for_lobe_chat_`
166
+
167
+ #### `GENERIC_OIDC_CLIENT_SECRET`
168
+
169
+ - Type: Required
170
+ - Description: The plaintext of the Client Secret for the Generic OIDC provider
171
+ - Default: `-`
172
+ - Example: `_client_secret_for_lobe_chat_`
173
+
174
+ #### `GENERIC_OIDC_ISSUER`
175
+
176
+ - Type: Required
177
+ - Description: Issuer of the Generic OIDC provider application.
178
+ - Default: `-`
156
179
  - Example: `https://sso.example.com`
157
180
 
158
181
  ### Github
@@ -137,20 +137,43 @@ LobeChat 在部署时提供了完善的身份验证服务能力,以下是相
137
137
  - 类型:必选
138
138
  - 描述: Cloudflare Zero Trust 提供程序的 Client ID
139
139
  - 默认值: `-`
140
- - 示例: `lobe-chat`
140
+ - 示例: `711963a58df8c943cfd6c487cac99ce9f6ee0c88c0b7bf94584b8ff052fcb09c`
141
141
 
142
142
  #### `CLOUDFLARE_ZERO_TRUST_CLIENT_SECRET`
143
143
 
144
144
  - 类型:必选
145
145
  - 描述: Cloudflare Zero Trust 提供程序的 Client Secret 的明文
146
146
  - 默认值: `-`
147
- - 示例: `insecure_secret`
147
+ - 示例: `8f26d4ef834a828045b401e032ae128dbb00471bca53f0d25332323f525dfa30`
148
148
 
149
149
  #### `CLOUDFLARE_ZERO_TRUST_ISSUER`
150
150
 
151
151
  - 类型:必选
152
152
  - 描述: Cloudflare Zero Trust 提供程序的 OpenID Connect 颁发者
153
153
  - 默认值: `-`
154
+ - 示例: `https://example.cloudflareaccess.com/cdn-cgi/access/sso/oidc/711963a58df8c943cfd6c487cac99ce9f6ee0c88c0b7bf94584b8ff052fcb09c`
155
+
156
+ ### Generic OIDC
157
+
158
+ #### `GENERIC_OIDC_CLIENT_ID`
159
+
160
+ - 类型:必选
161
+ - 描述: Generic OIDC 提供程序的 Client ID
162
+ - 默认值: `-`
163
+ - 示例: `_client_id_for_lobe_chat_`
164
+
165
+ #### `GENERIC_OIDC_CLIENT_SECRET`
166
+
167
+ - 类型:必选
168
+ - 描述: Generic OIDC 提供程序的 Client Secret 的明文
169
+ - 默认值: `-`
170
+ - 示例: `_client_secret_for_lobe_chat_`
171
+
172
+ #### `GENERIC_OIDC_ISSUER`
173
+
174
+ - 类型:必选
175
+ - 描述: Generic OIDC 提供程序的 OpenID Connect 颁发者
176
+ - 默认值: `-`
154
177
  - 示例: `https://sso.example.com`
155
178
 
156
179
  ### Github
@@ -36,32 +36,42 @@ If you do need Clerk as an authentication service, you might consider deploying
36
36
 
37
37
  </Callout>
38
38
 
39
+ Generally speaking, to fully run the LobeChat database version, you need at least the following four services:
40
+
41
+ - LobeChat database version itself
42
+ - PostgreSQL database with PGVector plugin
43
+ - Object storage service supporting S3 protocol
44
+ - SSO authentication service supported by LobeChat
45
+
46
+ These services can be combined through self-hosting or online cloud services to meet your needs.
47
+
48
+ We provide a fully self-built Docker Compose configuration, which you can use directly to start the LobeChat database version or modify to suit your needs.
49
+
50
+ We default to using [MinIO](https://github.com/minio/minio) as the local S3 object storage service and [Logto](https://github.com/logto-io/logto) as the local authentication service.
51
+
39
52
  ## Quick Start
40
53
 
41
- The following assumes that you choose to build all four required services for LobeChat, namely:
54
+ To facilitate quick start, this chapter uses the docker-compose configuration file in the `docker-compose/local` directory. The LobeChat application runs at `http://localhost:3210` after startup and can be run locally.
42
55
 
43
- - LobeChat database version itself
44
- - PostgreSQL: with PGVector plugin
45
- - Logto: SSO authentication service
46
- - MinIO: local object storage service supporting S3 protocol
56
+ <Callout type="warning">
57
+ To facilitate quick start, this docker-compose.yml omits a large number of Secret/Password configurations and is only suitable for quick demonstration or personal local use. Do not use it directly in a production environment! Otherwise, you will be responsible for any security issues!
58
+ </Callout>
47
59
 
48
60
  <Steps>
49
61
  ### Create Configuration Files
50
62
 
63
+ Create a new `lobe-chat-db` directory to store your configuration files and subsequent database files.
64
+
51
65
  ```sh
52
- curl -fsSL https://raw.githubusercontent.com/lobehub/lobe-chat/HEAD/docker-compose/local/docker-compose.yml
53
- curl -fsSL https://raw.githubusercontent.com/lobehub/lobe-chat/HEAD/docker-compose/local/.env.example > .env
66
+ mkdir lobe-chat-db
54
67
  ```
55
68
 
56
- You can also copy these two example configuration files from the appendix below.
57
-
58
- Please modify your `.env` and `docker-compose.yml` files according to the comments.
59
-
60
- <Callout type="warning">
61
-
62
- Due to network reasons, when starting locally, we intentionally let all services use `network_mode: host` simultaneously. This can solve some network issues, but it may cause port conflicts, please resolve them yourself.
69
+ Pull the configuration files into your directory:
63
70
 
64
- </Callout>
71
+ ```sh
72
+ curl -fsSL https://raw.githubusercontent.com/lobehub/lobe-chat/HEAD/docker-compose/local/docker-compose.yml > docker-compose.yml
73
+ curl -fsSL https://raw.githubusercontent.com/lobehub/lobe-chat/HEAD/docker-compose/local/.env.example > .env
74
+ ```
65
75
 
66
76
  ### Start Services
67
77
 
@@ -77,17 +87,14 @@ docker compose up -d
77
87
 
78
88
  - `Redirect URI` should be `http://localhost:3210/api/auth/callback/logto`
79
89
  - `Post sign-out redirect URI` should be `http://localhost:3210/`
80
- - `CORS allowed origins` should be `http://localhost:3210`
81
90
 
82
91
  3. Obtain the `Client ID` and `Client Secret`, and fill them into your `.env` file corresponding to `LOGTO_CLIENT_ID` and `LOGTO_CLIENT_SECRET`.
83
92
 
84
- 4. Set `LOGTO_ISSUER` in your `.env` file to `http://localhost:3001/oidc`.
85
-
86
93
  ### Configure MinIO S3
87
94
 
88
- 1. Open `http://localhost:9001` to access the MinIO WebUI. The default admin account password is configured in `docker-compose.yml`.
95
+ 1. Open `http://localhost:9001` to access the MinIO WebUI. The default admin account password is configured in `.env`.
89
96
 
90
- 2. Create a bucket that matches the `S3_BUCKET` field in your `.env` file, which defaults to `lobe`.
97
+ 2. Create a bucket that matches the `MINIO_LOBE_BUCKET` field in your `.env` file, which defaults to `lobe`.
91
98
 
92
99
  3. Choose a custom policy, copy the following content, and paste it in (if you modified the bucket name, please find and replace accordingly):
93
100
 
@@ -140,15 +147,6 @@ docker compose up -d
140
147
  At this point, do not use `docker compose restart lobe` to restart, as this method will not reload the environment variables, and your S3 configuration will not take effect.
141
148
 
142
149
  </Callout>
143
- </Steps>
144
-
145
- You have successfully deployed the LobeChat database version, and you can access your LobeChat service at `http://localhost:3210`.
146
-
147
- If you encounter issues, please check the Docker logs and console logs, and follow the detailed troubleshooting guide later in the document.
148
-
149
- ```sh
150
- docker logs -f lobe-database
151
- ```
152
150
 
153
151
  If you see the following logs in the container, it indicates that it has started successfully:
154
152
 
@@ -164,22 +162,15 @@ If you see the following logs in the container, it indicates that it has started
164
162
  ✓ Ready in 95ms
165
163
  ```
166
164
 
167
- ## Deploying to Production
168
-
169
- Generally speaking, to fully run the LobeChat database version, you need at least the following four services:
170
-
171
- - LobeChat database version itself
172
- - PostgreSQL database with PGVector plugin
173
- - Object storage service supporting S3 protocol
174
- - SSO authentication service supported by LobeChat
165
+ </Steps>
175
166
 
176
- These services can be combined through self-hosting or online cloud services to meet your needs.
167
+ You have successfully deployed the LobeChat database version, and you can access your LobeChat service at `http://localhost:3210`.
177
168
 
178
- We provide a fully self-built Docker Compose configuration, which you can use directly to start the LobeChat database version or modify to suit your needs.
169
+ If you encounter issues, please check the Docker logs and console logs, and follow the detailed troubleshooting guide later in the document.
179
170
 
180
- We default to using [MinIO](https://github.com/minio/minio) as the local S3 object storage service and [Logto](https://github.com/logto-io/logto) as the local authentication service.
171
+ ## Deploying to Production
181
172
 
182
- We also assume that you are running an Nginx layer for reverse proxy and SSL configuration outside of these services.
173
+ The main difference between production and local operation is the need to use domain addresses instead of localhost. We assume that in addition to the above services, you are also running an Nginx layer for reverse proxy and SSL configuration.
183
174
 
184
175
  The domain names and corresponding service port descriptions are as follows:
185
176
 
@@ -203,7 +194,7 @@ If you need to configure SSL certificates, please configure them uniformly in th
203
194
  ### Configuration Files
204
195
 
205
196
  ```sh
206
- curl -fsSL https://raw.githubusercontent.com/lobehub/lobe-chat/HEAD/docker-compose/production/docker-compose.yml
197
+ curl -fsSL https://raw.githubusercontent.com/lobehub/lobe-chat/HEAD/docker-compose/production/docker-compose.yml > docker-compose.yml
207
198
  curl -fsSL https://raw.githubusercontent.com/lobehub/lobe-chat/HEAD/docker-compose/production/.env.example > .env
208
199
  ```
209
200
 
@@ -215,13 +206,6 @@ Refer to the example configurations in the appendix of this article.
215
206
 
216
207
  ### PostgreSQL Database Configuration
217
208
 
218
- <Callout type="warning">
219
- Please note that on the first run of `docker compose up -d`, it may fail with a `Database migrate
220
- failed` error and exit because the Postgres database has not yet been initialized while LobeChat
221
- has already attempted to connect. In this case, you need to enter `docker compose restart lobe` to
222
- restart LobeChat so that it connects to the correct database.
223
- </Callout>
224
-
225
209
  You can check the logs using the following command:
226
210
 
227
211
  ```sh
@@ -391,14 +375,13 @@ S3_ACCESS_KEY_ID=YOUR_S3_ACCESS_KEY_ID # Invalid until manually created
391
375
  S3_SECRET_ACCESS_KEY=YOUR_S3_SECRET_ACCESS_KEY # Invalid until manually created in MinIO UI
392
376
  S3_ENDPOINT=http://localhost:9000
393
377
  S3_BUCKET=lobe # Invalid until manually created in MinIO UI
394
- S3_ENDPOINT=http://localhost:9000
378
+ S3_PUBLIC_DOMAIN=http://localhost:9000
395
379
  S3_ENABLE_PATH_STYLE=1
396
380
 
397
381
  # Other environment variables, as needed. You can refer to the environment variables configuration for the client version, making sure not to have ACCESS_CODE.
398
382
  # OPEANAI_API_KEY=sk-xxxx
399
383
  # OPENAI_PROXY_URL=https://api.openai.com/v1
400
384
  # OPENAI_MODEL_LIST=...
401
-
402
385
  ```
403
386
 
404
387
  #### `docker-compose.yml`
@@ -467,7 +450,6 @@ volumes:
467
450
  driver: local
468
451
  s3_data:
469
452
  driver: local
470
-
471
453
  ```
472
454
 
473
455
  ### Deploying to Production
@@ -584,7 +566,6 @@ volumes:
584
566
  driver: local
585
567
  s3_data:
586
568
  driver: local
587
-
588
569
  ```
589
570
 
590
571
  #### `minio-bucket-config.json`
@@ -33,30 +33,43 @@ tags:
33
33
 
34
34
  </Callout>
35
35
 
36
+ 一般来讲,想要完整的运行 LobeChat 数据库版本,你需要至少拥有如下四个服务
37
+
38
+ - LobeChat 数据库版本自身
39
+ - 带有 PGVector 插件的 PostgreSQL 数据库
40
+ - 支持 S3 协议的对象存储服务
41
+ - 受 LobeChat 支持的 SSO 登录鉴权服务
42
+
43
+ 这些服务可以通过自建或者在线云服务组合搭配,以满足不同层次的部署需求。
44
+
45
+ 本文中,我们提供了完全基于开源自建服务的 Docker Compose 配置,你可以直接使用这份配置文件来启动 LobeChat 数据库版本,也可以对之进行修改以适应你的需求。
46
+
47
+ 我们默认使用 [MinIO](https://github.com/minio/minio) 作为本地 S3 对象存储服务,使用 [Logto](https://github.com/logto-io/logto) 作为本地鉴权服务。
48
+
36
49
  ## 快速启动
37
50
 
38
- 以下假设你选择自建 LobeChat 全部四个所需服务,即:
51
+ 为方便快速上手,这一章使用 `docker-compose/local` 目录中的 docker-compose 配置文件,启动后的 LobeChat 应用运行在 `http://localhost:3210`,可在本地运行。
39
52
 
40
- - LobeChat 数据库版本自身
41
- - PostgreSQL:带有 PGVector 插件
42
- - Logto:SSO 登录鉴权服务
43
- - MinIO:支持 S3 协议的本地对象存储服务
53
+ <Callout type="warning">
54
+ 为了快速上手,此 docker-compose.yml内置掉了大量的 Secret/Password
55
+ 的配置,仅适用于快速演示或个人本地使用。请勿直接用于线上生产环境!否则遇到安全问题请自行负责!
56
+ </Callout>
44
57
 
45
58
  <Steps>
46
59
  ### 创建配置文件
47
60
 
61
+ 新建一个 `lobe-chat-db` 目录,用于存放你的配置文件和后续的数据库文件。
62
+
48
63
  ```sh
49
- curl -fsSL https://raw.githubusercontent.com/lobehub/lobe-chat/HEAD/docker-compose/local/docker-compose.yml
50
- curl -fsSL https://raw.githubusercontent.com/lobehub/lobe-chat/HEAD/docker-compose/local/.env.zh-CN.example > .env
64
+ mkdir lobe-chat-db
51
65
  ```
52
66
 
53
- 你也可以从下文的附录中复制得到这两份示例配置文件。
67
+ 拉取配置文件到你的目录中:
54
68
 
55
- 请按照注释,修改你的 `.env` 和 `docker-compose.yml` 文件。
56
-
57
- <Callout type="warning">
58
- 出于网络原因,本地启动时,我们特意让所有服务都同时使用了 `network_mode: host`。这可以解决一些网络问题,但是有可能会导致端口冲突,请自行解决。
59
- </Callout>
69
+ ```sh
70
+ curl -fsSL https://raw.githubusercontent.com/lobehub/lobe-chat/HEAD/docker-compose/local/docker-compose.yml > docker-compose.yml
71
+ curl -fsSL https://raw.githubusercontent.com/lobehub/lobe-chat/HEAD/docker-compose/local/.env.zh-CN.example > .env
72
+ ```
60
73
 
61
74
  ### 启动服务
62
75
 
@@ -72,19 +85,16 @@ docker compose up -d
72
85
 
73
86
  - `Redirect URI` 为 `http://localhost:3210/api/auth/callback/logto`
74
87
  - `Post sign-out redirect URI` 为 `http://localhost:3210/`
75
- - `CORS allowed origins` 为 `http://localhost:3210`
76
-
77
- 3. 获取 `Client ID` 和 `Client Secret`,填入你的 `.env` 文件中对应的 `LOGTO_CLIENT_ID` 、 `LOGTO_CLIENT_SECRETT`
78
88
 
79
- 4. 配置你的 `.env` 文件中的 `LOGTO_ISSUER` `http://localhost:3001/oidc`
89
+ 3. 获取 `Client ID` 和 `Client Secret`,填入 `.env` 文件中对应的 `LOGTO_CLIENT_ID` `LOGTO_CLIENT_SECRETT`
80
90
 
81
91
  ### 配置 MinIO S3
82
92
 
83
- 1. 打开 `http://localhost:9001`,访问 MinIO WebUI,默认管理员账号密码在 `docker-compose.yml` 中配置
93
+ 1. 打开 `http://localhost:9001`,访问 MinIO WebUI,默认管理员账号密码在 `.env` 中配置
84
94
 
85
- 2. 创建符合你的 `.env` 文件中 `S3_BUCKET` 字段的桶,默认为 `lobe`
95
+ 2. 创建符合你的 `.env` 文件中 `MINIO_LOBE_BUCKET` 字段的桶,默认为 `lobe`
86
96
 
87
- 3. 选择自定义策略,复制如下内容,粘贴之(如果你修改了桶名,请自行查找替换)
97
+ 3. 选择自定义策略,复制并粘贴如下内容(如果你修改了桶名,请自行查找替换)
88
98
 
89
99
  ```json
90
100
  {
@@ -131,20 +141,11 @@ docker compose up -d
131
141
  docker compose up -d
132
142
  ```
133
143
 
134
- <Callout typr="warning">
135
- 此时,请勿使用 `docker compose restart lobe` 来重启,因为这种重启方式不会重新加载环境变量,你的
136
- S3 配置将不会生效。
137
-
138
- </Callout>
139
- </Steps>
144
+ <Callout typr="warning">
145
+ 此时,请勿使用 `docker compose restart lobe` 来重启,因为这种重启方式不会重新加载环境变量,你的
146
+ S3 配置将不会生效。
140
147
 
141
- 至此,你已经成功部署了 LobeChat 数据库版本,你可以通过 `http://localhost:3210` 访问你的 LobeChat 服务。
142
-
143
- 如果你遇到问题,请尝试查看 Docker 日志和控制台日志,并根据后文的详细指引进行排查。
144
-
145
- ```sh
146
- docker logs -f lobe-database
147
- ```
148
+ </Callout>
148
149
 
149
150
  如果你在容器中看到了以下日志,则说明已经启动成功:
150
151
 
@@ -160,22 +161,16 @@ docker logs -f lobe-database
160
161
  ✓ Ready in 95ms
161
162
  ```
162
163
 
163
- ## 发布到生产
164
-
165
- 一般来讲,想要完整的运行 LobeChat 数据库版本,你需要至少拥有如下四个服务
164
+ </Steps>
166
165
 
167
- - LobeChat 数据库版本自身
168
- - 带有 PGVector 插件的 PostgreSQL 数据库
169
- - 支持 S3 协议的对象存储服务
170
- - 受 LobeChat 支持的 SSO 登录鉴权服务
166
+ 至此,你已经成功部署了 LobeChat 数据库版本,你可以通过 `http://localhost:3210` 访问你的 LobeChat 服务。
171
167
 
172
- 这些服务可以通过自建或者在线云服务组合搭配,以满足你的需求。
168
+ 如果你遇到问题,请尝试查看 Docker 日志和控制台日志,并根据后文的详细指引进行排查。
173
169
 
174
- 我们提供了一份完全基于自建的 Docker Compose 配置,你可以直接使用这份配置文件来启动 LobeChat 数据库版本,也可以对之进行修改以适应你的需求。
175
170
 
176
- 我们默认使用 [MinIO](https://github.com/minio/minio) 作为本地 S3 对象存储服务,使用 [Logto](https://github.com/logto-io/logto) 作为本地鉴权服务。
171
+ ## 发布到生产
177
172
 
178
- 我们同时假设在这些服务之外,你还运行了一层 Nginx 来进行反向代理、配置 SSL。
173
+ 生产和本地运行存在一个很大的差别,就是在于需要使用域名地址而不是 localhost。我们假设在上述服务之外,你还运行了一层 Nginx 来进行反向代理、配置 SSL。
179
174
 
180
175
  域名和配套服务端口说明如下:
181
176
 
@@ -199,7 +194,7 @@ docker logs -f lobe-database
199
194
  ### 配置文件
200
195
 
201
196
  ```sh
202
- curl -fsSL https://raw.githubusercontent.com/lobehub/lobe-chat/HEAD/docker-compose/production/docker-compose.yml
197
+ curl -fsSL https://raw.githubusercontent.com/lobehub/lobe-chat/HEAD/docker-compose/production/docker-compose.yml > docker-compose.yml
203
198
  curl -fsSL https://raw.githubusercontent.com/lobehub/lobe-chat/HEAD/docker-compose/production/.env.zh-CN.example > .env
204
199
  ```
205
200
 
@@ -211,12 +206,6 @@ curl -fsSL https://raw.githubusercontent.com/lobehub/lobe-chat/HEAD/docker-compo
211
206
 
212
207
  ### Postgres 数据库配置
213
208
 
214
- <Callout type="warning">
215
- 请注意,首次运行 `docker compose up -d` 时,可能会因为 Postgres 数据库尚未初始化完毕,而 LobeChat
216
- 已经尝试连接而失败,出现 `Database migrate failed` 错误并退出。此时,你需要输入 `docker compose
217
- restart lobe` 来重启 LobeChat,从而使其连接到正确的数据库。
218
- </Callout>
219
-
220
209
  你可以使用下述指令检查日志:
221
210
 
222
211
  ```sh
@@ -380,7 +369,7 @@ LOGTO_ISSUER=http://localhost:3001/oidc
380
369
  # HTTPS_PROXY=http://localhost:7890
381
370
 
382
371
  # MinIO S3 配置
383
- S3_ACCESS_KEY_ID=YOUR_S3_ACCESS_KEY_ID # 直到在 MinIO UI 中手动创建之前都是无效的
372
+ S3_ACCESS_KEY_ID=YOUR_S3_ACCESS_KEY_ID # 直到在 MinIO UI 中手动创建之前都是无效的
384
373
  S3_SECRET_ACCESS_KEY=YOUR_S3_SECRET_ACCESS_KEY # 直到在 MinIO UI 中手动创建之前都是无效的
385
374
  S3_ENDPOINT=http://localhost:9000
386
375
  S3_BUCKET=lobe # 直到在 MinIO UI 中手动创建之前都是无效的
@@ -391,7 +380,6 @@ S3_ENABLE_PATH_STYLE=1
391
380
  # OPEANAI_API_KEY=sk-xxxx
392
381
  # OPENAI_PROXY_URL=https://api.openai.com/v1
393
382
  # OPENAI_MODEL_LIST=...
394
-
395
383
  ```
396
384
 
397
385
  #### `docker-compose.yml`
@@ -429,6 +417,7 @@ services:
429
417
  command: >
430
418
  server /etc/minio/data --address ":9000" --console-address ":9001"
431
419
 
420
+
432
421
  logto:
433
422
  image: svhd/logto
434
423
  container_name: lobe-logto
@@ -460,7 +449,6 @@ volumes:
460
449
  driver: local
461
450
  s3_data:
462
451
  driver: local
463
-
464
452
  ```
465
453
 
466
454
  ### 发布到生产
@@ -503,7 +491,6 @@ S3_ENABLE_PATH_STYLE=1
503
491
  # OPEANAI_API_KEY=sk-xxxx
504
492
  # OPENAI_PROXY_URL=https://api.openai.com/v1
505
493
  # OPENAI_MODEL_LIST=...
506
-
507
494
  ```
508
495
 
509
496
  #### `docker-compose.yml`
@@ -544,6 +531,7 @@ services:
544
531
  command: >
545
532
  server /etc/minio/data --address ":9000" --console-address ":9001"
546
533
 
534
+
547
535
  logto:
548
536
  image: svhd/logto
549
537
  container_name: lobe-logto
@@ -578,7 +566,6 @@ volumes:
578
566
  driver: local
579
567
  s3_data:
580
568
  driver: local
581
-
582
569
  ```
583
570
 
584
571
  #### `minio-bucket-config.json`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "1.14.7",
3
+ "version": "1.14.9",
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",
@@ -16,7 +16,7 @@ export const opeanaiTTSOptions: SelectProps['options'] = [
16
16
 
17
17
  export const opeanaiSTTOptions: SelectProps['options'] = [
18
18
  {
19
- label: <LabelRenderer Icon={OpenAI.Avatar} label={'stt-1'} />,
19
+ label: <LabelRenderer Icon={OpenAI.Avatar} label={'whisper-1'} />,
20
20
  value: 'whisper-1',
21
21
  },
22
22
  ];
@@ -90,6 +90,11 @@ export const getAuthConfig = () => {
90
90
  CLOUDFLARE_ZERO_TRUST_CLIENT_ID: z.string().optional(),
91
91
  CLOUDFLARE_ZERO_TRUST_CLIENT_SECRET: z.string().optional(),
92
92
  CLOUDFLARE_ZERO_TRUST_ISSUER: z.string().optional(),
93
+
94
+ // Generic OIDC
95
+ GENERIC_OIDC_CLIENT_ID: z.string().optional(),
96
+ GENERIC_OIDC_CLIENT_SECRET: z.string().optional(),
97
+ GENERIC_OIDC_ISSUER: z.string().optional(),
93
98
 
94
99
  // ZITADEL
95
100
  ZITADEL_CLIENT_ID: z.string().optional(),
@@ -142,6 +147,11 @@ export const getAuthConfig = () => {
142
147
  CLOUDFLARE_ZERO_TRUST_CLIENT_ID: process.env.CLOUDFLARE_ZERO_TRUST_CLIENT_ID,
143
148
  CLOUDFLARE_ZERO_TRUST_CLIENT_SECRET: process.env.CLOUDFLARE_ZERO_TRUST_CLIENT_SECRET,
144
149
  CLOUDFLARE_ZERO_TRUST_ISSUER: process.env.CLOUDFLARE_ZERO_TRUST_ISSUER,
150
+
151
+ // Generic OIDC
152
+ GENERIC_OIDC_CLIENT_ID: process.env.GENERIC_OIDC_CLIENT_ID,
153
+ GENERIC_OIDC_CLIENT_SECRET: process.env.GENERIC_OIDC_CLIENT_SECRET,
154
+ GENERIC_OIDC_ISSUER: process.env.GENERIC_OIDC_ISSUER,
145
155
 
146
156
  // ZITADEL
147
157
  ZITADEL_CLIENT_ID: process.env.ZITADEL_CLIENT_ID,
@@ -0,0 +1,40 @@
1
+ import type { OIDCConfig } from '@auth/core/providers';
2
+
3
+ import { authEnv } from '@/config/auth';
4
+
5
+ import { CommonProviderConfig } from './sso.config';
6
+
7
+ export type GenericOIDCProfile = {
8
+ email: string;
9
+ id?: string;
10
+ name?: string;
11
+ picture?: string;
12
+ sub: string;
13
+ username?: string;
14
+ };
15
+
16
+ const provider = {
17
+ id: 'generic-oidc',
18
+ provider: {
19
+ ...CommonProviderConfig,
20
+ authorization: { params: { scope: 'email openid profile' } },
21
+ checks: ['state', 'pkce'],
22
+ clientId: authEnv.GENERIC_OIDC_CLIENT_ID,
23
+ clientSecret: authEnv.GENERIC_OIDC_CLIENT_SECRET,
24
+ id: 'generic-oidc',
25
+ issuer: authEnv.GENERIC_OIDC_ISSUER,
26
+ name: 'Generic OIDC',
27
+ profile(profile) {
28
+ return {
29
+ email: profile.email,
30
+ id: profile.sub,
31
+ image: profile.picture,
32
+ name: profile.name ?? profile.username ?? profile.email,
33
+ providerAccountId: profile.sub,
34
+ };
35
+ },
36
+ type: 'oidc',
37
+ } satisfies OIDCConfig<GenericOIDCProfile>,
38
+ };
39
+
40
+ export default provider;
@@ -3,8 +3,9 @@ import Authelia from './authelia';
3
3
  import Authentik from './authentik';
4
4
  import AzureAD from './azure-ad';
5
5
  import CloudflareZeroTrust from './cloudflare-zero-trust';
6
+ import GenericOIDC from './generic-oidc';
6
7
  import Github from './github';
7
8
  import Logto from './logto';
8
9
  import Zitadel from './zitadel';
9
10
 
10
- export const ssoProviders = [Auth0, Authentik, AzureAD, Github, Zitadel, Authelia, Logto, CloudflareZeroTrust];
11
+ export const ssoProviders = [Auth0, Authentik, AzureAD, GenericOIDC, Github, Zitadel, Authelia, Logto, CloudflareZeroTrust];