a bot application running on Tencent QQ that integrates GPT chatbot capabilities with AI painting.
A robot application running on Tencent QQ that integrates gpt chat capabilities with ai painting.
Due to limited personal energy, currently this project is mainly aimed at Chinese users. If I have time in the future, I may add more internationalization support. For English users, it should not be difficult to understand with the help of variable names in the code. You can also translate this readme file into English to help you understand this project. The core idea is to use prompts to guide the insertion of identifying text for the program to recognize and execute instructions. Similar approaches can also be used for services such as voice services, group management, and user image analysis(has been implemented by visual-chatgpt). If this project can inspire or help you, I would be honored.
There is a derivative project modified based on this project and adding vits voice and image analysis capabilities: https://github.com/AGuanDao/mix-chatgpt-and-ai-painting-and-vits
Start the API from any project in selfhostedAI (I only tested RWKV-Runner, recommended)
Then in config.py, set use_selfhostedllm to True. At this time, use #gpt to switch to the original GPT3 mode, and the local model will be called.
show all ...
expansion at the bottom. Windows generally uses windows_amd64.exe. Since go-cqhttp announced that it will stop maintenance, you can now use https://github.com/LLOneBot/LLOneBot as an alternative, enable it in the settings Just connect to the forward Websocket, and the rest of the content remains as usual.models/Stable-diffusion
directory of stable-diffusion-webuipython webui.py --medvram --deepdanbooru --xformers --api --enable-insecure-extension-access
, note that the --api
parameter must be included, if you are using someone else's integration package, You may need to manually add the --api
parameter to the startup script. Please refer to常见问题
column above.git clone https://github.com/josStorer/mix-chatgpt-and-ai-painting
, and install dependencies pip install -r requirements.txt
api_key
/ email,password
, master_id
, bot_id
. It is recommended that the variables modified taking into account the actual situation are: use_chatgpt
, working_groups
, auth_vip_for_all
, local_mode
, others please Make your own decisionpython main.py
win+tab
to create a new desktop to do other things, so that your computer can be used by the group when it is idle. Let’s play with friendsAttributeError: 'Error' object has no attribute 'message'
"proxy": "你的代理地址"
after the email password in main.py#L119. If you do not have a proxy, please set use_chatgpt
to False
. and fill in api_key
错误: 'images'
, or错误: 404: {"detail":"Not Found"}
--api
parameter additionally when starting. If you are using someone else's integration package, please find the relevant startup file (usually with a .bat suffix) and find the line with parameters in it. , such as --deepdanbooru
, --xformers
, add --api
at the end, pay attention to the space between parameters, if there is a launcher, please find and check options such as启用API
/暴露API
错误: [WinError 3] The system cannot find the path specified
HOME
environment variable to a certain folder path to store configuration information.git pull
to pull updates to this project, and be sure to use pip install -r requirements.txt --upgrade
to upgrade dependent libraries.device.json
in the same directory, open and find protocol
, change the value to 2
, and restart the program to log inmain.py
, find run_forever
and delete reconnect=3
in the bracketsmain.py
to configure the proxy: proxy = { 'http' : "http://127.0.0.1:端口号" , 'https' : "http://127.0.0.1:端口号" }
openai . proxy = proxy
If you have any usage problems, you can join the QQ group 283430436 to communicate or try it out.
@机器人1号#上线
, which is suitable for situations where there are multiple robots in the group, and the direct use of the siren command will affect all robots.instruction | Example | illustrate |
---|---|---|
#gpttoggle | #gpttoggle | Switch between gpt3 and chatgpt modes |
#online | #online | Bring the group chat robot online to allow it to perform openai calls and ai painting |
#offline | #offline | Take the group chat robot offline so that it is not allowed to perform openai calls and ai drawings |
#draw图 | #draw图512x512.girl | Let the robot draw pictures in the group chat, for example: #画图girl , use dots or semicolons to separate, allow some shortcut operations, use curly braces to allow detailed json configuration operations, please use #帮助 to view details |
#d | #d 512x512.girl | Quick drawing operations that users in the vip list are allowed to use, the effect is the same as #画图 |
#withdraw | #withdraw | Undo the last bot message triggered by you |
#黑黑 | #黑黑123456 | Ban this user from using bots in this group chat |
#dismissal | #lift123456 | Unblock this user |
#vip | #vip 123456 | Add the user to the vip list. Users in the vip list can use the #d command or call the robot through at to execute the openai api conversation. |
#unvip | #unvip 123456 | Remove this user from vip list |
#cleanconversation | #cleanconversation | Clean up the conversation context (when the previous conversation content was too long and caused the request to fail, you can choose to clean it up) |
#help | #help | Display help information for ordinary users in the group, excluding vip instructions and master instructions |
#default | #default | Displays the default json configuration of #画图 . You can directly copy this information and modify it yourself, and then pass it back to call through #画图{...} |
#blacklist | #blacklist | Show blacklist list |
#at switch | #at switch | Switch the robot response mode. By default, the at robot is always required for openai reply. After switching, you can have a direct conversation and reply to every sentence. |
#model | #modelanything-v4 | Directly enter #model to view the list of currently active models and all available models. Enter #model 模型名 to switch models. The model name does not need to be complete, it only needs to exist in the target model name. It is not case-sensitive. For example, a complete model Named anything-v4.0-pruned.safetensors , you can directly enter #model v4 to switch |
#vae | #vae Anything-V3.0.vae.pt | Directly enter #vae to view the currently used VAE. Enter #vae VAE名称 to switch VAE. Note that unlike model switching, VAE switching must completely match the file name. |
#balance | #balance | Display the balance of the currently used api key |
Modify the on_message function in main.py and ws_wrapper.py to try to develop robot applications for other programs besides QQ
At the beginning, this project was just a toy for sand sculpture friends. Tu Yile came up with it. Recently, when I was working on a real-life model, I integrated the gpt dialogue function. I felt that the effect was pretty good, so I made it open source.
The core idea can be understood by looking at the prompt of config.py. Similar ideas can also be used to generate voice conversations, manage group chats, etc. This is just to inspire others. Everyone is welcome to fork and modify it.
The code and git logs are very long, because it was just a toy project from the beginning, and it was built directly with a shuttle. Moreover, the records also contain private information such as my own domain name and key, so I directly created a new project without any logs.