@lobehub/chat 1.8.2 → 1.9.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 (52) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/docs/self-hosting/advanced/auth/clerk.mdx +81 -0
  3. package/docs/self-hosting/advanced/auth/clerk.zh-CN.mdx +71 -0
  4. package/docs/self-hosting/advanced/{sso-providers → auth/next-auth}/auth0.zh-CN.mdx +2 -1
  5. package/docs/self-hosting/advanced/s3/cloudflare-r2.mdx +146 -0
  6. package/docs/self-hosting/advanced/s3/cloudflare-r2.zh-CN.mdx +146 -0
  7. package/docs/self-hosting/advanced/s3.mdx +28 -0
  8. package/docs/self-hosting/advanced/s3.zh-CN.mdx +27 -0
  9. package/docs/self-hosting/advanced/webrtc.mdx +12 -0
  10. package/docs/self-hosting/environment-variables/basic.mdx +3 -1
  11. package/docs/self-hosting/environment-variables/basic.zh-CN.mdx +2 -2
  12. package/docs/self-hosting/server-database/docker-compose.mdx +29 -0
  13. package/docs/self-hosting/server-database/docker-compose.zh-CN.mdx +30 -0
  14. package/docs/self-hosting/server-database/docker.mdx +131 -0
  15. package/docs/self-hosting/server-database/docker.zh-CN.mdx +129 -0
  16. package/docs/self-hosting/server-database/netlify.mdx +14 -0
  17. package/docs/self-hosting/server-database/netlify.zh-CN.mdx +16 -0
  18. package/docs/self-hosting/server-database/railway.mdx +14 -0
  19. package/docs/self-hosting/server-database/railway.zh-CN.mdx +15 -0
  20. package/docs/self-hosting/server-database/repocloud.mdx +16 -0
  21. package/docs/self-hosting/server-database/repocloud.zh-CN.mdx +14 -0
  22. package/docs/self-hosting/server-database/sealos.mdx +12 -0
  23. package/docs/self-hosting/server-database/sealos.zh-CN.mdx +14 -0
  24. package/docs/self-hosting/server-database/vercel.mdx +418 -0
  25. package/docs/self-hosting/{advanced/server-database.zh-CN.mdx → server-database/vercel.zh-CN.mdx} +14 -24
  26. package/docs/self-hosting/server-database/zeabur.mdx +16 -0
  27. package/docs/self-hosting/server-database/zeabur.zh-CN.mdx +14 -0
  28. package/docs/self-hosting/server-database.mdx +164 -0
  29. package/docs/self-hosting/server-database.zh-CN.mdx +169 -0
  30. package/docs/self-hosting/start.mdx +18 -14
  31. package/docs/self-hosting/start.zh-CN.mdx +21 -16
  32. package/docs/usage/providers/novita.mdx +3 -3
  33. package/docs/usage/providers/novita.zh-CN.mdx +3 -1
  34. package/package.json +1 -1
  35. package/src/layout/GlobalProvider/StoreInitialization.tsx +2 -0
  36. package/src/server/globalConfig/index.ts +2 -0
  37. package/src/store/serverConfig/selectors.ts +1 -0
  38. package/src/store/user/slices/auth/action.ts +6 -0
  39. package/src/store/user/slices/auth/initialState.ts +2 -1
  40. package/src/types/serverConfig.ts +1 -0
  41. package/docs/self-hosting/advanced/server-database.mdx +0 -425
  42. /package/docs/self-hosting/advanced/{sso-providers → auth/next-auth}/auth0.mdx +0 -0
  43. /package/docs/self-hosting/advanced/{sso-providers → auth/next-auth}/authentik.mdx +0 -0
  44. /package/docs/self-hosting/advanced/{sso-providers → auth/next-auth}/authentik.zh-CN.mdx +0 -0
  45. /package/docs/self-hosting/advanced/{sso-providers → auth/next-auth}/github.mdx +0 -0
  46. /package/docs/self-hosting/advanced/{sso-providers → auth/next-auth}/github.zh-CN.mdx +0 -0
  47. /package/docs/self-hosting/advanced/{sso-providers → auth/next-auth}/microsoft-entra-id.mdx +0 -0
  48. /package/docs/self-hosting/advanced/{sso-providers → auth/next-auth}/microsoft-entra-id.zh-CN.mdx +0 -0
  49. /package/docs/self-hosting/advanced/{sso-providers → auth/next-auth}/zitadel.mdx +0 -0
  50. /package/docs/self-hosting/advanced/{sso-providers → auth/next-auth}/zitadel.zh-CN.mdx +0 -0
  51. /package/docs/self-hosting/advanced/{authentication.mdx → auth.mdx} +0 -0
  52. /package/docs/self-hosting/advanced/{authentication.zh-CN.mdx → auth.zh-CN.mdx} +0 -0
package/CHANGELOG.md CHANGED
@@ -2,6 +2,31 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ## [Version 1.9.0](https://github.com/lobehub/lobe-chat/compare/v1.8.2...v1.9.0)
6
+
7
+ <sup>Released on **2024-08-05**</sup>
8
+
9
+ #### ✨ Features
10
+
11
+ - **misc**: Skip login page if only one provider exists.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### What's improved
19
+
20
+ - **misc**: Skip login page if only one provider exists, closes [#3400](https://github.com/lobehub/lobe-chat/issues/3400) ([52da1d8](https://github.com/lobehub/lobe-chat/commit/52da1d8))
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
+
5
30
  ### [Version 1.8.2](https://github.com/lobehub/lobe-chat/compare/v1.8.1...v1.8.2)
6
31
 
7
32
  <sup>Released on **2024-08-03**</sup>
@@ -0,0 +1,81 @@
1
+ ---
2
+ title: Configure Clerk Authentication Service - Step-by-Step Guide
3
+ description: >-
4
+ Learn how to set up Clerk authentication with environment variables and
5
+ webhooks.
6
+ tags:
7
+ - Clerk Authentication
8
+ - Environment Variables
9
+ - Webhook Configuration
10
+ ---
11
+ # Configure Clerk Authentication Service
12
+
13
+ Go to [Clerk](https://clerk.com?utm_source=lobehub\&utm_medium=docs) to register and create an application to obtain the corresponding Public Key and Secret Key.
14
+
15
+ ## Get Environment Variables
16
+
17
+ <Steps>
18
+
19
+ ### Add Public and Private Key Environment Variables
20
+
21
+ Add `NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY` and `CLERK_SECRET_KEY` environment variables. You can click on the "API Keys" in the menu and copy the corresponding values to get these environment variables.
22
+
23
+ <Image
24
+ alt={'Find the corresponding public and private key environment variables in Clerk'}
25
+ src={'https://github.com/lobehub/lobe-chat/assets/28616219/89883703-7a1a-4a11-b944-5d804544e57c'}>
26
+
27
+ >
28
+ </Image>
29
+
30
+ The environment variables required for this step are as follows:
31
+
32
+ ```shell
33
+ NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_live_xxxxxxxxxxx
34
+ CLERK_SECRET_KEY=sk_live_xxxxxxxxxxxxxxxxxxxxxx
35
+ ```
36
+
37
+ ### Create and Configure Webhook in Clerk
38
+
39
+ Since we let Clerk fully handle user authentication and management, we need Clerk to notify our application and store the changes in the user lifecycle (create, update, delete). We achieve this by using the Webhook provided by Clerk.
40
+
41
+ We need to add an endpoint in Clerk's Webhooks to inform Clerk to send notifications to this endpoint when a user's information changes.
42
+
43
+ <Image
44
+ alt={'Add Webhooks endpoint in Clerk'}
45
+ src={'https://github.com/lobehub/lobe-chat/assets/28616219/f50f47fb-5e8e-4930-bf4e-8cf6f5b8afb9'}>
46
+
47
+ >
48
+ </Image>
49
+
50
+ Fill in your project URL in the endpoint, such as `https://your-project.com/api/webhooks/clerk`. Then, subscribe to events by checking the three user events (`user.created`, `user.deleted`, `user.updated`), and click create.
51
+
52
+ <Callout type={'warning'}>The `https://` in the URL is essential to maintain the integrity of the URL.</Callout>
53
+
54
+ <Image
55
+ alt={'Configure URL and user events when adding Clerk Webhooks'}
56
+ src={'https://github.com/lobehub/lobe-chat/assets/28616219/0249ea56-ab17-4aa9-a56c-9ebd556c2645'}>
57
+
58
+ >
59
+ </Image>
60
+
61
+ ### Add Webhook Secret to Environment Variables
62
+
63
+ After creating, you can find the secret of this Webhook in the bottom right corner:
64
+
65
+ <Image
66
+ alt={'View Clerk Webhooks secret'}
67
+ src={'https://github.com/lobehub/lobe-chat/assets/28616219/fab4abb2-584b-49de-9340-813382951635'}>
68
+
69
+ >
70
+ </Image>
71
+
72
+ The environment variable corresponding to this secret is `CLERK_WEBHOOK_SECRET`:
73
+
74
+ ```shell
75
+ CLERK_WEBHOOK_SECRET=whsec_xxxxxxxxxxxxxxxxxxxxxx
76
+ ```
77
+
78
+ </Steps>
79
+
80
+ By following these steps, you have successfully configured the Clerk authentication service.
81
+
@@ -0,0 +1,71 @@
1
+ ---
2
+ title: 配置 Clerk 身份验证服务 - 完整指南
3
+ description: 学习如何配置 Clerk 身份验证服务,获取公私钥和设置 Webhook。
4
+ tags:
5
+ - Clerk
6
+ - 身份验证
7
+ - Webhook
8
+ - 环境变量
9
+ ---
10
+ # 配置 Clerk 身份验证服务
11
+
12
+ 前往 [Clerk](https://clerk.com?utm_source=lobehub&utm_medium=docs) 注册并创建应用,获取相应的 Public Key 和 Secret Key。
13
+
14
+ ## 获取环境变量
15
+
16
+ <Steps>
17
+
18
+ ### 添加公、私钥环境变量
19
+
20
+ 添加 `NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY` 和 `CLERK_SECRET_KEY` 环境变量。你可以在菜单中点击「API Keys」,然后复制对应的值获取该环境变量。
21
+
22
+ <Image
23
+ alt={'在 Clerk 中找到对应的公私钥环境变量'}
24
+ src={'https://github.com/lobehub/lobe-chat/assets/28616219/89883703-7a1a-4a11-b944-5d804544e57c'}
25
+ ></Image>
26
+
27
+ 此步骤所需的环境变量如下:
28
+
29
+ ```shell
30
+ NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_live_xxxxxxxxxxx
31
+ CLERK_SECRET_KEY=sk_live_xxxxxxxxxxxxxxxxxxxxxx
32
+ ```
33
+
34
+ ### 在 Clerk 中创建并配置 Webhook
35
+
36
+ 由于我们让 Clerk 完全接管用户鉴权与管理,因此我们需要在 Clerk 用户生命周期变更时(创建、更新、删除)中通知我们的应用并存储落库。我们通过 Clerk 提供的 Webhook 来实现这一诉求。
37
+
38
+ 我们需要在 Clerk 的 Webhooks 中添加一个端点(Endpoint),告诉 Clerk 当用户发生变更时,向这个端点发送通知。
39
+
40
+ <Image
41
+ alt={'Clerk 添加 Webhooks 端点'}
42
+ src={'https://github.com/lobehub/lobe-chat/assets/28616219/f50f47fb-5e8e-4930-bf4e-8cf6f5b8afb9'}
43
+ ></Image>
44
+
45
+ 在 endppint 中填写你的项目 URL,如 `https://your-project.com/api/webhooks/clerk`。然后在订阅事件(Subscribe to events)中,勾选 user 的三个事件(`user.created` 、`user.deleted`、`user.updated`),然后点击创建。
46
+
47
+ <Callout type={'warning'}>URL的`https://`不可缺失,须保持URL的完整性</Callout>
48
+
49
+ <Image
50
+ alt={'添加 Clerk Webhooks 时,配置 URL 和用户事件'}
51
+ src={'https://github.com/lobehub/lobe-chat/assets/28616219/0249ea56-ab17-4aa9-a56c-9ebd556c2645'}
52
+ ></Image>
53
+
54
+ ### 将 Webhook 秘钥添加到环境变量
55
+
56
+ 创建完毕后,可以在右下角找到该 Webhook 的秘钥:
57
+
58
+ <Image
59
+ alt={'查看 Clerk Webhooks 秘钥'}
60
+ src={'https://github.com/lobehub/lobe-chat/assets/28616219/fab4abb2-584b-49de-9340-813382951635'}
61
+ ></Image>
62
+
63
+ 这个秘钥所对应的环境变量名为 `CLERK_WEBHOOK_SECRET`:
64
+
65
+ ```shell
66
+ CLERK_WEBHOOK_SECRET=whsec_xxxxxxxxxxxxxxxxxxxxxx
67
+ ```
68
+
69
+ </Steps>
70
+
71
+ 这样,你已经成功配置了 Clerk 身份验证服务。
@@ -117,5 +117,6 @@ Auth0 支持 Azure Active Directory / Slack / Google Workspace / Office 365 / Zo
117
117
 
118
118
  <Callout>
119
119
  如果你需要限制登录人员,务必配置 **阻止策略**: 请在打开社交登录选项后,参考
120
- [这篇文章](https://auth0.com/blog/permit-or-deny-login-requests-using-auth0-actions/) 创建 Action 来设置阻止 / 允许列表。
120
+ [这篇文章](https://auth0.com/blog/permit-or-deny-login-requests-using-auth0-actions/) 创建 Action
121
+ 来设置阻止 / 允许列表。
121
122
  </Callout>
@@ -0,0 +1,146 @@
1
+ ---
2
+ title: Configuring Cloudflare R2 Storage Service
3
+ description: Step-by-step guide to configure Cloudflare R2 for S3 storage.
4
+ tags:
5
+ - Cloudflare R2
6
+ - S3 Storage
7
+ - Configuration Guide
8
+ ---
9
+ # Configuring Cloudflare R2 Storage Service
10
+
11
+ We need to configure an S3 storage service in the server-side database to store files.
12
+
13
+ ## Configuration Steps
14
+
15
+ <Steps>
16
+
17
+ ### Configure and Obtain S3 Bucket
18
+
19
+ You need to go to your S3 service provider (such as AWS S3, Cloudflare R2, etc.) and create a new storage bucket. The following is an example using Cloudflare R2 to guide you through the creation process.
20
+
21
+ The interface of Cloudflare R2 is shown below:
22
+
23
+ <Image
24
+ alt={'Cloudflare R2 Storage Interface'}
25
+ src={'https://github.com/lobehub/lobe-chat/assets/28616219/41f7f677-0153-4a96-b849-5ac9b7ebefee'}
26
+ ></Image>
27
+
28
+ When creating the bucket, specify its name and then click create.
29
+ <Image
30
+ alt={'Create Bucket in R2'}
31
+ src={'https://github.com/lobehub/lobe-chat/assets/28616219/9c0d184c-3169-40fa-9115-011cfffb9ca7'}
32
+ ></Image>
33
+
34
+ ### Obtain Environment Variables for the Bucket
35
+
36
+ In the settings of the R2 storage bucket, you can view the bucket configuration information:
37
+
38
+ <Image
39
+ alt={'View relevant information of the bucket'}
40
+ src={'https://github.com/lobehub/lobe-chat/assets/28616219/2ceb210c-eca0-4439-ba27-8734d4ebb3ee'}
41
+ ></Image>
42
+
43
+ The corresponding environment variables are:
44
+
45
+ ```shell
46
+ # Bucket name
47
+ S3_BUCKET=lobechat
48
+ # Request endpoint of the bucket (note that the path in this link includes the bucket name, which must be removed, or use the link provided on the page for applying S3 API token)
49
+ S3_ENDPOINT=https://0b33a03b5c993fd2f453379dc36558e5.r2.cloudflarestorage.com
50
+ # Access domain of the bucket
51
+ NEXT_PUBLIC_S3_DOMAIN=https://s3-for-lobechat.your-domain.com
52
+ ```
53
+
54
+ <Callout type={'warning'}>`S3_ENDPOINT` must have its path removed, otherwise uploaded files cannot be accessed.</Callout>
55
+
56
+ ### Obtain S3 Key Environment Variables
57
+
58
+ You need to obtain the access key for S3 so that the LobeChat server has permission to access the S3 storage service. In R2, you can configure the access key in the account details:
59
+
60
+ <Image
61
+ alt={'View access key of the bucket'}
62
+ src={'https://github.com/lobehub/lobe-chat/assets/28616219/be0c95c0-6693-44ee-a490-7e8dfaa8b34d'}
63
+ ></Image>
64
+
65
+ Click the button in the upper right corner to create an API token and enter the create API Token page.
66
+
67
+ <Image
68
+ alt={'Create corresponding API token'}
69
+ src={'https://github.com/lobehub/lobe-chat/assets/28616219/7b0ea46c-5157-40a8-888f-f47664a4884f'}
70
+ ></Image>
71
+
72
+ Since our server-side database needs to read and write to the S3 storage service, the permission needs to be set to `Object Read and Write`, then click create.
73
+
74
+ <Image
75
+ alt={'Configure API token permissions'}
76
+ src={'https://github.com/lobehub/lobe-chat/assets/28616219/d6f5a918-7b50-4d6e-83a6-3894ab930ddf'}
77
+ ></Image>
78
+
79
+ After creation, you can see the corresponding S3 API token.
80
+
81
+ <Image
82
+ alt={'Copy API token'}
83
+ src={'https://github.com/lobehub/lobe-chat/assets/28616219/763b18f9-2b5f-44bb-a479-9b56d46f7397'}
84
+ ></Image>
85
+
86
+ The corresponding environment variables are:
87
+
88
+ ```shell
89
+ S3_ACCESS_KEY_ID=9998d6757e276cf9f1edbd325b7083a6
90
+ S3_SECRET_ACCESS_KEY=55af75d8eb6b99f189f6a35f855336ea62cd9c4751a5cf4337c53c1d3f497ac2
91
+ ```
92
+
93
+ ### Configure Cross-Origin Resource Sharing (CORS)
94
+
95
+ Since S3 storage services are often on a separate domain, cross-origin access needs to be configured.
96
+
97
+ In R2, you can find the CORS configuration in the settings of the storage bucket:
98
+
99
+ <Image
100
+ alt={'Cross-Origin Settings in Cloudflare R2'}
101
+ src={'https://github.com/lobehub/lobe-chat/assets/28616219/ab008be7-26b2-4b78-8bd9-24301bf34d23'}
102
+ ></Image>
103
+
104
+ Add a CORS rule to allow requests from your domain (in the previous section, it is `https://your-project.vercel.app`):
105
+
106
+ <Image
107
+ alt={'Configure allowed site domain'}
108
+ src={'https://github.com/lobehub/lobe-chat/assets/28616219/dfcc2cb3-2958-4498-a8a4-51bec584fe7d'}
109
+ ></Image>
110
+
111
+ Example configuration is as follows:
112
+
113
+ ```json
114
+ [
115
+ {
116
+ "AllowedOrigins": ["https://your-project.vercel.app"],
117
+ "AllowedMethods": ["GET", "PUT", "HEAD", "POST", "DELETE"],
118
+ "AllowedHeaders": ["*"]
119
+ }
120
+ ]
121
+ ```
122
+
123
+ After configuration, click save.
124
+
125
+ </Steps>
126
+
127
+ ## Overview of Environment Variables
128
+
129
+ <Callout type={'warning'}>The `https://` in the URL is essential and must be included to maintain the integrity of the URL.</Callout>
130
+
131
+ ```shell
132
+ # S3 Keys
133
+ S3_ACCESS_KEY_ID=9998d6757e276cf9f1edbd325b7083a6
134
+ S3_SECRET_ACCESS_KEY=55af75d8eb6b99f189f6a35f855336ea62cd9c4751a5cf4337c53c1d3f497ac2
135
+
136
+ # Bucket Name
137
+ S3_BUCKET=lobechat
138
+ # Bucket Request Endpoint
139
+ S3_ENDPOINT=https://0b33a03b5c993fd2f453379dc36558e5.r2.cloudflarestorage.com
140
+ # Public Access Domain for the Bucket
141
+ NEXT_PUBLIC_S3_DOMAIN=https://s3-dev.your-domain.com
142
+
143
+ # Bucket Region, such as us-west-1. Generally not required, but some service providers may need it.
144
+ # S3_REGION=us-west-1
145
+ ```
146
+
@@ -0,0 +1,146 @@
1
+ ---
2
+ title: 配置 Cloudflare R2 存储服务
3
+ description: 详细步骤配置 Cloudflare R2 存储服务,确保文件存储顺利进行。
4
+ tags:
5
+ - Cloudflare R2
6
+ - S3 存储
7
+ - 文件存储
8
+ - 环境变量
9
+ ---
10
+ # 配置 Cloudflare R2 存储服务
11
+
12
+ 在服务端数据库中我们需要配置 S3 存储服务来存储文件。
13
+
14
+ ## 配置步骤
15
+
16
+ <Steps>
17
+
18
+ ### 配置并获取 S3 存储桶
19
+
20
+ 你需要前往你的 S3 服务提供商(如 AWS S3、Cloudflare R2 等)并创建一个新的存储桶(Bucket)。接下来以 Cloudflare R2 为例,介绍创建流程。
21
+
22
+ 下图是 Cloudflare R2 的界面:
23
+
24
+ <Image
25
+ alt={'Cloudflare R2 存储界面'}
26
+ src={'https://github.com/lobehub/lobe-chat/assets/28616219/41f7f677-0153-4a96-b849-5ac9b7ebefee'}
27
+ ></Image>
28
+
29
+ 创建存储桶时将指定其名称,然后点击创建。
30
+ <Image
31
+ alt={'R2 创建存储桶'}
32
+ src={'https://github.com/lobehub/lobe-chat/assets/28616219/9c0d184c-3169-40fa-9115-011cfffb9ca7'}
33
+ ></Image>
34
+
35
+ ### 获取存储桶相关环境变量
36
+
37
+ 在 R2 存储桶的设置中,可以看到桶配置的信息:
38
+
39
+ <Image
40
+ alt={'查看存储桶的相关信息'}
41
+ src={'https://github.com/lobehub/lobe-chat/assets/28616219/2ceb210c-eca0-4439-ba27-8734d4ebb3ee'}
42
+ ></Image>
43
+
44
+ 其对应的环境变量为:
45
+
46
+ ```shell
47
+ # 存储桶的名称
48
+ S3_BUCKET=lobechat
49
+ # 存储桶的请求端点(注意此处链接的路径带存储桶名称,必须删除该路径,或使用申请 S3 API token 页面所提供的链接)
50
+ S3_ENDPOINT=https://0b33a03b5c993fd2f453379dc36558e5.r2.cloudflarestorage.com
51
+ # 存储桶对外的访问域名
52
+ NEXT_PUBLIC_S3_DOMAIN=https://s3-for-lobechat.your-domain.com
53
+ ```
54
+
55
+ <Callout type={'warning'}>`S3_ENDPOINT`必须删除其路径,否则会无法访问所上传文件</Callout>
56
+
57
+ ### 获取 S3 密钥环境变量
58
+
59
+ 你需要获取 S3 的访问密钥,以便 LobeChat 的服务端有权限访问 S3 存储服务。在 R2 中,你可以在账户详情中配置访问密钥:
60
+
61
+ <Image
62
+ alt={'查看存储桶的访问秘钥'}
63
+ src={'https://github.com/lobehub/lobe-chat/assets/28616219/be0c95c0-6693-44ee-a490-7e8dfaa8b34d'}
64
+ ></Image>
65
+
66
+ 点击右上角按钮创建 API token,进入创建 API Token 页面
67
+
68
+ <Image
69
+ alt={'创建对应 API token'}
70
+ src={'https://github.com/lobehub/lobe-chat/assets/28616219/7b0ea46c-5157-40a8-888f-f47664a4884f'}
71
+ ></Image>
72
+
73
+ 鉴于我们的服务端数据库需要读写 S3 存储服务,因此权限需要选择`对象读与写`,然后点击创建。
74
+
75
+ <Image
76
+ alt={'配置 API token 权限'}
77
+ src={'https://github.com/lobehub/lobe-chat/assets/28616219/d6f5a918-7b50-4d6e-83a6-3894ab930ddf'}
78
+ ></Image>
79
+
80
+ 创建完成后,就可以看到对应的 S3 API token
81
+
82
+ <Image
83
+ alt={'复制 API token'}
84
+ src={'https://github.com/lobehub/lobe-chat/assets/28616219/763b18f9-2b5f-44bb-a479-9b56d46f7397'}
85
+ ></Image>
86
+
87
+ 其对应的环境变量为:
88
+
89
+ ```shell
90
+ S3_ACCESS_KEY_ID=9998d6757e276cf9f1edbd325b7083a6
91
+ S3_SECRET_ACCESS_KEY=55af75d8eb6b99f189f6a35f855336ea62cd9c4751a5cf4337c53c1d3f497ac2
92
+ ```
93
+
94
+ ### 配置跨域
95
+
96
+ 由于 S3 存储服务往往是一个独立的网址,因此需要配置跨域访问。
97
+
98
+ 在 R2 中,你可以在存储桶的设置中找到跨域配置:
99
+
100
+ <Image
101
+ alt={'Cloudflare R2 的跨域设置'}
102
+ src={'https://github.com/lobehub/lobe-chat/assets/28616219/ab008be7-26b2-4b78-8bd9-24301bf34d23'}
103
+ ></Image>
104
+
105
+ 添加跨域规则,允许你的域名(在上文是 `https://your-project.vercel.app`)来源的请求:
106
+
107
+ <Image
108
+ alt={'配置允许你的站点域名'}
109
+ src={'https://github.com/lobehub/lobe-chat/assets/28616219/dfcc2cb3-2958-4498-a8a4-51bec584fe7d'}
110
+ ></Image>
111
+
112
+ 示例配置如下:
113
+
114
+ ```json
115
+ [
116
+ {
117
+ "AllowedOrigins": ["https://your-project.vercel.app"],
118
+ "AllowedMethods": ["GET", "PUT", "HEAD", "POST", "DELETE"],
119
+ "AllowedHeaders": ["*"]
120
+ }
121
+ ]
122
+ ```
123
+
124
+ 配置后点击保存即可。
125
+
126
+ </Steps>
127
+
128
+ ## 环境变量一览
129
+
130
+ <Callout type={'warning'}>URL的`https://`不可缺失,须保持URL的完整性</Callout>
131
+
132
+ ```shell
133
+ # S3 秘钥
134
+ S3_ACCESS_KEY_ID=9998d6757e276cf9f1edbd325b7083a6
135
+ S3_SECRET_ACCESS_KEY=55af75d8eb6b99f189f6a35f855336ea62cd9c4751a5cf4337c53c1d3f497ac2
136
+
137
+ # 存储桶的名称
138
+ S3_BUCKET=lobechat
139
+ # 存储桶的请求端点
140
+ S3_ENDPOINT=https://0b33a03b5c993fd2f453379dc36558e5.r2.cloudflarestorage.com
141
+ # 存储桶对外的访问域名
142
+ NEXT_PUBLIC_S3_DOMAIN=https://s3-dev.your-domain.com
143
+
144
+ # 桶的区域,如 us-west-1,一般来说不需要添加,但某些服务商则需要配置
145
+ # S3_REGION=us-west-1
146
+ ```
@@ -0,0 +1,28 @@
1
+ ---
2
+ title: Configuring S3 Storage Service for AI - LobeChat
3
+ description: Learn how to configure S3 storage for LobeChat's multimodal AI conversations.
4
+ tags:
5
+ - S3 Storage
6
+ - LobeChat
7
+ - AI Conversations
8
+ - Cloud Storage
9
+ - Image Upload
10
+ ---
11
+ # Configuring S3 Storage Service
12
+
13
+ LobeChat has supported multimodal AI conversations since [a long time ago](https://x.com/lobehub/status/1724289575672291782), which involves the function of uploading images to AI. In the client-side database solution, image files are stored as binary data directly in the browser's IndexedDB database. However, this solution is not feasible in the server-side database. Storing file-like data directly in Postgres would greatly waste database storage space and slow down computational performance.
14
+
15
+ The best practice in this area is to use a file storage service (S3) to store image files. S3 is also the storage solution on which the file upload/knowledge base function depends.
16
+
17
+ <Callout type={'info'}>
18
+ In this documentation, S3 refers to a compatible S3 storage solution, which supports the Amazon S3 API for object storage systems. Common examples include Cloudflare R2, Alibaba Cloud OSS, and self-deployable Minio, all of which support the S3 compatible API.
19
+ </Callout>
20
+
21
+ Currently, the S3 configuration tutorials included in the documentation are:
22
+
23
+ <Cards>
24
+ <Card href={'/en/docs/self-hosting/advanced/s3/cloudflare-r2'} title={'Cloudflare R2'} />
25
+ </Cards>
26
+
27
+ Click to view the tutorial for the corresponding platform. If the above tutorials do not include the S3 service provider you are using, feel free to submit a Pull Request to collectively improve the guide on S3 object storage.
28
+
@@ -0,0 +1,27 @@
1
+ ---
2
+ title: 配置 S3 存储服务 - 多模态 AI 会话
3
+ description: 了解如何配置 S3 存储服务以支持多模态 AI 会话和图片上传。
4
+ tags:
5
+ - S3 存储
6
+ - 多模态 AI
7
+ - 图片上传
8
+ - 文件存储
9
+ ---
10
+ # 配置 S3 存储服务
11
+
12
+ LobeChat 在 [很早以前](https://x.com/lobehub/status/1724289575672291782) 就支持了多模态的 AI 会话,其中涉及到图片上传给 AI 的功能。在客户端数据库方案中,图片文件直接以二进制数据存储在浏览器 IndexedDB 数据库,但在服务端数据库中这个方案并不可行,在 Postgres 中直接存储文件类数据会大大浪费数据库存储空间,并拖慢计算性能。
13
+
14
+ 这块最佳实践是使用文件存储服务(S3)来存储图片文件,同时 S3 也是文件上传/知识库功能所依赖的存储方案。
15
+
16
+ <Callout type={'info'}>
17
+ 在本文档库中,S3 所指代的是指兼容 S3 存储方案,即支持 Amazon S3 API 的对象存储系统,常见例如
18
+ Cloudflare R2 、阿里云 OSS,可以自部署的 minio 等均支持 S3 兼容 API。
19
+ </Callout>
20
+
21
+ 目前文档中包含的 S3 配置教程有:
22
+
23
+ <Cards>
24
+ <Card href={'/zh/docs/self-hosting/advanced/s3/cloudflare-r2'} title={'Cloudflare R2'} />
25
+ </Cards>
26
+
27
+ 点击即可查看对应平台的教程,如果上述教程中不包含你所使用的 S3 服务商,欢迎提交 Pull Request ,将共同完善 S3 对象存储的指南。
@@ -1,3 +1,15 @@
1
+ ---
2
+ title: LobeChat WebRTC Sync - Real-Time Data Sharing
3
+ description: >-
4
+ Explore LobeChat's WebRTC sync for real-time data sharing and privacy without
5
+ servers.
6
+ tags:
7
+ - WebRTC
8
+ - LobeChat
9
+ - Data Synchronization
10
+ - Real-Time Communication
11
+ - Peer-to-Peer
12
+ ---
1
13
  # LobeChat WebRTC Sync
2
14
 
3
15
  ## Introduction to WebRTC
@@ -88,7 +88,9 @@ For specific content, please refer to the [Feature Flags](/docs/self-hosting/adv
88
88
  - Example: `http://127.0.0.1:7890` or `socks5://localhost:7891`
89
89
 
90
90
  <Callout type="info">
91
- If you're using Docker Desktop on Windows or macOS, it relies on a virtual machine. In this setup, `localhost` / `127.0.0.1` refers to the localhost of the container itself. In such cases, please try using `host.docker.internal` instead of `localhost`.
91
+ If you're using Docker Desktop on Windows or macOS, it relies on a virtual machine. In this setup,
92
+ `localhost` / `127.0.0.1` refers to the localhost of the container itself. In such cases, please
93
+ try using `host.docker.internal` instead of `localhost`.
92
94
  </Callout>
93
95
 
94
96
  ## Plugin Service
@@ -83,9 +83,9 @@ LobeChat 在部署时提供了一些额外的配置项,你可以使用环境
83
83
  - 默认值:-
84
84
  - 示例:`http://127.0.0.1:7890` 或 `socks5://localhost:7891`
85
85
 
86
-
87
86
  <Callout type="info">
88
- `Docker Desktop` 在 `Windows `和 `macOS `上走的是虚拟机方案,如果是 `localhost` / `127.0.0.1` 是走到自身容器的 `localhost`,此时请尝试用 `host.docker.internal` 替代 `localhost`
87
+ `Docker Desktop` 在 `Windows `和 `macOS `上走的是虚拟机方案,如果是 `localhost` / `127.0.0.1`
88
+ 是走到自身容器的 `localhost`,此时请尝试用 `host.docker.internal` 替代 `localhost`
89
89
  </Callout>
90
90
 
91
91
  ## 插件服务
@@ -0,0 +1,29 @@
1
+ ---
2
+ title: Deploying Server Database with Docker Compose
3
+ description: >-
4
+ Learn how to deploy a server database using Docker Compose for efficient
5
+ management.
6
+ tags:
7
+ - Docker
8
+ - Database Deployment
9
+ - Docker Compose
10
+ ---
11
+ # Deploying Server Database with Docker Compose
12
+
13
+ <div style={{display:"flex", gap: 4}}>
14
+ [![][docker-release-shield]][docker-release-link]
15
+
16
+ [![][docker-size-shield]][docker-size-link]
17
+
18
+ [![][docker-pulls-shield]][docker-pulls-link]
19
+
20
+ </div>
21
+
22
+ TODO: Document content to be added.
23
+
24
+ [docker-pulls-link]: https://hub.docker.com/r/lobehub/lobe-chat-database
25
+ [docker-pulls-shield]: https://img.shields.io/docker/pulls/lobehub/lobe-chat-database?color=45cc11&labelColor=black&style=flat-square
26
+ [docker-release-link]: https://hub.docker.com/r/lobehub/lobe-chat-database
27
+ [docker-release-shield]: https://img.shields.io/docker/v/lobehub/lobe-chat-database?color=369eff&label=docker&labelColor=black&logo=docker&logoColor=white&style=flat-square
28
+ [docker-size-link]: https://hub.docker.com/r/lobehub/lobe-chat-database
29
+ [docker-size-shield]: https://img.shields.io/docker/image-size/lobehub/lobe-chat-database?color=369eff&labelColor=black&style=flat-square
@@ -0,0 +1,30 @@
1
+ ---
2
+ title: 通过 Docker Compose 部署 LobeChat
3
+ description: 学习如何使用 Docker Compose 部署 LobeChat 服务,包括安装 Docker 容器环境和自动更新脚本设置。
4
+ tags:
5
+ - Docker Compose
6
+ - LobeChat
7
+ - Docker 容器
8
+ - 自动更新脚本
9
+ - 部署指引
10
+ ---
11
+
12
+ # 使用 Docker Compose 部署服务端数据库
13
+
14
+ <div style={{display:"flex", gap: 4}}>
15
+ [![][docker-release-shield]][docker-release-link]
16
+
17
+ [![][docker-size-shield]][docker-size-link]
18
+
19
+ [![][docker-pulls-shield]][docker-pulls-link]
20
+
21
+ </div>
22
+
23
+ TODO: 文档内容待补充
24
+
25
+ [docker-pulls-link]: https://hub.docker.com/r/lobehub/lobe-chat-database
26
+ [docker-pulls-shield]: https://img.shields.io/docker/pulls/lobehub/lobe-chat-database?color=45cc11&labelColor=black&style=flat-square
27
+ [docker-release-link]: https://hub.docker.com/r/lobehub/lobe-chat-database
28
+ [docker-release-shield]: https://img.shields.io/docker/v/lobehub/lobe-chat-database?color=369eff&label=docker&labelColor=black&logo=docker&logoColor=white&style=flat-square
29
+ [docker-size-link]: https://hub.docker.com/r/lobehub/lobe-chat-database
30
+ [docker-size-shield]: https://img.shields.io/docker/image-size/lobehub/lobe-chat-database?color=369eff&labelColor=black&style=flat-square