feat: add support for the third party reverse proxy mode

This commit is contained in:
ikechan8370 2023-02-12 15:05:03 +08:00
parent 36aaa12586
commit a8ec5f41e3
6 changed files with 201 additions and 72 deletions

34
LowerNode.md Normal file
View file

@ -0,0 +1,34 @@
### Node.js >= 14 (并且 <18)时的安装方法
**如果不是 CentOS 7, RHEL 7, Ubuntu 18 请自行搜索并升级你的 Node.js 版本!**
**此教程是为了因 glibc 不支持升级 Node.js 的Linux发行版准备的。**
1. 进入 Yunzai 根目录
2. 安装依赖
```
pnpm install -w undici chatgpt showdown mathjax-node delay uuid remark strip-markdown node-fetch @waylaidwanderer/chatgpt-api keyv-file
```
**若使用API模式chatgpt的版本号注意要大于4.2.0**
若不使用浏览器模式,可以不安装`random puppeteer-extra-plugin-recaptcha puppeteer-extra puppeteer-extra-plugin-stealth`这几个
3. 克隆项目
```
git clone https://github.com/ikechan8370/chatgpt-plugin.git ./plugins/chatgpt-plugin
```
4. 修改配置
修改 Yunzai根目录/node_modules/.pnpm/chatgpt\@4.1.0/node_modules/chatgpt/build/index.js
**此处 chatgpt\@4.1.0 路径不是绝对的!请根据自己安装的版本进行替换!**
**将 // src/fetch.ts 部分修改成如下样子,其他部分不要动**
```
// src/fetch.ts
import fetch from 'node-fetch';
globalThis.fetch = fetch;
```
再编辑`Yunzai根目录/plugins/chatgpt-plugin/config/index.js`文件,根据其中的注释修改必要配置项。
---