Ubuntu安装云崽+ChatGPT

发布时间 2023-05-17 13:04:51作者: 憨憨BEEA

Ubuntu安装云崽+ChatGPT

VVZrnA.md.jpeg

憨憨博客:https://blog.hanhanz.top

Centos教程:https://blog.hanhanz.top/archives/309.html

视频教程请进群获取:559567232

使用sudo su进到root账户

安装nodejs

#把nvm远程镜像克隆到指定目录
git clone https://gitee.com/mirrors/nvm
#进入nvm目录内执行安装命令
sudo bash install.sh
通过`nvm --version`可以看到安装成功。
# 如果您在国内!请先为nvm配置国内阿里源,网络通畅可以不用运行此行。
export NVM_NODEJS_ORG_MIRROR=https://npmmirror.com/mirrors/node

# 安装最新LTS版本的node.js
nvm install --lts
#查看版本
node -v
npm -v

安装redis

sudo apt install redis-server

安装git

sudo apt install curl git -y

安装中文字体

# 安装文泉驿正黑体
sudo apt install ttf-wqy-zenhei
# 重建字体缓存
sudo fc-cache -fv

憨憨博客:https://blog.hanhanz.top

Centos教程:https://blog.hanhanz.top/archives/309.html

安装云崽项目

cd #转到根目录
git clone --depth=1 -b main https://gitee.com/yoimiya-kokomi/Yunzai-Bot.git #使用gitee上面的源克隆项目

安装依赖

cd Yunzai-Bot #进到云崽文件夹
npm config set registry https://registry.npmmirror.com
npm install pnpm -g
pnpm -v #查看版本号
pnpm config set registry https://registry.npmmirror.com
pnpm install -P

安装锅巴插件(极力推荐)

克隆插件

git clone --depth=1 https://gitee.com/guoba-yunzai/guoba-plugin.git ./plugins/Guoba-Plugin/

安装依赖

在云崽根目录下执行

方式一:pnpm install --filter=guoba-plugin
方式二:npm install express multer body-parser jsonwebtoken

开放端口

锅巴默认50831端口,可在 config/application.yaml 中修改
在你的服务器控制台找到防火墙(或者叫安全组,找不到的建议百度),接着点击添加规则,填上端口号,点击确定就行了。

有很多人会使用面板进行管理服务器,例如宝塔等,就还需要在面板上再开放一下50831端口,操作和上面差不多
有的人没有使用面板还打不开锅巴,那就需要用命令行在本地开启端口,如下:

打开防火墙:sudo ufw enable
开放端口:sudo ufw allow 50831
重启防火墙:sudo ufw reload

安装chatgpt插件

安装插件的大部分操作都是在云崽根目录(/root/Yunzai-Bot)

插件地址:https://github.com/ikechan8370/chatgpt-plugin或https://gitee.com/ikechan/chatgpt-plugin

有什么问题可以去这里看看有没有解决方法:https://github.com/ikechan8370/chatgpt-plugin/issues

或者看问题合集:https://www.wolai.com/4FCxxWAdjbrHF29MCJmAQK

版本要求

Node.js >= 18 / Node.js >= 14(with node-fetch) 小白尽可能使用18版本以上的nodejs

安装项目

cd Yunzai-Bot/ #进到云崽根目录
git clone --depth=1 https://github.com/ikechan8370/chatgpt-plugin.git ./plugins/chatgpt-plugin/
或:git clone --depth=1 https://gitee.com/ikechan/chatgpt-plugin.git ./plugins/chatgpt-plugin/

安装依赖

cd plugins/chatgpt-plugin
pnpm i

修改配置

修改配置极力推荐使用锅巴配置,自己修改配置容易出错

锅巴配置(极力推荐)

进行到这一步相信你已经安装好插件了,那么请运行它

cd && cd Yunzai-Bot/
node app

运行起来以后,使用主人账号给机器人发送#锅巴登录,机器人会给你发登录网址,复制外网登录网址,用浏览器打开,一打开就能看到ChatGPT-Plugin,点它,然后选择配置,主要修改其中的apiKey

配置好之后就可以对话了。