From 4e8bb35fe56178b1f199edd23e2740c2d42fc21b Mon Sep 17 00:00:00 2001 From: Hk-Gosuto Date: Mon, 18 Sep 2023 12:27:24 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20=E6=96=B0=E5=A2=9E=20R2=20=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 ++ docs/cloudflare-r2-cn.md | 46 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 docs/cloudflare-r2-cn.md diff --git a/README.md b/README.md index 76cd8dd09..b0673c414 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,8 @@ - 其它 - [Wiki](https://js.langchain.com/docs/api/tools/classes/WikipediaQueryRun) + - DALL-E + - DALL-E 插件需要配置 R2 存储,请参考 [Cloudflare R2 服务配置指南](./docs/cloudflare-r2-cn.md) 配置 diff --git a/docs/cloudflare-r2-cn.md b/docs/cloudflare-r2-cn.md new file mode 100644 index 000000000..952abb137 --- /dev/null +++ b/docs/cloudflare-r2-cn.md @@ -0,0 +1,46 @@ +# Cloudflare R2 服务配置指南 + +## 如何配置 R2 服务 +登录到 dash.cloudflare.com 并在左侧菜单进入 R2。 + +1. 复制右侧 "账户ID" + +2. 点击 "创建存储桶"。 + +3. 自定义配置一个存储桶名称,记录下来用于后面配置环境变量,点击 "创建存储桶"。 + +4. 进入 "设置",点击 "添加 CORS 策略",将下面内容粘贴上去并点击 "保存"。 + + ```json + [ + { + "AllowedOrigins": [ + "*" + ], + "AllowedMethods": [ + "PUT", + "DELETE", + "GET" + ], + "AllowedHeaders": [ + "content-type" + ], + "MaxAgeSeconds": 3000 + } + ] + ``` + +5. 回到 R2 主菜单,点击右侧 "管理 R2 API 令牌"。 + +6. 点击 "创建 API 令牌",权限选择为 "管理员读和写",TTL 选择为 "永久",点击 "创建 API 令牌"。 + +7. 复制 "访问密钥 ID" 和 "机密访问密钥",点击 "完成"。 + +8. 回到 ChatGPT-Next-Web-LangChain 项目修改环境变量。按照以下信息填写: + + - `R2_ACCOUNT_ID=账户ID` + - `R2_ACCESS_KEY_ID=访问密钥 ID` + - `R2_SECRET_ACCESS_KEY=机密访问密钥` + - `R2_BUCKET=存储桶名称` + +9. Enjoy. \ No newline at end of file