-
Notifications
You must be signed in to change notification settings - Fork 500
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add a cookbook for ChatGPT Bot #961
Conversation
doc/cookbook/chatgpt-bot.md
Outdated
Since the bot needs to receive Telegram message notifications and call third-party APIs, we must prepare the following in advance: | ||
|
||
* Install the latest version of Easegress according to [this document](https://github.com/megaease/easegress#setting-up-easegress) and make sure that external applications can access the Easegress instance on at least one of ports 80, 88, 443, or 8443. | ||
* Create a Telegram bot by following [this document](https://core.telegram.org/bots#3-how-do-i-create-a-bot), set its name (EaseTranslateBot is used in this article), write down its token, and [set up a Webhook](https://core.telegram.org/bots/api#setwebhook) that points to the Easegress instance installed in the previous step. Our bot will receive notifications of new messages through this Webhook. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The bot is not for translation, so better use another name instead of EaseTranslateBot
.
doc/cookbook/chatgpt-bot.md
Outdated
|
||
## 1. Prerequisites | ||
|
||
Since the bot needs to receive Telegram message notifications and call third-party APIs, we must prepare the following in advance: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the bot needs to receive Telegram message notifications and call third-party APIs, we must prepare the following in advance: | |
Since the bot needs to receive Telegram message notifications and call ChatGPT APIs, we must prepare the following in advance: |
doc/cookbook/chatgpt-bot.md
Outdated
|
||
Before reading this article, please read the [Multiple API Orchestration](./translation-bot.md) article to ensure understanding of Easegress API orchestration and Telegram robot. | ||
|
||
In this article, we will introduce how to build a Telegram ChatGPT robot with Easegress. This robot can generate a response based on the user's input. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both bot
and robot
are used in this article, per telegram, we should only use bot
.
doc/cookbook/chatgpt-bot.md
Outdated
@@ -0,0 +1,190 @@ | |||
# Build A Telegram ChatGPT Bot With Easegress | |||
|
|||
Before reading this article, please read the [Multiple API Orchestration](./translation-bot.md) article to ensure understanding of Easegress API orchestration and Telegram robot. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before reading this article, please read the [Multiple API Orchestration](./translation-bot.md) article to ensure understanding of Easegress API orchestration and Telegram robot. | |
Before reading this article, please read the [Multiple API Orchestration](./translation-bot.md) article to ensure an understanding of Easegress API orchestration and Telegram robot. |
doc/cookbook/chatgpt-bot.md
Outdated
|
||
## 3. Pipeline | ||
|
||
First, let's check the overall flow that Pipeline orchestrates: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First, let's check the overall flow that Pipeline orchestrates: | |
First, let's check the overall flow of the Pipeline: |
doc/cookbook/chatgpt-bot.md
Outdated
|
||
### 4.1 Backend Proxies | ||
|
||
We need to create two proxies to send requests to the ChatGPT API and Telegram API. The configuration of the two proxies is as follows: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to create two proxies to send requests to the ChatGPT API and Telegram API. The configuration of the two proxies is as follows: | |
We need to create two proxies to send requests to the ChatGPT API server and the Telegram API server. The configuration of the two proxies is as follows: |
doc/cookbook/chatgpt-bot.md
Outdated
|
||
### 4.2 Check and Extract Text | ||
|
||
The processing details is consistent with that in [Multiple API Orchestration](./translation-bot.md) and will not be described again. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The processing details is consistent with that in [Multiple API Orchestration](./translation-bot.md) and will not be described again. | |
The processing details are the same as that in [Multiple API Orchestration](./translation-bot.md). |
doc/cookbook/chatgpt-bot.md
Outdated
|
||
### 4.3 Send Request to ChatGPT | ||
|
||
Build a request to send to the ChatGPT API. See more details in [OpenAI API](https://platform.openai.com/docs/guides/chate). Make sure to replace the `{Your OpenAI API Key}` with your own API key. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Build a request to send to the ChatGPT API. See more details in [OpenAI API](https://platform.openai.com/docs/guides/chate). Make sure to replace the `{Your OpenAI API Key}` with your own API key. | |
Build a request to send to ChatGPT. See more details in [OpenAI API](https://platform.openai.com/docs/guides/chate). Make sure to replace the `{Your OpenAI API Key}` with your own API key. |
doc/cookbook/chatgpt-bot.md
Outdated
|
||
### 4.3 Send Request to ChatGPT | ||
|
||
Build a request to send to ChatGPT. See more details in [OpenAI API](https://platform.openai.com/docs/guides/chate). Make sure to replace the `{Your OpenAI API Key}` with your own API key. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Build a request to send to ChatGPT. See more details in [OpenAI API](https://platform.openai.com/docs/guides/chate). Make sure to replace the `{Your OpenAI API Key}` with your own API key. | |
Build a request to send to ChatGPT. See more details in [OpenAI API](https://platform.openai.com/docs/guides/chat). Make sure to replace the `{Your OpenAI API Key}` with your own API key. |
Add a cookbook for ChatGPT Bot