如何利用ChatGPT搭建QQ机器人

admin 2023年3月12日21:59:38评论104 views字数 1886阅读6分17秒阅读模式
如何利用ChatGPT搭建QQ机器人

点击上方蓝字关注我们



想免费使用ChatGPT?扫描二维码

关注“御恒安全团队”公众号

回复"ChatGPT"获取免费使用链接

如何利用ChatGPT搭建QQ机器人


0x00

搭建前提

1. OpenAI账号

2. 百度智能云账号(可选)

3. 云服务器

如何利用ChatGPT搭建QQ机器人

0x01

安装MCL

项目地址:https://github.com/iTXTech/mirai-console-loader
推荐使用MCL安装器安装,下载地址:
https://github.com/iTXTech/mcl-installer/releases
选择对应版本的安装程序下载安装即可,具体请看README。
登录Bot账号:
# 启动MCL./mcl# 进入Mirai Console后/login [qq] 
		
输入密码查看隐藏内容

ANDROID_PAD
# 按照提示登录即可

配置自动登录:

https://github.com/mamoe/mirai/blob/dev/mirai-console/docs/BuiltInCommands.md#autologincommand


0x02

安装mirai-api-http

项目地址:https://github.com/project-mirai/mirai-api-http
安装命令:
./mcl --update-package net.mamoe:mirai-api-http --channel stable-v2 --type plugin./mcl -u

配置文件位置:config/net.mamoe.mirai-api-http/setting.yml

配置文件Demo:
adapters:  - http  - ws
## 是否开启认证流程, 若为 true 则建立连接时需要验证 verifyKey## 建议公网连接时开启enableVerify: falseverifyKey: 123456789
## 开启一些调试信息debug: false
## 是否开启单 session 模式, 若为 true,则自动创建 session 绑定 console 中登录的 bot## 开启后,接口中任何 sessionKey 不需要传递参数## 若 console 中有多个 bot 登录,则行为未定义## 确保 console 中只有一个 bot 登录时启用singleMode: false
## 历史消息的缓存大小## 同时,也是 http adapter 的消息队列容量cacheSize: 4096
## adapter 的单独配置,键名与 adapters 项配置相同adapterSettings: ## 详情看 http adapter 使用说明 配置 http: host: localhost port: 8080 cors: ["*"]    unreadQueueMaxSize: 100 ws: host: localhost port: 8080    reservedSyncId: -1

0x03

获取OpenAI api_key

https://platform.openai.com/account/api-keys

0x04

配置机器人

# 拉取项目git clone https://github.com/h3110w0r1d-y/ChatGPT-For-QQcd ChatGPT-For-QQ# 安装依赖pip install -r requirements.txt# 复制配置文件cp config.example.yml config.yml

配置文件示例:

# 管理员QQ号admin_qq: 12345
openai: api_key: sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
# 百度智能云 内容审核-文本baiduai:  # 是否开启内容审核 enable: true api_key: xxxxxxx secret_key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
# 自定义敏感词列表sensitive_list: - 自定义 - 敏感词 - 列表
# 对应mirai-api-http配置mirai:  # 机器人QQ号 qq: xxxxxxx api_key: xxxxxxxx http_url: http://localhost:8080 ws_url: http://localhost:8080
# 在每条消息最后显示消耗的Token数量show_cost_tokens: true
# 开启机器人的群号, 为空时不限制group_list:


启动机器人:

export HTTPS_PROXY=http://xxxxxxx:xxxpython main.py


如何利用ChatGPT搭建QQ机器人

点个在看你最好看

原文始发于微信公众号(青科信安):如何利用ChatGPT搭建QQ机器人

  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2023年3月12日21:59:38
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   如何利用ChatGPT搭建QQ机器人https://cn-sec.com/archives/1596125.html

发表评论

匿名网友 填写信息