@lobehub/chat 1.14.2 → 1.14.4

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.
Files changed (45) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/README.md +2 -2
  3. package/README.zh-CN.md +2 -2
  4. package/docker-compose/.env.example +35 -0
  5. package/docker-compose/.env.zh-CN.example +35 -0
  6. package/docker-compose/docker-compose.yml +70 -0
  7. package/docker-compose/minio-bucket.config.json +34 -0
  8. package/docs/self-hosting/advanced/auth/next-auth/github.mdx +1 -1
  9. package/docs/self-hosting/advanced/auth/next-auth/github.zh-CN.mdx +4 -4
  10. package/docs/self-hosting/advanced/auth/next-auth/logto.mdx +74 -0
  11. package/docs/self-hosting/advanced/auth/next-auth/logto.zh-CN.mdx +78 -0
  12. package/docs/self-hosting/environment-variables/auth.mdx +21 -0
  13. package/docs/self-hosting/environment-variables/auth.zh-CN.mdx +31 -8
  14. package/docs/self-hosting/server-database/docker-compose.mdx +486 -7
  15. package/docs/self-hosting/server-database/docker-compose.zh-CN.mdx +477 -4
  16. package/docs/self-hosting/server-database/docker.mdx +20 -0
  17. package/docs/self-hosting/server-database/docker.zh-CN.mdx +27 -4
  18. package/docs/usage/features/pwa.zh-CN.mdx +1 -1
  19. package/package.json +2 -2
  20. package/src/app/(main)/chat/(workspace)/_layout/Desktop/ChatHeader/Tags.tsx +1 -1
  21. package/src/app/(main)/chat/(workspace)/features/ShareButton/Preview.tsx +1 -1
  22. package/src/app/(main)/chat/@session/features/SessionListContent/List/Item/index.tsx +1 -1
  23. package/src/app/(main)/settings/llm/ProviderList/Azure/index.tsx +1 -14
  24. package/src/app/(main)/settings/llm/ProviderList/Bedrock/index.tsx +1 -10
  25. package/src/app/(main)/settings/llm/ProviderList/Ollama/index.tsx +0 -2
  26. package/src/app/(main)/settings/llm/ProviderList/OpenAI/index.tsx +0 -3
  27. package/src/app/(main)/settings/llm/ProviderList/providers.tsx +28 -174
  28. package/src/app/(main)/settings/llm/components/ProviderConfig/index.tsx +17 -17
  29. package/src/app/(main)/settings/llm/components/ProviderModelList/CustomModelOption.tsx +1 -1
  30. package/src/app/(main)/settings/llm/components/ProviderModelList/Option.tsx +1 -1
  31. package/src/app/(main)/settings/tts/features/{const.ts → const.tsx} +6 -3
  32. package/src/components/ModelSelect/index.tsx +15 -5
  33. package/src/const/url.ts +1 -0
  34. package/src/database/server/models/asyncTask.ts +4 -4
  35. package/src/features/AgentSetting/AgentTTS/options.tsx +19 -0
  36. package/src/features/Conversation/Extras/Assistant.tsx +1 -1
  37. package/src/server/routers/async/caller.ts +2 -0
  38. package/src/server/routers/async/file.ts +72 -46
  39. package/src/server/services/chunk/index.ts +32 -3
  40. package/src/types/asyncTask.ts +23 -4
  41. package/src/components/ModelIcon/index.tsx +0 -114
  42. package/src/components/ModelProviderIcon/index.tsx +0 -148
  43. package/src/components/ModelTag/ModelIcon.tsx +0 -105
  44. package/src/components/ModelTag/index.tsx +0 -13
  45. package/src/features/AgentSetting/AgentTTS/options.ts +0 -16
package/CHANGELOG.md CHANGED
@@ -2,6 +2,56 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ### [Version 1.14.4](https://github.com/lobehub/lobe-chat/compare/v1.14.3...v1.14.4)
6
+
7
+ <sup>Released on **2024-08-28**</sup>
8
+
9
+ #### 💄 Styles
10
+
11
+ - **misc**: Move model and provider icon components to `@lobehub/icons`.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### Styles
19
+
20
+ - **misc**: Move model and provider icon components to `@lobehub/icons`, closes [#3634](https://github.com/lobehub/lobe-chat/issues/3634) ([5c7e17a](https://github.com/lobehub/lobe-chat/commit/5c7e17a))
21
+
22
+ </details>
23
+
24
+ <div align="right">
25
+
26
+ [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
27
+
28
+ </div>
29
+
30
+ ### [Version 1.14.3](https://github.com/lobehub/lobe-chat/compare/v1.14.2...v1.14.3)
31
+
32
+ <sup>Released on **2024-08-27**</sup>
33
+
34
+ #### 🐛 Bug Fixes
35
+
36
+ - **misc**: Improve aysnc error type.
37
+
38
+ <br/>
39
+
40
+ <details>
41
+ <summary><kbd>Improvements and Fixes</kbd></summary>
42
+
43
+ #### What's fixed
44
+
45
+ - **misc**: Improve aysnc error type, closes [#3638](https://github.com/lobehub/lobe-chat/issues/3638) ([dbae456](https://github.com/lobehub/lobe-chat/commit/dbae456))
46
+
47
+ </details>
48
+
49
+ <div align="right">
50
+
51
+ [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
52
+
53
+ </div>
54
+
5
55
  ### [Version 1.14.2](https://github.com/lobehub/lobe-chat/compare/v1.14.1...v1.14.2)
6
56
 
7
57
  <sup>Released on **2024-08-27**</sup>
package/README.md CHANGED
@@ -275,11 +275,11 @@ Our marketplace is not just a showcase platform but also a collaborative space.
275
275
  3. Use the above answers as evidence to logically and coherently provide a final answer to your question, assisted by visual charts.
276
276
 
277
277
  Please tell me what issue you would like to explore?<br/>`backtracking-questions` `thinking-strategies` `problem-analysis` |
278
+ \| [Unreal Engine Master](https://chat-preview.lobehub.com/market?agent=unreal-engine-master)<br/><sup>By **[thedivergentai](https://github.com/thedivergentai)** on **2024-08-27**</sup> | Unreal Game Development Companion<br/>`game-development` `unreal-engine` `software-engineering` |
278
279
  \| [TypeScript Solution Architect](https://chat-preview.lobehub.com/market?agent=typescript-developer)<br/><sup>By **[swarfte](https://github.com/swarfte)** on **2024-08-24**</sup> | Expert in TypeScript, Node.js, Vue.js 3, Nuxt.js 3, Express.js, React.js, and modern UI libraries.<br/>`type-script` `java-script` `web-development` `coding-standards` `best-practices` |
279
280
  \| [Variable Name Conversion Expert](https://chat-preview.lobehub.com/market?agent=variable-name-conversion)<br/><sup>By **[zengyishou](https://github.com/zengyishou)** on **2024-08-21**</sup> | In software development, naming variables is a common yet relatively time-consuming task. This assistant can automatically convert Chinese variable names into English variable names that conform to camelCase, PascalCase, snake_case, kebab-case, and constant naming conventions based on specific naming rules. This not only improves code readability but also alleviates the frustration of variable naming.<br/>`software-development` `variable-naming` `chinese-to-english` `code-standards` `automatic-conversion` |
280
- \| [Prompt Engineering Expert](https://chat-preview.lobehub.com/market?agent=ai-prompts-assistant)<br/><sup>By **[cyicz123](https://github.com/cyicz123)** on **2024-08-12**</sup> | Specializing in prompt optimization and design<br/>`prompt-engineering` `ai-interaction` `writing` `optimization` `consulting` |
281
281
 
282
- > 📊 Total agents: [<kbd>**318**</kbd> ](https://github.com/lobehub/lobe-chat-agents)
282
+ > 📊 Total agents: [<kbd>**319**</kbd> ](https://github.com/lobehub/lobe-chat-agents)
283
283
 
284
284
  <!-- AGENT LIST -->
285
285
 
package/README.zh-CN.md CHANGED
@@ -263,11 +263,11 @@ LobeChat 的插件生态系统是其核心功能的重要扩展,它极大地
263
263
  3. 将上述回答作为论据,有逻辑、条理地,使用可视化图表辅助对你的问题进行最终作答。
264
264
 
265
265
  请告诉我你想要探讨的问题是什么?<br/>`后退提问` `思考策略` `问题分析` |
266
+ \| [虚幻引擎大师](https://chat-preview.lobehub.com/market?agent=unreal-engine-master)<br/><sup>By **[thedivergentai](https://github.com/thedivergentai)** on **2024-08-27**</sup> | 虚幻游戏开发助手<br/>`游戏开发` `虚幻引擎` `软件工程` |
266
267
  \| [TypeScript 解决方案架构师](https://chat-preview.lobehub.com/market?agent=typescript-developer)<br/><sup>By **[swarfte](https://github.com/swarfte)** on **2024-08-24**</sup> | 精通 TypeScript、Node.js、Vue.js 3、Nuxt.js 3、Express.js、React.js 和现代 UI 库。<br/>`类型脚本` `java-script` `网页开发` `编码标准` `最佳实践` |
267
268
  \| [开发变量名转换专家](https://chat-preview.lobehub.com/market?agent=variable-name-conversion)<br/><sup>By **[zengyishou](https://github.com/zengyishou)** on **2024-08-21**</sup> | 在软件开发过程中,命名变量是一项常见却相对耗时的任务。本助手能够根据特定的命名规则自动将中文变量名转换为符合小驼峰、大驼峰、下划线、横线以及常量命名规范的英文变量名。这不仅提高了代码的可读性,还解决了变量命名的苦恼。<br/>`软件开发` `变量命名` `中文转英文` `代码规范` `自动转换` |
268
- \| [提示工程专家](https://chat-preview.lobehub.com/market?agent=ai-prompts-assistant)<br/><sup>By **[cyicz123](https://github.com/cyicz123)** on **2024-08-12**</sup> | 专精 Prompt 优化与设计<br/>`提示工程` `ai交互` `写作` `优化` `咨询` |
269
269
 
270
- > 📊 Total agents: [<kbd>**318**</kbd> ](https://github.com/lobehub/lobe-chat-agents)
270
+ > 📊 Total agents: [<kbd>**319**</kbd> ](https://github.com/lobehub/lobe-chat-agents)
271
271
 
272
272
  <!-- AGENT LIST -->
273
273
 
@@ -0,0 +1,35 @@
1
+ # LobeChat domain
2
+ APP_URL=https://lobe.example.com/
3
+
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=https://lobe.example.com/api/auth
16
+ LOGTO_CLIENT_ID=buc2lpttyo6evdtrfqsur
17
+ LOGTO_CLIENT_SECRET=d97eztx8Ej6aUafeToMAL4jugAKGTAH4
18
+ LOGTO_ISSUER=https://lobe-auth-api.example.com/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)
21
+ HTTP_PROXY=http://localhost:7890
22
+ HTTPS_PROXY=http://localhost:7890
23
+
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=https://lobe-s3-api.example.com
28
+ S3_BUCKET=lobe # Invalid until manually created in MinIO UI
29
+ S3_PUBLIC_DOMAIN=https://lobe-s3-api.example.com
30
+ S3_ENABLE_PATH_STYLE=1
31
+
32
+ # 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
+ # OPEANAI_API_KEY=sk-xxxx
34
+ # OPENAI_PROXY_URL=https://api.openai.com/v1
35
+ # OPENAI_MODEL_LIST=...
@@ -0,0 +1,35 @@
1
+ # LobeChat 域名
2
+ APP_URL=https://lobe.example.com/
3
+
4
+ # Postgres 相关,也即 DB 必须的环境变量
5
+ # 用于加密敏感信息的密钥,可以使用 openssl rand -base64 32 生成
6
+ KEY_VAULTS_SECRET=Kix2wcUONd4CX51E/ZPAd36BqM4wzJgKjPtz2sGztqQ=
7
+ # Postgres 数据库连接字符串
8
+ # 格式:postgres://username:password@host:port/dbname,如果你的 pg 实例为 Docker 容器,请使用容器名
9
+ DATABASE_URL=postgresql://postgres:uWNZugjBqixf8dxC@postgresql: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=https://lobe.example.com/api/auth
16
+ LOGTO_CLIENT_ID=buc2lpttyo6evdtrfqsur
17
+ LOGTO_CLIENT_SECRET=d97eztx8Ej6aUafeToMAL4jugAKGTAH4
18
+ LOGTO_ISSUER=https://lobe-auth-api.example.com/oidc
19
+ # 注:如果你有 ACCESS_CODE,请务必清空,我们以 NEXT_AUTH 作为唯一鉴权来源
20
+ # Proxy,如果你需要的话(比如你使用 GitHub 作为鉴权服务提供商)
21
+ HTTP_PROXY=http://localhost:7890
22
+ HTTPS_PROXY=http://localhost:7890
23
+
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=https://lobe-s3-api.example.com
28
+ S3_BUCKET=lobe # 直到在 MinIO UI 中手动创建之前都是无效的
29
+ S3_PUBLIC_DOMAIN=https://lobe-s3-api.example.com
30
+ S3_ENABLE_PATH_STYLE=1
31
+
32
+ # 其他环境变量,视需求而定,可以参照客户端版本的环境变量配置,注意不要有 ACCESS_CODE
33
+ # OPEANAI_API_KEY=sk-xxxx
34
+ # OPENAI_PROXY_URL=https://api.openai.com/v1
35
+ # OPENAI_MODEL_LIST=...
@@ -0,0 +1,70 @@
1
+ services:
2
+ postgresql:
3
+ image: pgvector/pgvector:pg16
4
+ container_name: lobe-postgres
5
+ ports:
6
+ - '5432:5432'
7
+ volumes:
8
+ - './data:/var/lib/postgresql/data'
9
+ environment:
10
+ - 'POSTGRES_DB=lobe'
11
+ - 'POSTGRES_PASSWORD=uWNZugjBqixf8dxC'
12
+ healthcheck:
13
+ test: ['CMD-SHELL', 'pg_isready -U postgres']
14
+ interval: 5s
15
+ timeout: 5s
16
+ retries: 5
17
+ restart: always
18
+
19
+ minio:
20
+ image: minio/minio
21
+ container_name: lobe-minio
22
+ ports:
23
+ - '9000:9000'
24
+ - '9001:9001'
25
+ volumes:
26
+ - './s3_data:/etc/minio/data'
27
+ environment:
28
+ - 'MINIO_ROOT_USER=YOUR_MINIO_USER'
29
+ - 'MINIO_ROOT_PASSWORD=YOUR_MINIO_PASSWORD'
30
+ - 'MINIO_DOMAIN=lobe-s3-api.example.com'
31
+ - 'MINIO_API_CORS_ALLOW_ORIGIN=https://lobe.example.com' # Your LobeChat's domain name.
32
+ restart: always
33
+ command: >
34
+ server /etc/minio/data --address ":9000" --console-address ":9001"
35
+
36
+
37
+ logto:
38
+ image: svhd/logto
39
+ container_name: lobe-logto
40
+ ports:
41
+ - '3001:3001'
42
+ - '3002:3002'
43
+ depends_on:
44
+ postgresql:
45
+ condition: service_healthy
46
+ environment:
47
+ - 'TRUST_PROXY_HEADER=1'
48
+ - 'DB_URL=postgresql://postgres:uWNZugjBqixf8dxC@postgresql:5432/logto'
49
+ - 'ENDPOINT=https://lobe-auth-api.example.com'
50
+ - 'ADMIN_ENDPOINT=https://lobe-auth-ui.example.com'
51
+ entrypoint: ['sh', '-c', 'npm run cli db seed -- --swe && npm start']
52
+
53
+ lobe:
54
+ image: lobehub/lobe-chat-database
55
+ container_name: lobe-database
56
+ ports:
57
+ - '3210:3210'
58
+ depends_on:
59
+ - postgresql
60
+ - minio
61
+ - logto
62
+ env_file:
63
+ - .env
64
+ restart: always
65
+
66
+ volumes:
67
+ data:
68
+ driver: local
69
+ s3_data:
70
+ driver: local
@@ -0,0 +1,34 @@
1
+ {
2
+ "Statement": [
3
+ {
4
+ "Effect": "Allow",
5
+ "Principal": {
6
+ "AWS": ["*"]
7
+ },
8
+ "Action": ["s3:GetBucketLocation"],
9
+ "Resource": ["arn:aws:s3:::lobe"]
10
+ },
11
+ {
12
+ "Effect": "Allow",
13
+ "Principal": {
14
+ "AWS": ["*"]
15
+ },
16
+ "Action": ["s3:ListBucket"],
17
+ "Resource": ["arn:aws:s3:::lobe"],
18
+ "Condition": {
19
+ "StringEquals": {
20
+ "s3:prefix": ["files/*"]
21
+ }
22
+ }
23
+ },
24
+ {
25
+ "Effect": "Allow",
26
+ "Principal": {
27
+ "AWS": ["*"]
28
+ },
29
+ "Action": ["s3:PutObject", "s3:DeleteObject", "s3:GetObject"],
30
+ "Resource": ["arn:aws:s3:::lobe/files/**"]
31
+ }
32
+ ],
33
+ "Version": "2012-10-17"
34
+ }
@@ -89,7 +89,7 @@ When deploying LobeChat, you need to configure the following environment variabl
89
89
  | `NEXTAUTH_URL` | Optional | This URL is used to specify the callback address for Auth.js when performing OAuth authentication. Only set it if the default generated redirect address is incorrect. `https://example.com/api/auth` |
90
90
 
91
91
  <Callout type={'tip'}>
92
- Go to [📘 Environment Variables](/docs/self-hosting/environment-variable#Github) for detailed
92
+ Go to [📘 Environment Variables](/docs/self-hosting/environment-variables/auth#github) for detailed
93
93
  information on these variables.
94
94
  </Callout>
95
95
  </Steps>
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  title: 在 LobeChat 中配置 Github 身份验证服务
3
- description: 学习如何在 LobeChat 中配置Github身份验证服务,包括创建新的Github App、设置权限和环境变量。
3
+ description: 学习如何在 LobeChat 中配置 Github 身份验证服务,包括创建新的 Github App、设置权限和环境变量。
4
4
  tags:
5
5
  - Github 身份验证
6
6
  - Github App
@@ -16,9 +16,9 @@ tags:
16
16
  <Steps>
17
17
  ### 创建 Github 提供应用
18
18
 
19
- 点击[这里](https://github.com/settings/apps/new) 创建一个新的 Github App。
19
+ 点击 [这里](https://github.com/settings/apps/new) 创建一个新的 Github App。
20
20
 
21
- 填写Github App name、Homepage URL、Callbak URL
21
+ 填写 Github App name、Homepage URL、Callbak URL
22
22
 
23
23
  <Image
24
24
  alt="创建 Github 提供程序"
@@ -85,7 +85,7 @@ tags:
85
85
  | `NEXTAUTH_URL` | 可选 | 该 URL 用于指定 Auth.js 在执行 OAuth 验证时的回调地址,当默认生成的重定向地址发生不正确时才需要设置。`https://example.com/api/auth` |
86
86
 
87
87
  <Callout type={'tip'}>
88
- 前往 [📘 环境变量](/docs/self-hosting/environment-variable#Github) 可查阅相关变量详情。
88
+ 前往 [📘 环境变量](/docs/self-hosting/environment-variables/auth#github) 可查阅相关变量详情。
89
89
 
90
90
  </Callout>
91
91
  </Steps>
@@ -0,0 +1,74 @@
1
+ ---
2
+ title: Configuring Logto Authentication Service in LobeChat
3
+ description: >-
4
+ Learn how to configure Logto authentication service in LobeChat, including
5
+ deployment, creation, setting permissions, and environment variables.
6
+ tags:
7
+ - Logto Authentication
8
+ - Environment Variable Configuration
9
+ - Single Sign-On
10
+ - LobeChat
11
+ ---
12
+
13
+ # Configuring Logto Authentication Service
14
+
15
+ [Logto](https://github.com/logto-io/logto) is an open-source authentication service with a simple and beautiful interface, rich in features and easy to use. You can choose to use the official Logto Cloud or opt for a private deployment of Logto.
16
+
17
+ <Callout type={'tip'}>
18
+
19
+ If you want to deploy Logto privately, we recommend using Docker Compose to deploy it together with the LobeChat database version. In this case, LobeChat can share the same Postgres instance with it.
20
+
21
+ </Callout>
22
+
23
+ ## Logto Configuration Process
24
+
25
+ The following assumes your LobeChat database version domain is `https://lobe.example.com`.
26
+
27
+ If you are using a privately deployed Logto, assume its endpoint domain is `https://lobe-auth-api.example.com`.
28
+
29
+ If you are using Logto Cloud, assume its endpoint domain is `https://example.logto.app`.
30
+
31
+ <Steps>
32
+ ### Create Logto Application
33
+
34
+ Access your privately deployed Logto WebUI or [Logto Cloud](http://cloud.logto.io/) to enter the console, and create a `Next.js (App Router)` application under `Applications` with any name.
35
+
36
+ ### Configure Logto
37
+
38
+ Set the `Redirect URI` to `https://lobe.example.com/api/auth/callback/logto` and the `Post sign-out redirect URI` to `https://lobe.example.com/`.
39
+
40
+ Set `CORS allowed origins` to `https://lobe.example.com`.
41
+
42
+ <Image alt="Configure Logto" inStep src="https://github.com/user-attachments/assets/5b816379-c07b-40ea-bde4-df16e2e4e523" />
43
+
44
+ After successful creation, save the `Client ID` and `Client Secret`.
45
+
46
+ ### Configure Environment Variables
47
+
48
+ <Image alt="Configure Environment Variables" inStep src="https://github.com/user-attachments/assets/15af6d94-af4f-4aa9-bbab-7a46e9f9e837" />
49
+
50
+ Set the obtained `Client ID` and `Client Secret` as `LOGTO_CLIENT_ID` and `LOGTO_CLIENT_SECRET` in the LobeChat environment variables.
51
+
52
+ Configure `LOGTO_ISSUER` in the LobeChat environment variables as follows:
53
+
54
+ - `https://lobe-auth-api.example.com/oidc` if you are using a privately deployed Logto
55
+ - `https://example.logto.app/oidc` if you are using Logto Cloud
56
+
57
+ When deploying LobeChat, you need to configure the following environment variables:
58
+
59
+ | Environment Variable | Type | Description |
60
+ | ------------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
61
+ | `NEXT_AUTH_SECRET` | Required | The key used to encrypt Auth.js session tokens. You can generate a key using the command: `openssl rand -base64 32` |
62
+ | `NEXT_AUTH_SSO_PROVIDERS` | Required | Select the single sign-on provider for LobeChat. For Logto, enter `logto`. |
63
+ | `LOGTO_CLIENT_ID` | Required | The Client ID from the Logto App details page |
64
+ | `LOGTO_CLIENT_SECRET` | Required | The Client Secret from the Logto App details page |
65
+ | `LOGTO_ISSUER` | Required | OpenID Connect issuer of the Logto provider |
66
+ | `NEXTAUTH_URL` | Optional | This URL specifies the callback address for Auth.js during OAuth verification, needed only if the default generated redirect address is incorrect. `https://lobe.example.com/api/auth` |
67
+
68
+ <Callout type={'tip'}>
69
+ Visit [📘 Environment Variables](/docs/self-hosting/environment-variables/auth#logto) for details on related variables.
70
+
71
+ </Callout>
72
+ </Steps>
73
+
74
+ <Callout type={'info'}>After successful deployment, users will be able to authenticate via Logto and use LobeChat.</Callout>
@@ -0,0 +1,78 @@
1
+ ---
2
+ title: 在 LobeChat 中配置 Logto 身份验证服务
3
+ description: 学习如何在 LobeChat 中配置 Logto 身份验证服务,包括部署、创建、设置权限和环境变量。
4
+ tags:
5
+ - Logto 身份验证
6
+ - 环境变量配置
7
+ - 单点登录
8
+ - LobeChat
9
+ ---
10
+
11
+ # 配置 Logto 身份验证服务
12
+
13
+ [Logto](https://github.com/logto-io/logto) 是一个开源的身份验证服务,界面简洁美观、功能配置丰富且易于上手,你即可以选择使用其官方提供的 Logto Cloud,也可以选择私有部署 Logto。
14
+
15
+ <Callout type={'tip'}>
16
+ 若你想要私有部署 Logto,我们建议你将之与 LobeChat 数据库版本一同使用 Docker Compose 部署,此时 LobeChat 可以与之共用同一个 Postgres 实例。
17
+ </Callout>
18
+
19
+ ## Logto 配置流程
20
+
21
+ 下文假设你的 LobeChat 数据库版本域名为 `https://lobe.example.com`。
22
+
23
+ 若你是私有部署的 Logto,假设其 endpoint 域名为 `https://lobe-auth-api.example.com`。
24
+
25
+ 若你是使用的 Logto Cloud,假设其 endpoint 域名为 `https://example.logto.app`。
26
+
27
+ <Steps>
28
+ ### 创建 Logto 应用
29
+
30
+ 访问你私有部署的 Logto WebUI 或者 [Logto Cloud](http://cloud.logto.io/) 进入控制台,在 `Applications` 里创建一个 `Next.js (App Router)` 应用,名称随意
31
+
32
+ ### 配置 Logto
33
+
34
+ 配置 `Redirect URI` 为 `https://lobe.example.com/api/auth/callback/logto`,`Post sign-out redirect URI` 为 `https://lobe.example.com/`
35
+
36
+ 配置 `CORS allowed origins` 为 `https://lobe.example.com`
37
+
38
+ <Image
39
+ alt="配置 Logto"
40
+ inStep
41
+ src="https://github.com/user-attachments/assets/5b816379-c07b-40ea-bde4-df16e2e4e523"
42
+ />
43
+
44
+ 创建成功后, 将 `Client ID` 和 `Client Secret` 保存下来。
45
+
46
+ ### 配置环境变量
47
+
48
+ <Image
49
+ alt="配置环境变量"
50
+ inStep
51
+ src="https://github.com/user-attachments/assets/15af6d94-af4f-4aa9-bbab-7a46e9f9e837"
52
+ />
53
+
54
+ 将获取到的 `Client ID` 和 `Client Secret`,设为 LobeChat 环境变量中的 `LOGTO_CLIENT_ID` 和 `LOGTO_CLIENT_SECRETT`。
55
+
56
+ 配置 LobeChat 环境变量中 `LOGTO_ISSUER` 为:
57
+
58
+ - `https://lobe-auth-api.example.com/oidc`,若你是私有部署的 Logto
59
+ - `https://example.logto.app/oidc`,若你是使用的 Logto Cloud
60
+
61
+ 在部署 LobeChat 时,你需要配置以下环境变量:
62
+
63
+ | 环境变量 | 类型 | 描述 |
64
+ | --- | --- | --- |
65
+ | `NEXT_AUTH_SECRET` | 必选 | 用于加密 Auth.js 会话令牌的密钥。您可以使用以下命令生成秘钥: `openssl rand -base64 32` |
66
+ | `NEXT_AUTH_SSO_PROVIDERS` | 必选 | 选择 LoboChat 的单点登录提供商。使用 Logto 请填写 `logto`。 |
67
+ | `LOGTO_CLIENT_ID` | 必选 | Logto App 详情页的 Client ID |
68
+ | `LOGTO_CLIENT_SECRET` | 必选 | Logto App 详情页的 Client Secret |
69
+ | `LOGTO_ISSUER` | 必选 | Logto 提供程序的 OpenID Connect 颁发者 |
70
+ | `NEXTAUTH_URL` | 可选 | 该 URL 用于指定 Auth.js 在执行 OAuth 验证时的回调地址,当默认生成的重定向地址发生不正确时才需要设置。`https://lobe.example.com/api/auth` |
71
+
72
+ <Callout type={'tip'}>
73
+ 前往 [📘 环境变量](/docs/self-hosting/environment-variables/auth#logto) 可查阅相关变量详情。
74
+
75
+ </Callout>
76
+ </Steps>
77
+
78
+ <Callout type={'info'}>部署成功后,用户将可以通过 Logto 身份认证并使用 LobeChat。</Callout>
@@ -194,6 +194,27 @@ LobeChat provides a complete authentication service capability when deployed. Th
194
194
  - Default: `-`
195
195
  - Example: `https://your-instance-abc123.zitadel.cloud`
196
196
 
197
+ #### `LOGTO_CLIENT_ID`
198
+
199
+ - Type: Required
200
+ - Description: The Client ID of the Logto application. You can find it in the Logto console for private deployment or [Logto Cloud](http://cloud.logto.io/) depending on the deployment mode.
201
+ - Default value: `-`
202
+ - Example: `123456789012345678@your-project`
203
+
204
+ #### `LOGTO_CLIENT_SECRET`
205
+
206
+ - Type: Required
207
+ - Description: The Client Secret of the Logto application.
208
+ - Default value: `-`
209
+ - Example: `9QF1n5ATzU7Z3mHp2Iw4gKX8kY6oR7uW1DnKcV3LqX2jF6iG3fBmJ1kV7nS5zE6A`
210
+
211
+ #### `LOGTO_ISSUER`
212
+
213
+ - Type: Required
214
+ - Description: The OpenID Connect issuer of the Logto application. You can find it in the Logto console for private deployment or [Logto Cloud](http://cloud.logto.io/) depending on the deployment mode.
215
+ - Default value: `-`
216
+ - Example: `https://lobe-auth-api.example.com/oidc`
217
+
197
218
  <Callout>
198
219
  Currently, we only support providers above. If you need to use other identity verification service
199
220
  providers, you can submit a [feature
@@ -157,17 +157,17 @@ LobeChat 在部署时提供了完善的身份验证服务能力,以下是相
157
157
 
158
158
  #### `GITHUB_CLIENT_ID`
159
159
 
160
- - Type: Required
161
- - Description: Github应用的客户端ID。您可以在[这里](https://github.com/settings/apps)访问,并导航到应用程序设置以查看。
162
- - Default: `-`
163
- - Example: `abd94200333283550508`
160
+ - 类型:必选
161
+ - 描述: Github 应用的客户端 ID。您可以在[这里](https://github.com/settings/apps)访问,并导航到应用程序设置以查看。
162
+ - 默认值: `-`
163
+ - 示例: `abd94200333283550508`
164
164
 
165
165
  #### `GITHUB_CLIENT_SECRET`
166
166
 
167
- - Type: Required
168
- - Description: Github应用的客户端密钥。
169
- - Default: `-`
170
- - Example: `dd262976ac0931d947e104891586a053f3d3750b`
167
+ - 类型:必选
168
+ - 描述: Github应用的客户端密钥。
169
+ - 默认值: `-`
170
+ - 示例: `dd262976ac0931d947e104891586a053f3d3750b`
171
171
 
172
172
  ### ZITADEL
173
173
 
@@ -192,6 +192,29 @@ LobeChat 在部署时提供了完善的身份验证服务能力,以下是相
192
192
  - 默认值:`-`
193
193
  - 示例:`https://your-instance-abc123.zitadel.cloud`
194
194
 
195
+ ### Logto
196
+
197
+ #### `LOGTO_CLIENT_ID`
198
+
199
+ - 类型:必选
200
+ - 描述:Logto 应用程序的 Client ID。您可以在根据部署模式,在私有部署的 Logto 控制台或 [Logto Cloud](http://cloud.logto.io/) 中找到。
201
+ - 默认值:`-`
202
+ - 示例:`123456789012345678@your-project`
203
+
204
+ #### `LOGTO_CLIENT_SECRET`
205
+
206
+ - 类型:必选
207
+ - 描述:Logto 应用程序的 Client Secret。
208
+ - 默认值:`-`
209
+ - 示例:`9QF1n5ATzU7Z3mHp2Iw4gKX8kY6oR7uW1DnKcV3LqX2jF6iG3fBmJ1kV7nS5zE6A`
210
+
211
+ #### `LOGTO_ISSUER`
212
+
213
+ - 类型:必选
214
+ - 描述:Logto 应用程序的 OpenID Connect 颁发者(issuer)。根据部署模式,您可以在私有部署的 Logto 控制台或 [Logto Cloud](http://cloud.logto.io/) 中找到。
215
+ - 默认值:`-`
216
+ - 示例:`https://lobe-auth-api.example.com/oidc`
217
+
195
218
  <Callout>
196
219
  如果您需要使用其他身份验证服务提供商,可以提交
197
220
  [功能请求](https://github.com/lobehub/lobe-chat/issues/new/choose) 或 Pull Request。