Home  >  Article  >  Technology peripherals  >  It’s so easy to connect WeChat to ChatGPT and turn it into a chatbot!

It’s so easy to connect WeChat to ChatGPT and turn it into a chatbot!

PHPz
PHPzforward
2023-04-17 17:16:033549browse

ChatGPT has become popular again recently, and various peripheral tools are emerging in endlessly. Today we will make a WeChat chatbot based on ChatGPT to experience the joy of the AI ​​world~

Let’s do it first Let’s take a look at a few issues that I am more concerned about

Python language algorithm:

It’s so easy to connect WeChat to ChatGPT and turn it into a chatbot!

What is ChatGPT:

It’s so easy to connect WeChat to ChatGPT and turn it into a chatbot!

Will artificial intelligence rule the world:

It’s so easy to connect WeChat to ChatGPT and turn it into a chatbot!

Philosophical question:

It’s so easy to connect WeChat to ChatGPT and turn it into a chatbot!

Hahaha, it’s quite interesting and powerful enough!

Let’s take a look at how to make a ChatGPT robot

Open source tools

In fact, there are already many open source WeChat chat tools on the Internet. The one I use here is open source on GitHub

https://github.com/djun/wechatbot

is also very convenient to use. The only prerequisite is to install the Golang language environment

Installation and use

The next step is to install and use it. It is actually very simple.

# 获取项目
git clone https://github.com/djun/wechatbot.git

# 进入项目目录
cd wechatbot

# 复制配置文件
copy config.dev.json config.json

# 启动项目
go run main.go

启动前需替换config中的api_key

When we execute the go run command, a QR code will be displayed in the browser. We only need to use WeChat to scan the code. Just log in.

At this time, the WeChat we scanned is a robot. When other people send messages to this WeChat, the WeChat will automatically reply with the ChatGPT answer content. Isn’t it very convenient!

Getting api key

Let’s briefly talk about how to get api key

Here you need to use the relevant knowledge of scientific Internet access. If you don’t know it yet, then You can contact me in the background. The software I am currently using is pretty good.

Then we visit the official website of openai. You need to log in at this time. If you have not registered an account, you need to withdraw and prepare. You can also reply "chatgpt" in the background to obtain a shared experience account!

After we log in, visit the address https://platform.openai.com/account/api-key, add the corresponding key, save the key, and add it to the project.

It’s so easy to connect WeChat to ChatGPT and turn it into a chatbot!

Add in config.json

##​ It’s so easy to connect WeChat to ChatGPT and turn it into a chatbot!#​

The above is the detailed content of It’s so easy to connect WeChat to ChatGPT and turn it into a chatbot!. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:51cto.com. If there is any infringement, please contact admin@php.cn delete