- 注册一个openai帐号,获取token(token获取页: https://beta.openai.com/account/api-keys)
- 将你的token替换到
composables/openai.ts的第6行const configuration = new Configuration({ organization: "org-mvGmOG9Wjd3szwU5aeeUt9NO", apiKey: "your token", });
# install dependencies
$ yarn install
# serve with hot reload at localhost:3000
$ yarn dev
# build for production and launch server
$ yarn build
$ yarn start
# generate static project
$ yarn generate以centOS7.x为例(注意:你的服务器所在地区必须能够访问openai!)
- 服务器安装git和nginx
yum install git nginx -y && nginx - 服务器安装node
curl -sL https://rpm.nodesource.com/setup_16.x | bash -(至少14版本但最好17以下)yum install -y nodejs
- 服务器安装yarn
npm install --global yarn - 服务器安装pm2
npm install pm2 -g - 在你喜欢的目录下克隆本项目
git clone https://github.com/wzc520pyfm/clover-chat-GPT.git - 进入项目目录
cd clover-chat-GPT, 更换你的OpenAI_Key(参照QuickStart) - 安装依赖
yarn - 项目打包
yarn build - 启动项目
pm2 start - 项目启动在3000端口, 确保3000端口未被占用, 且服务器安全组放通3000端口
- 通过服务器ip:3000即可访问, 若无法访问则使用nginx转发3000端口
- 最后可使用nginx配置域名转发
-
server { listen 5577; server_name openai; location / { proxy_pass http://localhost:3000; } }
- 服务器放通5577端口
- 使用ip:5577访问项目
-

