
A robot that supports chatting in various mainstream language models!
» View the tutorial »
![]() | ![]() | ![]() |
⚡ Support
? Multi-platform compatibility
We support multiple chat platforms.
| platform | Group chat reply | Private chat reply | Conditional trigger | Administrator commands | Drawing | Voice reply |
|---|---|---|---|---|---|---|
| Mirai | support | support | support | support | support | support |
| OneBot | support | support | support | support | support | support |
| Telegram | support | support | Partial support | Partial support | support | support |
| Discord | support | support | Partial support | Not supported | support | support |
| Enterprise WeChat | support | support | support | Not supported | support | support |
| Personal WeChat | support | support | support | Not supported | support | support |
You can learn about the internal commands of the robot in the Wiki.
If you are a mobile phone party, you can read this mobile phone deployment tutorial (using a Linux server): https://www.bilibili.com/video/av949514538
bash -c " $( wget -O- https://gist.githubusercontent.com/B17w153/f77c2726c4eca4e05b488f9af58823a5/raw/4410356eba091d3259c48506fb68112e68db729b/install_bot_aidlux.sh ) "Deployment Tutorial
bash -c " $( wget -O- https://gist.githubusercontent.com/lss233/2fdd75be3f0724739368d0dcd9d1367d/raw/62a790da4a391af096074b3355c2c2b7ecab3c28/chatgpt-mirai-installer-gocqhttp.sh ) "You can view the construction tutorial on the Wiki.
Find a suitable location and write your config.cfg .
Execute the following command to start the bot:
# 修改 /path/to/config.cfg 为你 config.cfg 的位置
# XPRA_PASSWORD=123456 中的 123456 是你的 Xpra 密码,建议修改
docker run --name mirai-chatgpt-bot
-v /path/to/config.cfg:/app/config.cfg
--network host
lss233/chatgpt-mirai-qq-bot:browser-versionWe have created a quick boot package for Windows users, which can be found in Release.
The file name is: quickstart-windows-go-cqhttp-amd64.zip (recommended) or quickstart-windows-mirai-amd64.zip
Mac users can also use the Windows Quick Deployment Package. @magisk317 has been tested and the functions are basically normal. However, it should be noted that if you need to use the image mode, since wkhtmltoimage.exe cannot run on Mac, you can use wkhtmltopdf instead and install the command:
brew install --cask wkhtmltopdf
Please refer to the link for details on the installation and usage of brew.
Tip: You need Python >= 3.11 to run this project
Deploy Mirai and install the mirai-http-api plugin.
Download this project:
git clone https://github.com/lss233/chatgpt-mirai-qq-bot
cd chatgpt-mirai-qq-bot
pip3 install -r requirements.txtAdjust the configuration file according to the project documentation.
Start bot.
python3 bot.py [Advertising] Free OpenAI API Key
You can get free OpenAI API Key tests here.
[ http ]
# 填写提供服务的端口
host = " 0.0.0.0 "
port = 8080
debug = falseAfter startup, the following interface will be provided:
POST /v1/chat
Request parameters
| Parameter name | Must-choose | type | illustrate |
|---|---|---|---|
| session_id | yes | String | Session ID, default: friend-default_session |
| username | yes | String | Username, default:某人 |
| message | yes | String | Message cannot be empty |
Request Example
{
"session_id" : " friend-123456 " ,
"username" : " testuser " ,
"message" : " ping "
}Response format
| Parameter name | type | illustrate |
|---|---|---|
| result | String | SUCESS, DONE, FAILED |
| message | String[] | Text return, support multi-part return |
| voice | String[] | Audio returns, supports base64 encoding of multiple audios; reference: data: audio/mpeg; base64,,iVBORw0KGgoAAAANS... |
| image | String[] | Image return, supports base64 encoding of multiple images; reference: data:image/png; base64, UhEUgAAAgAAAIACAIA... |
Response Example
{
"result" : " DONE " ,
"message" : [ " pong! " ],
"voice" : [],
"image" : []
} POST /v2/chat
Request parameters
| Parameter name | Must-choose | type | illustrate |
|---|---|---|---|
| session_id | yes | String | Session ID, default: friend-default_session |
| username | yes | String | Username, default:某人 |
| message | yes | String | Message cannot be empty |
Request Example
{
"session_id" : " friend-123456 " ,
"username" : " testuser " ,
"message" : " ping "
}session_id should be in the canonical format. Its format is friend- or group- plus stringExample
friend-R6sxRvblulTZqNC
group-M3jpvxv26mKVM
If it cannot be correct, it will be handled according to the group
Response format String: request_id
Response Example
1681525479905
" and ' ) '1681525479905'
GET /v2/chat/response
Request parameters
| Parameter name | Must-choose | type | illustrate |
|---|---|---|---|
| request_id | yes | String | Request id, value returned by /v2/chat |
Request Example
/v2/chat/response?request_id=1681525479905
" and ' ). The following is an example of error /v2/chat/response?request_id='1681525479905'
/v2/chat/response?request_id="1681525479905"
/v2/chat/response?request_id='1681525479905"
/v2/chat/response?request_id="1681525479905'
Response format
| Parameter name | type | illustrate |
|---|---|---|
| result | String | SUCESS, DONE, FAILED |
| message | String[] | Text return, support multi-part return |
| voice | String[] | Audio returns, supports base64 encoding of multiple audios; reference: data: audio/mpeg; base64,,iVBORw0KGgoAAAANS... |
| image | String[] | Image return, supports base64 encoding of multiple images; reference: data:image/png; base64, UhEUgAAAgAAAIACAIA... |
Response Example
{
"result" : " DONE " ,
"message" : [ " pong! " ],
"voice" : [ " data:audio/mpeg;base64,iVBORw0KGgoAAAANS... " ],
"image" : [ " data:image/png;base64,UhEUgAAAgAAAAIACAIA... " , " data:image/png;base64,UhEUgAAAgAAAAIACAIA... " ]
}SUCCESS , it means waiting { "result" : " SUCCESS " , "message" : [], "voice" : [], "image" : []}DONE , please keep requesting until FAILED appears. FAILED indicates that the reply is completed. { "result" : " FAILED " , "message" : [ " u6ca1u6709u66f4u591au4e86uff01 " ], "voice" : [], "image" : []}SUCCESS may be interspersed between DONE and FAILED . The entire reply cycle may be greater than one minute. If you want the robot to bring a certain chat style automatically, you can use the preset function.
We have two presets:猫娘and正常. You can learn how to write presets in the presets folder.
Use加载预设猫娘to load the cat girl preset.
Here are some preset short videos, you can see the effect:
Detailed tutorial on preset systems: Wiki
You can get presets shared by everyone at Awesome ChatGPT QQ Presets.
You can also refer to Awesome-ChatGPT-prompts-ZH_CN to train your ChatGPT, and you can also refer to Awesome ChatGPT Prompts to unlock more skills.
When sending code or sending a message to a QQ group fails, the message is automatically converted to a picture and sent.
Font files are stored in fonts/ directory.
The default font is bolder.
Since v2.2.5, we support access to Microsoft's Azure engine and VITS engine to let your robot send voice.
Tip : To use voice functions on Windows platforms, you need to install the latest VC runtime library, which you can download here. `
If you have the idea of making robots yourself, you can take a look at the following projects:
This project is developed based on the above projects, so you can also click a star for them!
Besides us, there are some great projects:
Welcome to come up with new ideas and Pull Request.
Made with contrib.rocks.
If our project is helpful to you, please give us a ️