@lobehub/chat 0.135.4 → 0.137.0

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 (83) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/README.md +8 -8
  3. package/README.zh-CN.md +8 -8
  4. package/docs/self-hosting/advanced/authentication.mdx +14 -81
  5. package/docs/self-hosting/advanced/authentication.zh-CN.mdx +14 -75
  6. package/docs/self-hosting/advanced/sso-providers/auth0.mdx +91 -0
  7. package/docs/self-hosting/advanced/sso-providers/auth0.zh-CN.mdx +85 -0
  8. package/docs/self-hosting/advanced/sso-providers/microsoft-entra-id.mdx +69 -0
  9. package/docs/self-hosting/advanced/sso-providers/microsoft-entra-id.zh-CN.mdx +75 -0
  10. package/docs/self-hosting/environment-variables/basic.mdx +37 -1
  11. package/docs/self-hosting/environment-variables/basic.zh-CN.mdx +36 -1
  12. package/docs/self-hosting/environment-variables/model-provider.mdx +0 -2
  13. package/docs/self-hosting/environment-variables/model-provider.zh-CN.mdx +0 -1
  14. package/docs/self-hosting/start.mdx +1 -9
  15. package/docs/usage/features/agent-market.mdx +1 -1
  16. package/docs/usage/features/tts.mdx +0 -3
  17. package/docs/usage/features/vision.mdx +0 -1
  18. package/docs/usage/providers/ollama/gemma.mdx +0 -1
  19. package/docs/usage/providers/ollama.mdx +0 -3
  20. package/docs/usage/start.mdx +1 -1
  21. package/docs/usage/start.zh-CN.mdx +1 -1
  22. package/locales/ar/error.json +8 -0
  23. package/locales/ar/setting.json +9 -1
  24. package/locales/de-DE/error.json +8 -0
  25. package/locales/de-DE/setting.json +9 -1
  26. package/locales/en-US/error.json +8 -0
  27. package/locales/en-US/setting.json +9 -1
  28. package/locales/es-ES/error.json +8 -0
  29. package/locales/es-ES/setting.json +9 -1
  30. package/locales/fr-FR/error.json +8 -0
  31. package/locales/fr-FR/setting.json +9 -1
  32. package/locales/it-IT/error.json +8 -0
  33. package/locales/it-IT/setting.json +9 -1
  34. package/locales/ja-JP/error.json +8 -0
  35. package/locales/ja-JP/setting.json +9 -1
  36. package/locales/ko-KR/error.json +8 -0
  37. package/locales/ko-KR/setting.json +9 -1
  38. package/locales/nl-NL/error.json +8 -0
  39. package/locales/nl-NL/setting.json +9 -1
  40. package/locales/pl-PL/error.json +8 -0
  41. package/locales/pl-PL/setting.json +9 -1
  42. package/locales/pt-BR/error.json +8 -0
  43. package/locales/pt-BR/setting.json +9 -1
  44. package/locales/ru-RU/error.json +8 -0
  45. package/locales/ru-RU/setting.json +9 -1
  46. package/locales/tr-TR/error.json +8 -0
  47. package/locales/tr-TR/setting.json +9 -1
  48. package/locales/vi-VN/error.json +8 -0
  49. package/locales/vi-VN/setting.json +9 -1
  50. package/locales/zh-CN/error.json +8 -0
  51. package/locales/zh-CN/setting.json +9 -1
  52. package/locales/zh-TW/error.json +8 -0
  53. package/locales/zh-TW/setting.json +9 -1
  54. package/package.json +3 -2
  55. package/src/app/api/auth/next-auth.ts +39 -12
  56. package/src/app/api/config/route.ts +3 -2
  57. package/src/app/api/errorResponse.ts +2 -1
  58. package/src/app/settings/common/Common.tsx +1 -1
  59. package/src/app/settings/llm/Ollama/Checker.tsx +73 -0
  60. package/src/app/settings/llm/Ollama/index.tsx +2 -4
  61. package/src/app/settings/llm/components/Checker.tsx +23 -17
  62. package/src/components/ModelIcon/index.tsx +2 -0
  63. package/src/components/ModelTag/ModelIcon.tsx +2 -0
  64. package/src/config/modelProviders/ollama.ts +14 -0
  65. package/src/config/server/app.ts +4 -0
  66. package/src/config/server/provider.ts +2 -0
  67. package/src/features/Conversation/Error/InvalidOllamaModel/index.tsx +138 -0
  68. package/src/features/Conversation/Error/InvalidOllamaModel/useDownloadMonitor.ts +48 -0
  69. package/src/features/Conversation/Error/OAuthForm.tsx +1 -1
  70. package/src/features/Conversation/Error/OllamaBizError.tsx +34 -0
  71. package/src/features/Conversation/Error/index.tsx +5 -0
  72. package/src/features/Conversation/Error/style.tsx +2 -2
  73. package/src/locales/default/error.ts +8 -0
  74. package/src/locales/default/setting.ts +9 -1
  75. package/src/services/__tests__/ollama.test.ts +26 -0
  76. package/src/services/ollama.ts +64 -0
  77. package/src/store/global/slices/settings/selectors/modelProvider.ts +11 -10
  78. package/src/store/middleware/createHyperStorage/index.ts +1 -2
  79. package/src/store/middleware/createHyperStorage/indexedDB.ts +1 -1
  80. package/src/store/middleware/createHyperStorage/localStorage.ts +1 -1
  81. package/src/store/middleware/createHyperStorage/urlStorage.ts +1 -1
  82. package/src/types/fetch.ts +1 -0
  83. package/tsconfig.json +1 -1
package/CHANGELOG.md CHANGED
@@ -2,6 +2,56 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ## [Version 0.137.0](https://github.com/lobehub/lobe-chat/compare/v0.136.0...v0.137.0)
6
+
7
+ <sup>Released on **2024-03-15**</sup>
8
+
9
+ #### ✨ Features
10
+
11
+ - **ollama**: Improve connection check method and provide selector for user to control model options.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### What's improved
19
+
20
+ - **ollama**: Improve connection check method and provide selector for user to control model options, closes [#1397](https://github.com/lobehub/lobe-chat/issues/1397) ([675902f](https://github.com/lobehub/lobe-chat/commit/675902f))
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 0.136.0](https://github.com/lobehub/lobe-chat/compare/v0.135.4...v0.136.0)
31
+
32
+ <sup>Released on **2024-03-15**</sup>
33
+
34
+ #### ✨ Features
35
+
36
+ - **misc**: Support azure-ad as a new sso provider.
37
+
38
+ <br/>
39
+
40
+ <details>
41
+ <summary><kbd>Improvements and Fixes</kbd></summary>
42
+
43
+ #### What's improved
44
+
45
+ - **misc**: Support azure-ad as a new sso provider, closes [#1456](https://github.com/lobehub/lobe-chat/issues/1456) ([6649cd1](https://github.com/lobehub/lobe-chat/commit/6649cd1))
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 0.135.4](https://github.com/lobehub/lobe-chat/compare/v0.135.3...v0.135.4)
6
56
 
7
57
  <sup>Released on **2024-03-15**</sup>
package/README.md CHANGED
@@ -255,14 +255,14 @@ Our marketplace is not just a showcase platform but also a collaborative space.
255
255
 
256
256
  <!-- AGENT LIST -->
257
257
 
258
- | Recent Submits | Description |
259
- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
260
- | [TikTok Script Writer](https://chat-preview.lobehub.com/market?agent=tiktok-script-writer)<br/><sup>By **[sdhjn19dj1m](https://github.com/sdhjn19dj1m)** on **2024-03-12**</sup> | This script is tailored for TikTok's short video format, designed to engage and entertain the specified target audience. It incorporates trending elements and best practices for content virality, ensuring the video captures attention from the start. The script is structured to include a captivating opening, concise and impactful message body, and a compelling call-to-action, all while reflecting the user's desired tone and theme.<br/>`tik-tok` `short-video` `viral-content` `trending-hashtag` `engagement` |
261
- | [Gen Z Engagement Specialist](https://chat-preview.lobehub.com/market?agent=gen-z)<br/><sup>By **[MYSeaIT](https://github.com/MYSeaIT)** on **2024-03-09**</sup> | Specializes in engaging Gen Z users with tailored interactions reflecting their preferences and values.<br/>`engagement` `gen-z` `communication` `advice` `interaction` |
262
- | [Schedule Management Assistant](https://chat-preview.lobehub.com/market?agent=calendar-manager)<br/><sup>By **[ccdanpian](https://github.com/ccdanpian)** on **2024-03-07**</sup> | Schedule Management Assistant, calls the time plugin to handle requests for adding, querying, and deleting schedules, supports multiple operations and reminders.<br/>`schedule-management` `time-plugin` `add-schedule` `query-schedule` `delete-schedule` |
263
- | [Business Email Writing Expert](https://chat-preview.lobehub.com/market?agent=business-email)<br/><sup>By **[canisminor1990](https://github.com/canisminor1990)** on **2024-03-06**</sup> | Business email writing expert specializing in bilingual business emails in Chinese and English, cross-cultural communication, and engagement in the GitHub open-source community.<br/>`business-email-writing` `business-cooperation` `business-authorization` `cross-cultural-communication` `git-hub-and-open-source-community` |
264
-
265
- > 📊 Total agents: [<kbd>**201**</kbd> ](https://github.com/lobehub/lobe-chat-agents)
258
+ | Recent Submits | Description |
259
+ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
260
+ | [Amazon Seller Support Agent](https://chat-preview.lobehub.com/market?agent=amazon-seller-support-agent)<br/><sup>By **[etnperlong](https://github.com/etnperlong)** on **2024-03-15**</sup> | AI assistant that assists Amazon sellers in responding to customer service replies, providing detailed and cogent responses towards a satisfactory resolution.<br/>`amazon` `seller` `writing` |
261
+ | [TikTok Script Writer](https://chat-preview.lobehub.com/market?agent=tiktok-script-writer)<br/><sup>By **[sdhjn19dj1m](https://github.com/sdhjn19dj1m)** on **2024-03-12**</sup> | This script is tailored for TikTok's short video format, designed to engage and entertain the specified target audience. It incorporates trending elements and best practices for content virality, ensuring the video captures attention from the start. The script is structured to include a captivating opening, concise and impactful message body, and a compelling call-to-action, all while reflecting the user's desired tone and theme.<br/>`tik-tok` `short-video` `viral-content` `trending-hashtag` `engagement` |
262
+ | [Gen Z Engagement Specialist](https://chat-preview.lobehub.com/market?agent=gen-z)<br/><sup>By **[MYSeaIT](https://github.com/MYSeaIT)** on **2024-03-09**</sup> | Specializes in engaging Gen Z users with tailored interactions reflecting their preferences and values.<br/>`engagement` `gen-z` `communication` `advice` `interaction` |
263
+ | [Schedule Management Assistant](https://chat-preview.lobehub.com/market?agent=calendar-manager)<br/><sup>By **[ccdanpian](https://github.com/ccdanpian)** on **2024-03-07**</sup> | Schedule Management Assistant, calls the time plugin to handle requests for adding, querying, and deleting schedules, supports multiple operations and reminders.<br/>`schedule-management` `time-plugin` `add-schedule` `query-schedule` `delete-schedule` |
264
+
265
+ > 📊 Total agents: [<kbd>**202**</kbd> ](https://github.com/lobehub/lobe-chat-agents)
266
266
 
267
267
  <!-- AGENT LIST -->
268
268
 
package/README.zh-CN.md CHANGED
@@ -243,14 +243,14 @@ LobeChat 的插件生态系统是其核心功能的重要扩展,它极大地
243
243
 
244
244
  <!-- AGENT LIST -->
245
245
 
246
- | 最近新增 | 助手说明 |
247
- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
248
- | [TikTok 脚本撰写器](https://chat-preview.lobehub.com/market?agent=tiktok-script-writer)<br/><sup>By **[sdhjn19dj1m](https://github.com/sdhjn19dj1m)** on **2024-03-12**</sup> | 此脚本专为 TikTok 的短视频格式量身定制,旨在吸引和娱乐特定目标受众。它融入了流行元素和内容病毒传播的最佳实践,确保视频从一开始就吸引注意力。脚本结构包括引人入胜的开场、简洁而有影响力的主体信息和引人注目的行动号召,同时反映用户期望的语气和主题。<br/>`tik-tok` `short-video` `viral-content` `trending-hashtag` `engagement` |
249
- | [Gen Z Engagement Specialist](https://chat-preview.lobehub.com/market?agent=gen-z)<br/><sup>By **[MYSeaIT](https://github.com/MYSeaIT)** on **2024-03-09**</sup> | 专注于通过定制互动反映他们的偏好和价值观,与 Gen Z 用户进行互动。<br/>`engagement` `gen-z` `communication` `advice` `interaction` |
250
- | [日程管理助手](https://chat-preview.lobehub.com/market?agent=calendar-manager)<br/><sup>By **[ccdanpian](https://github.com/ccdanpian)** on **2024-03-07**</sup> | 日程管理助手,调用时间插件,处理新增、查询、删除日程请求,支持多种操作和提醒。<br/>`日程管理` `时间插件` `新增日程` `查询日程` `删除日程` |
251
- | [商务邮件撰写专家](https://chat-preview.lobehub.com/market?agent=business-email)<br/><sup>By **[canisminor1990](https://github.com/canisminor1990)** on **2024-03-06**</sup> | 商务邮件撰写专家,擅长中英文商务邮件,跨文化沟通,GitHub 开源社区交流。<br/>`商务邮件撰写` `商业合作` `商务授权` `跨文化沟通` `git-hub和开源社区` |
252
-
253
- > 📊 Total agents: [<kbd>**201**</kbd> ](https://github.com/lobehub/lobe-chat-agents)
246
+ | 最近新增 | 助手说明 |
247
+ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
248
+ | [亚马逊卖家支持代理](https://chat-preview.lobehub.com/market?agent=amazon-seller-support-agent)<br/><sup>By **[etnperlong](https://github.com/etnperlong)** on **2024-03-15**</sup> | AI 助手,协助亚马逊卖家回复客户服务回复,提供详细和有力的回复,以达到令人满意的解决方案。<br/>`亚马逊` `卖家` `写作` |
249
+ | [TikTok 脚本撰写器](https://chat-preview.lobehub.com/market?agent=tiktok-script-writer)<br/><sup>By **[sdhjn19dj1m](https://github.com/sdhjn19dj1m)** on **2024-03-12**</sup> | 此脚本专为 TikTok 的短视频格式量身定制,旨在吸引和娱乐特定目标受众。它融入了流行元素和内容病毒传播的最佳实践,确保视频从一开始就吸引注意力。脚本结构包括引人入胜的开场、简洁而有影响力的主体信息和引人注目的行动号召,同时反映用户期望的语气和主题。<br/>`tik-tok` `short-video` `viral-content` `trending-hashtag` `engagement` |
250
+ | [Gen Z Engagement Specialist](https://chat-preview.lobehub.com/market?agent=gen-z)<br/><sup>By **[MYSeaIT](https://github.com/MYSeaIT)** on **2024-03-09**</sup> | 专注于通过定制互动反映他们的偏好和价值观,与 Gen Z 用户进行互动。<br/>`engagement` `gen-z` `communication` `advice` `interaction` |
251
+ | [日程管理助手](https://chat-preview.lobehub.com/market?agent=calendar-manager)<br/><sup>By **[ccdanpian](https://github.com/ccdanpian)** on **2024-03-07**</sup> | 日程管理助手,调用时间插件,处理新增、查询、删除日程请求,支持多种操作和提醒。<br/>`日程管理` `时间插件` `新增日程` `查询日程` `删除日程` |
252
+
253
+ > 📊 Total agents: [<kbd>**202**</kbd> ](https://github.com/lobehub/lobe-chat-agents)
254
254
 
255
255
  <!-- AGENT LIST -->
256
256
 
@@ -1,94 +1,27 @@
1
- import { Callout, Steps } from 'nextra/components';
2
-
3
1
  # Identity Verification Service
4
2
 
5
- LobeChat supports configuring external identity verification services for internal use by enterprises/organizations to centrally manage user authorization. Currently, it supports [Auth0][auth0-client-page]. This article will introduce how to configure the identity verification service.
6
-
7
- ## Configure Identity Verification Service
8
-
9
- <Steps>
10
- ### Create Auth0 Application
11
-
12
- Register and log in to [Auth0][auth0-client-page], click on the "Applications" in the left navigation bar to switch to the application management interface, and click "Create Application" in the upper right corner to create an application.
13
-
14
- ![](https://github.com/CloudPassenger/lobe-chat/assets/30863298/1b405347-f4c3-4c55-82f6-47116f2210d0)
15
-
16
- Fill in the application name you want to display to the organization users, choose any application type, and click "Create".
17
-
18
- ![](https://github.com/CloudPassenger/lobe-chat/assets/30863298/75c92f85-3ad3-4473-a9c6-e667e28d428d)
19
-
20
- After successful creation, click on the corresponding application to enter the application details page, switch to the "Settings" tab, and you can see the corresponding configuration information.
21
-
22
- ![](https://github.com/CloudPassenger/lobe-chat/assets/30863298/a1ed996b-95ef-4b7d-a50d-b4666eccfecb)
23
-
24
- In the application configuration page, you also need to configure Allowed Callback URLs, where you should fill in:
25
-
26
- ```bash
27
- http(s)://your-domain/api/auth/callback/auth0
28
- ```
3
+ LobeChat supports the configuration of external identity verification services for internal use within enterprises/organizations to centrally manage user authorization.
29
4
 
30
- ![](https://github.com/CloudPassenger/lobe-chat/assets/30863298/575f46aa-f485-49bd-8b90-dbb1ce1a5c1b)
5
+ Currently supported identity verification services include:
31
6
 
32
- <Callout type={'info'}>
33
- You can fill in or modify Allowed Callback URLs after deployment, but make sure the filled URL is
34
- consistent with the deployed URL.
35
- </Callout>
7
+ - [Auth0](/en/self-hosting/advanced/sso-providers/auth0)
8
+ - [Microsoft Entra ID](/en/self-hosting/advanced/sso-providers/microsoft-entra-id)
36
9
 
37
- ### Add Users
38
-
39
- Click on the "Users Management" in the left navigation bar to enter the user management interface, where you can create users for your organization to log in to LobeChat.
40
-
41
- ![](https://github.com/CloudPassenger/lobe-chat/assets/30863298/3b8127ab-dc4f-4ff9-a4cb-dec3ef0295cc)
42
-
43
- ### Configure Environment Variables
44
-
45
- When deploying LobeChat, you need to configure the following environment variables:
46
-
47
- | Environment Variable | Type | Description |
48
- | --------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
49
- | `ENABLE_OAUTH_SSO` | Required | Enable single sign-on (SSO) for LobeChat. Set to `1` to enable single sign-on. |
50
- | `NEXTAUTH_SECRET` | Required | Key used to encrypt Auth.js session tokens. You can generate a key using the following command: `openssl rand -base64 32` |
51
- | `AUTH0_CLIENT_ID` | Required | Client ID of the Auth0 application |
52
- | `AUTH0_CLIENT_SECRET` | Required | Client Secret of the Auth0 application |
53
- | `AUTH0_ISSUER` | Required | Domain of the Auth0 application, `https://example.auth0.com` |
54
- | `ACCESS_CODE` | Required | Add a password to access this service. You can set a sufficiently long random password to "disable" access code authorization. |
55
- | `NEXTAUTH_URL` | Optional | The URL is used to specify the callback address for the execution of OAuth authentication in Auth.js. It needs to be set only when the default address is incorrect. `https://example.com/api/auth` |
56
-
57
- You can refer to the related variable details at [Environment Variables](/en/self-hosting/environment-variable#auth0).
58
- </Steps>
59
-
60
- <Callout>
61
- After successful deployment, users will be able to authenticate and use LobeChat using the users
62
- configured in Auth0.
63
- </Callout>
10
+ Click on the links to view the corresponding platform's configuration documentation.
64
11
 
65
12
  ## Advanced Configuration
66
13
 
67
- ### Connecting to an Existing Single Sign-On Service
68
-
69
- If your enterprise or organization already has a unified identity authentication infrastructure, you can connect to an existing single sign-on service in Applications -> SSO Integrations.
70
-
71
- Auth0 supports single sign-on services such as Azure Active Directory, Slack, Google Workspace, Office 365, Zoom, and more. For a detailed list of supported services, please refer to [this link][auth0-sso-integrations].
72
-
73
- ![](https://github.com/CloudPassenger/lobe-chat/assets/30863298/32650f4f-d0b0-4843-b26d-d35bad11d8a3)
74
-
75
- ### Configuring Social Login
14
+ To simultaneously enable multiple identity verification sources, please set the `SSO_PROVIDERS` environment variable, separating them with commas, for example, `auth0,azure-ad`.
76
15
 
77
- If your enterprise or organization needs to support external user logins, you can configure social login services in Authentication -> Social.
16
+ The order corresponds to the display order of the SSO providers.
78
17
 
79
- ![](https://github.com/CloudPassenger/lobe-chat/assets/30863298/7b6f6a6c-2686-49d8-9dbd-0516053f1efa)
18
+ | SSO Provider | Value |
19
+ | ------------------ | -------- |
20
+ | Auth0 | auth0 |
21
+ | Microsoft Entra ID | azure-ad |
80
22
 
81
- <Callout type={'warning'}>
82
- Configuring social login services by default allows anyone to authenticate, which may lead to
83
- LobeChat being abused by external users.
84
- </Callout>
23
+ ## Other SSO Providers
85
24
 
86
- <Callout>
87
- If you need to restrict login users, be sure to configure a **blocking policy**: After enabling
88
- the social login option, refer to [this article][auth0-login-actions-manual] to create an Action
89
- to set up a blocking/allow list.
90
- </Callout>
25
+ Please refer to the [NextAuth.js][next-auth-js] documentation and feel free to submit a Pull Request.
91
26
 
92
- [auth0-client-page]: https://manage.auth0.com/dashboard
93
- [auth0-login-actions-manual]: https://auth0.com/blog/permit-or-deny-login-requests-using-auth0-actions/
94
- [auth0-sso-integrations]: https://marketplace.auth0.com/features/sso-integrations
27
+ [next-auth-js]: https://next-auth.js.org/providers
@@ -1,88 +1,27 @@
1
- import { Callout, Steps } from 'nextra/components';
2
-
3
1
  # 身份验证服务
4
2
 
5
- LobeChat 支持配置外部身份验证服务,供企业 / 组织内部使用,统一管理用户授权,目前支持 [Auth0][auth0-client-page],本文将介绍如何配置身份验证服务。
6
-
7
- ## 配置身份验证服务
8
-
9
- <Steps>
10
- ### 创建 Auth0 应用
11
-
12
- 注册并登录 [Auth0][auth0-client-page],点击左侧导航栏的「Applications」,切换到应用管理界面,点击右上角「Create Application」以创建应用。
13
-
14
- ![](https://github.com/CloudPassenger/lobe-chat/assets/30863298/1b405347-f4c3-4c55-82f6-47116f2210d0)
15
-
16
- 填写你想向组织用户显示的应用名称,可选择任意应用类型,点击「Create」。
17
-
18
- ![](https://github.com/CloudPassenger/lobe-chat/assets/30863298/75c92f85-3ad3-4473-a9c6-e667e28d428d)
19
-
20
- 创建成功后,点击相应的应用,进入应用详情页,切换到「Settings」标签页,就可以看到相应的配置信息
21
-
22
- ![](https://github.com/CloudPassenger/lobe-chat/assets/30863298/a1ed996b-95ef-4b7d-a50d-b4666eccfecb)
23
-
24
- 在应用配置页面中,还需要配置 Allowed Callback URLs,在此处填写:
25
-
26
- ```bash
27
- http(s)://your-domain/api/auth/callback/auth0
28
- ```
3
+ LobeChat 支持配置外部身份验证服务,供企业 / 组织内部使用,统一管理用户授权。
29
4
 
30
- ![](https://github.com/CloudPassenger/lobe-chat/assets/30863298/575f46aa-f485-49bd-8b90-dbb1ce1a5c1b)
5
+ 目前支持的身份验证服务有:
31
6
 
32
- <Callout type={'info'}>
33
- 可以在部署后再填写或修改 Allowed Callback URLs,但是务必保证填写的 URL 与部署的 URL 一致
34
- </Callout>
7
+ - [Auth0](/zh/self-hosting/advanced/sso-providers/auth0)
8
+ - [Microsoft Entra ID](/zh/self-hosting/advanced/sso-providers/microsoft-entra-id)
35
9
 
36
- ### 新增用户
37
-
38
- 点击左侧导航栏的「Users Management」,进入用户管理界面,可以为你的组织新建用户,用以登录 LobeChat
39
-
40
- ![](https://github.com/CloudPassenger/lobe-chat/assets/30863298/3b8127ab-dc4f-4ff9-a4cb-dec3ef0295cc)
41
-
42
- ### 配置环境变量
43
-
44
- 在部署 LobeChat 时,你需要配置以下环境变量:
45
-
46
- | 环境变量 | 类型 | 描述 |
47
- | --------------------- | -- | ------------------------------------------------------------------------------------------- |
48
- | `ENABLE_OAUTH_SSO` | 必选 | 为 LobeChat 启用单点登录 (SSO)。设置为 `1` 以启用单点登录。 |
49
- | `NEXTAUTH_SECRET` | 必选 | 用于加密 Auth.js 会话令牌的密钥。您可以使用以下命令生成秘钥: `openssl rand -base64 32` |
50
- | `AUTH0_CLIENT_ID` | 必选 | Auth0 应用程序的 Client ID |
51
- | `AUTH0_CLIENT_SECRET` | 必选 | Auth0 应用程序的 Client Secret |
52
- | `AUTH0_ISSUER` | 必选 | Auth0 应用程序的 Domain,`https://example.auth0.com` |
53
- | `ACCESS_CODE` | 必选 | 添加访问此服务的密码,你可以设置一个足够长的随机密码以 “禁用” 访问码授权 |
54
- | `NEXTAUTH_URL` | 可选 | 该 URL 用于指定 Auth.js 在执行 OAuth 验证时的回调地址,当默认生成的重定向地址发生不正确时才需要设置。`https://example.com/api/auth` |
55
-
56
- 前往 [环境变量](/zh/self-hosting/environment-variable#auth0) 可查阅相关变量详情。
57
- </Steps>
58
-
59
- <Callout>部署成功后,用户将可以使用 Auth0 中配置的用户通过身份认证并使用 LobeChat。</Callout>
10
+ 点击链接可以查看对应平台的配置文档。
60
11
 
61
12
  ## 进阶配置
62
13
 
63
- ### 连接现有的单点登录服务
64
-
65
- 如果你的企业或组织已有现有的统一身份认证设施,可在 Applications -> SSO Integrations 中,连接现有的单点登录服务。
66
-
67
- Auth0 支持 Azure Active Directory / Slack / Google Workspace / Office 365 / Zoom 等单点登录服务,详细支持列表可参考 [这里][auth0-sso-integrations]
68
-
69
- ![](https://github.com/CloudPassenger/lobe-chat/assets/30863298/32650f4f-d0b0-4843-b26d-d35bad11d8a3)
70
-
71
- ### 配置社交登录
14
+ 同时启用多个身份验证源请设置 `SSO_PROVIDERS` 环境变量,以逗号 `,` 分割,例如 `auth0,azure-ad`。
72
15
 
73
- 如果你的企业或组织需要支持外部人员登录,可以在 Authentication -> Social 中,配置社交登录服务。
16
+ 顺序为 SSO 提供商的显示顺序。
74
17
 
75
- ![](https://github.com/CloudPassenger/lobe-chat/assets/30863298/7b6f6a6c-2686-49d8-9dbd-0516053f1efa)
18
+ | SSO 提供商 | 值 |
19
+ | ------------------ | -------- |
20
+ | Auth0 | auth0 |
21
+ | Microsoft Entra ID | azure-ad |
76
22
 
77
- <Callout type={'warning'}>
78
- 配置社交登录服务默认会允许所有人通过认证,这可能会导致 LobeChat 被外部人员滥用。
79
- </Callout>
23
+ ## 其他 SSO 提供商
80
24
 
81
- <Callout>
82
- 如果你需要限制登录人员,务必配置 **阻止策略**: 请在打开社交登录选项后,参考
83
- [这篇文章][auth0-login-actions-manual] 创建 Action 来设置阻止 / 允许列表。
84
- </Callout>
25
+ 请参考 [NextAuth.js][next-auth-js] 文档,欢迎提交 Pull Request。
85
26
 
86
- [auth0-client-page]: https://manage.auth0.com/dashboard
87
- [auth0-login-actions-manual]: https://auth0.com/blog/permit-or-deny-login-requests-using-auth0-actions/
88
- [auth0-sso-integrations]: https://marketplace.auth0.com/features/sso-integrations
27
+ [next-auth-js]: https://next-auth.js.org/providers
@@ -0,0 +1,91 @@
1
+ import { Callout, Steps } from 'nextra/components';
2
+
3
+ # Configure Auth0 Identity Verification Service
4
+
5
+ <Steps>
6
+ ### Create Auth0 Application
7
+
8
+ Register and log in to [Auth0][auth0-client-page], click on the "Applications" in the left navigation bar to switch to the application management interface, and click "Create Application" in the upper right corner to create an application.
9
+
10
+ ![](https://github.com/CloudPassenger/lobe-chat/assets/30863298/1b405347-f4c3-4c55-82f6-47116f2210d0)
11
+
12
+ Fill in the application name you want to display to the organization users, choose any application type, and click "Create".
13
+
14
+ ![](https://github.com/CloudPassenger/lobe-chat/assets/30863298/75c92f85-3ad3-4473-a9c6-e667e28d428d)
15
+
16
+ After successful creation, click on the corresponding application to enter the application details page, switch to the "Settings" tab, and you can see the corresponding configuration information.
17
+
18
+ ![](https://github.com/CloudPassenger/lobe-chat/assets/30863298/a1ed996b-95ef-4b7d-a50d-b4666eccfecb)
19
+
20
+ In the application configuration page, you also need to configure Allowed Callback URLs, where you should fill in:
21
+
22
+ ```bash
23
+ http(s)://your-domain/api/auth/callback/auth0
24
+ ```
25
+
26
+ ![](https://github.com/CloudPassenger/lobe-chat/assets/30863298/575f46aa-f485-49bd-8b90-dbb1ce1a5c1b)
27
+
28
+ <Callout type={'info'}>
29
+ You can fill in or modify Allowed Callback URLs after deployment, but make sure the filled URL is
30
+ consistent with the deployed URL.
31
+ </Callout>
32
+
33
+ ### Add Users
34
+
35
+ Click on the "Users Management" in the left navigation bar to enter the user management interface, where you can create users for your organization to log in to LobeChat.
36
+
37
+ ![](https://github.com/CloudPassenger/lobe-chat/assets/30863298/3b8127ab-dc4f-4ff9-a4cb-dec3ef0295cc)
38
+
39
+ ### Configure Environment Variables
40
+
41
+ When deploying LobeChat, you need to configure the following environment variables:
42
+
43
+ | Environment Variable | Type | Description |
44
+ | --------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
45
+ | `ENABLE_OAUTH_SSO` | Required | Enable single sign-on (SSO) for LobeChat. Set to `1` to enable single sign-on. |
46
+ | `NEXTAUTH_SECRET` | Required | Key used to encrypt Auth.js session tokens. You can generate a key using the following command: `openssl rand -base64 32` |
47
+ | `SSO_PROVIDERS` | Optional | Select the single sign-on provider for LoboChat. Use `auth0` for Auth0. |
48
+ | `AUTH0_CLIENT_ID` | Required | Client ID of the Auth0 application |
49
+ | `AUTH0_CLIENT_SECRET` | Required | Client Secret of the Auth0 application |
50
+ | `AUTH0_ISSUER` | Required | Domain of the Auth0 application, `https://example.auth0.com` |
51
+ | `ACCESS_CODE` | Required | Add a password to access this service. You can set a sufficiently long random password to "disable" access code authorization. |
52
+ | `NEXTAUTH_URL` | Optional | The URL is used to specify the callback address for the execution of OAuth authentication in Auth.js. It needs to be set only when the default address is incorrect. `https://example.com/api/auth` |
53
+
54
+ <Callout type={'info'}>You can refer to the related variable details at [📘Environment Variables](/en/self-hosting/environment-variable#auth0).</Callout>
55
+ </Steps>
56
+
57
+ <Callout>
58
+ After successful deployment, users will be able to authenticate and use LobeChat using the users
59
+ configured in Auth0.
60
+ </Callout>
61
+
62
+ ## Advanced Configuration
63
+
64
+ ### Connecting to an Existing Single Sign-On Service
65
+
66
+ If your enterprise or organization already has a unified identity authentication infrastructure, you can connect to an existing single sign-on service in Applications -> SSO Integrations.
67
+
68
+ Auth0 supports single sign-on services such as Azure Active Directory, Slack, Google Workspace, Office 365, Zoom, and more. For a detailed list of supported services, please refer to [this link][auth0-sso-integrations].
69
+
70
+ ![](https://github.com/CloudPassenger/lobe-chat/assets/30863298/32650f4f-d0b0-4843-b26d-d35bad11d8a3)
71
+
72
+ ### Configuring Social Login
73
+
74
+ If your enterprise or organization needs to support external user logins, you can configure social login services in Authentication -> Social.
75
+
76
+ ![](https://github.com/CloudPassenger/lobe-chat/assets/30863298/7b6f6a6c-2686-49d8-9dbd-0516053f1efa)
77
+
78
+ <Callout type={'warning'}>
79
+ Configuring social login services by default allows anyone to authenticate, which may lead to
80
+ LobeChat being abused by external users.
81
+ </Callout>
82
+
83
+ <Callout>
84
+ If you need to restrict login users, be sure to configure a **blocking policy**: After enabling
85
+ the social login option, refer to [this article][auth0-login-actions-manual] to create an Action
86
+ to set up a blocking/allow list.
87
+ </Callout>
88
+
89
+ [auth0-client-page]: https://manage.auth0.com/dashboard
90
+ [auth0-login-actions-manual]: https://auth0.com/blog/permit-or-deny-login-requests-using-auth0-actions/
91
+ [auth0-sso-integrations]: https://marketplace.auth0.com/features/sso-integrations
@@ -0,0 +1,85 @@
1
+ import { Callout, Steps } from 'nextra/components';
2
+
3
+ # 配置 Auth0 身份验证服务
4
+
5
+ <Steps>
6
+ ### 创建 Auth0 应用
7
+
8
+ 注册并登录 [Auth0][auth0-client-page],点击左侧导航栏的「Applications」,切换到应用管理界面,点击右上角「Create Application」以创建应用。
9
+
10
+ ![](https://github.com/CloudPassenger/lobe-chat/assets/30863298/1b405347-f4c3-4c55-82f6-47116f2210d0)
11
+
12
+ 填写你想向组织用户显示的应用名称,可选择任意应用类型,点击「Create」。
13
+
14
+ ![](https://github.com/CloudPassenger/lobe-chat/assets/30863298/75c92f85-3ad3-4473-a9c6-e667e28d428d)
15
+
16
+ 创建成功后,点击相应的应用,进入应用详情页,切换到「Settings」标签页,就可以看到相应的配置信息
17
+
18
+ ![](https://github.com/CloudPassenger/lobe-chat/assets/30863298/a1ed996b-95ef-4b7d-a50d-b4666eccfecb)
19
+
20
+ 在应用配置页面中,还需要配置 Allowed Callback URLs,在此处填写:
21
+
22
+ ```bash
23
+ http(s)://your-domain/api/auth/callback/auth0
24
+ ```
25
+
26
+ ![](https://github.com/CloudPassenger/lobe-chat/assets/30863298/575f46aa-f485-49bd-8b90-dbb1ce1a5c1b)
27
+
28
+ <Callout type={'info'}>
29
+ 可以在部署后再填写或修改 Allowed Callback URLs,但是务必保证填写的 URL 与部署的 URL 一致
30
+ </Callout>
31
+
32
+ ### 新增用户
33
+
34
+ 点击左侧导航栏的「Users Management」,进入用户管理界面,可以为你的组织新建用户,用以登录 LobeChat
35
+
36
+ ![](https://github.com/CloudPassenger/lobe-chat/assets/30863298/3b8127ab-dc4f-4ff9-a4cb-dec3ef0295cc)
37
+
38
+ ### 配置环境变量
39
+
40
+ 在部署 LobeChat 时,你需要配置以下环境变量:
41
+
42
+ | 环境变量 | 类型 | 描述 |
43
+ | --------------------- | -- | ------------------------------------------------------------------------------------------- |
44
+ | `ENABLE_OAUTH_SSO` | 必选 | 为 LobeChat 启用单点登录 (SSO)。设置为 `1` 以启用单点登录。 |
45
+ | `NEXTAUTH_SECRET` | 必选 | 用于加密 Auth.js 会话令牌的密钥。您可以使用以下命令生成秘钥: `openssl rand -base64 32` |
46
+ | `SSO_PROVIDERS` | 必选 | 选择 LoboChat 的单点登录提供商。使用 Auth0 请填写 `auth0`。 |
47
+ | `AUTH0_CLIENT_ID` | 必选 | Auth0 应用程序的 Client ID |
48
+ | `AUTH0_CLIENT_SECRET` | 必选 | Auth0 应用程序的 Client Secret |
49
+ | `AUTH0_ISSUER` | 必选 | Auth0 应用程序的 Domain,`https://example.auth0.com` |
50
+ | `ACCESS_CODE` | 必选 | 添加访问此服务的密码,你可以设置一个足够长的随机密码以 “禁用” 访问码授权 |
51
+ | `NEXTAUTH_URL` | 可选 | 该 URL 用于指定 Auth.js 在执行 OAuth 验证时的回调地址,当默认生成的重定向地址发生不正确时才需要设置。`https://example.com/api/auth` |
52
+
53
+ <Callout type={'info'}> 前往 [📘 环境变量](/zh/self-hosting/environment-variable#auth0) 可查阅相关变量详情。</Callout>
54
+ </Steps>
55
+
56
+ <Callout type={'info'}>部署成功后,用户将可以使用 Auth0 中配置的用户通过身份认证并使用 LobeChat。</Callout>
57
+
58
+ ## 进阶配置
59
+
60
+ ### 连接现有的单点登录服务
61
+
62
+ 如果你的企业或组织已有现有的统一身份认证设施,可在 Applications -> SSO Integrations 中,连接现有的单点登录服务。
63
+
64
+ Auth0 支持 Azure Active Directory / Slack / Google Workspace / Office 365 / Zoom 等单点登录服务,详细支持列表可参考 [这里][auth0-sso-integrations]
65
+
66
+ ![](https://github.com/CloudPassenger/lobe-chat/assets/30863298/32650f4f-d0b0-4843-b26d-d35bad11d8a3)
67
+
68
+ ### 配置社交登录
69
+
70
+ 如果你的企业或组织需要支持外部人员登录,可以在 Authentication -> Social 中,配置社交登录服务。
71
+
72
+ ![](https://github.com/CloudPassenger/lobe-chat/assets/30863298/7b6f6a6c-2686-49d8-9dbd-0516053f1efa)
73
+
74
+ <Callout type={'warning'}>
75
+ 配置社交登录服务默认会允许所有人通过认证,这可能会导致 LobeChat 被外部人员滥用。
76
+ </Callout>
77
+
78
+ <Callout>
79
+ 如果你需要限制登录人员,务必配置 **阻止策略**: 请在打开社交登录选项后,参考
80
+ [这篇文章][auth0-login-actions-manual] 创建 Action 来设置阻止 / 允许列表。
81
+ </Callout>
82
+
83
+ [auth0-client-page]: https://manage.auth0.com/dashboard
84
+ [auth0-login-actions-manual]: https://auth0.com/blog/permit-or-deny-login-requests-using-auth0-actions/
85
+ [auth0-sso-integrations]: https://marketplace.auth0.com/features/sso-integrations
@@ -0,0 +1,69 @@
1
+ # Configuration of Microsoft Entra ID Authentication Service
2
+
3
+ <Steps>
4
+ ### Create a Microsoft Entra ID Application
5
+
6
+ In your [Microsoft Azure Portal][microsoft-azure-portal], go to Microsoft Entra ID -> App registrations -> New registration to create a new application.
7
+
8
+ Fill in the desired application name to be displayed to organizational users, choose the account types you wish to support, and if only internal users are supported, select `Accounts in this organizational directory only (Default Directory only - Single tenant)`.
9
+
10
+ In the `Redirect URI (optional)` section, for the application type, select `Web`, and in the Callback URL, enter:
11
+
12
+ ```bash
13
+ https://<your-domain>/api/auth/callback/azure-ad
14
+ ```
15
+
16
+ <Callout type={'info'}>
17
+ - You can fill in or modify the Redirect URIs after registering, but make sure the URL you enter matches the deployed URL.
18
+ - Please replace "your-domain" with your own domain.
19
+ </Callout>
20
+
21
+ ![App Register](https://github.com/lobehub/lobe-chat/assets/13883964/4f9d83bd-b3fc-4abc-bcf4-ccbad65c219d)
22
+
23
+ Click on "Register".
24
+
25
+ After successfully creating the application, click on the corresponding application to enter the application details page, and switch to the "Overview" tab to view the corresponding configuration information.
26
+
27
+ ![App Overview](https://github.com/lobehub/lobe-chat/assets/13883964/48a0b702-05bd-4ce4-a007-a8ad00a36e5a)
28
+
29
+ Go to "Certificates & secrets", select the "Client secrets" tab, click on "New client secret", fill in the description, select the expiration time, and click on "Add" to create a new client secret.
30
+
31
+ ![Create App Client Secret](https://github.com/lobehub/lobe-chat/assets/13883964/c9d66fa0-158c-4bd3-a1fa-969e638259d2)
32
+
33
+ <Callout type={'info'}>Please make sure to save your client secret as this is your only chance to view it.</Callout>
34
+
35
+ ### Add Users
36
+
37
+ Go back to the "Microsoft Entra ID" interface, enter "Users", click on "New user", fill in the user information, and click on "Create" to create a user for using LobeChat.
38
+
39
+ ### Configure Environment Variables
40
+
41
+ When deploying LobeChat, you need to configure the following environment variables:
42
+
43
+ | Environment Variable | Type | Description |
44
+ | ------------------------ | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
45
+ | `ENABLE_OAUTH_SSO` | Required | Enable single sign-on (SSO) for LobeChat. Set to `1` to enable single sign-on. |
46
+ | `NEXTAUTH_SECRET` | Required | Key used to encrypt Auth.js session tokens. You can generate the key using the following command: `openssl rand -base64 32` |
47
+ | `SSO_PROVIDERS` | Required | Select the single sign-on provider for LoboChat. Use `azure-ad` for Microsoft Entra ID. |
48
+ | `AZURE_AD_CLIENT_ID` | Required | Client ID of the Microsoft Entra ID application. |
49
+ | `AZURE_AD_CLIENT_SECRET` | Required | Client Secret of the Microsoft Entra ID application. |
50
+ | `AZURE_AD_TENANT_ID` | Required | Tenant ID of the Microsoft Entra ID application. |
51
+ | `ACCESS_CODE` | Required | Add a password for accessing this service, you can set a sufficiently long random password to "disable" access code authorization. |
52
+ | `NEXTAUTH_URL` | Optional | This URL is used to specify the callback address for Auth.js when performing OAuth authentication. It is only necessary to set it when the default generated redirect address is incorrect. `https://example.com/api/auth` |
53
+
54
+ <Callout type={'info'}>You can refer to [📘 environment variables](/en/self-hosting/environment-variable#microsoft-entra-id) for details on related variables.</Callout>
55
+ </Steps>
56
+
57
+ <Callout>After successful deployment, users will be able to authenticate and use LobeChat using the users configured in Microsoft Entra ID.</Callout>
58
+
59
+ ## Advanced Configuration
60
+
61
+ Please explore further in the [Microsoft Entra ID Learning Center][microsoft-learn-entra].
62
+
63
+ ## Related Resources
64
+
65
+ - [Quickstart: Register an app][microsoft-entra-register-app]
66
+
67
+ [microsoft-azure-portal]: https://portal.azure.com/
68
+ [microsoft-entra-register-app]: https://learn.microsoft.com/en-us/entra/identity-platform/quickstart-register-app
69
+ [microsoft-learn-entra]: https://learn.microsoft.com/en-us/entra/identity/