├── demo
├── link.png
├── demo0.png
├── demo1.png
├── demo2.png
├── demo_3.png
├── link2.png
├── link3.png
├── link3a.png
├── link4.png
└── demo_351.png
├── requirements.txt
├── vercel.json
├── README_jp.md
├── README_en.md
├── README.md
└── main.py
/demo/link.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pyfbsdk59/Flask-official-ChatGPT-TelegramBot-Vercel/HEAD/demo/link.png
--------------------------------------------------------------------------------
/demo/demo0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pyfbsdk59/Flask-official-ChatGPT-TelegramBot-Vercel/HEAD/demo/demo0.png
--------------------------------------------------------------------------------
/demo/demo1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pyfbsdk59/Flask-official-ChatGPT-TelegramBot-Vercel/HEAD/demo/demo1.png
--------------------------------------------------------------------------------
/demo/demo2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pyfbsdk59/Flask-official-ChatGPT-TelegramBot-Vercel/HEAD/demo/demo2.png
--------------------------------------------------------------------------------
/demo/demo_3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pyfbsdk59/Flask-official-ChatGPT-TelegramBot-Vercel/HEAD/demo/demo_3.png
--------------------------------------------------------------------------------
/demo/link2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pyfbsdk59/Flask-official-ChatGPT-TelegramBot-Vercel/HEAD/demo/link2.png
--------------------------------------------------------------------------------
/demo/link3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pyfbsdk59/Flask-official-ChatGPT-TelegramBot-Vercel/HEAD/demo/link3.png
--------------------------------------------------------------------------------
/demo/link3a.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pyfbsdk59/Flask-official-ChatGPT-TelegramBot-Vercel/HEAD/demo/link3a.png
--------------------------------------------------------------------------------
/demo/link4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pyfbsdk59/Flask-official-ChatGPT-TelegramBot-Vercel/HEAD/demo/link4.png
--------------------------------------------------------------------------------
/demo/demo_351.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pyfbsdk59/Flask-official-ChatGPT-TelegramBot-Vercel/HEAD/demo/demo_351.png
--------------------------------------------------------------------------------
/requirements.txt:
--------------------------------------------------------------------------------
1 | certifi
2 | chardet
3 | click
4 | flask
5 | future
6 | idna
7 | itsdangerous
8 | jinja2
9 | markupsafe
10 | python-telegram-bot==10.1.0
11 | requests
12 | urllib3
13 | werkzeug
14 | openai==0.27.0
15 |
--------------------------------------------------------------------------------
/vercel.json:
--------------------------------------------------------------------------------
1 | {
2 | "builds": [{
3 | "src": "main.py",
4 | "use": "@vercel/python",
5 | "config": { "maxLambdaSize": "15mb" }
6 | }],
7 | "routes": [
8 | {
9 | "src": "/(.*)",
10 | "dest": "main.py"
11 | }
12 | ]
13 | }
14 |
--------------------------------------------------------------------------------
/README_jp.md:
--------------------------------------------------------------------------------
1 | # Flask-ChatGPT-TelegramBot-Vercel
2 | # プラットフォーム Vercel 上に迅速に構築された Flask ChatGPT TelegramBot。
3 |
4 |
5 | ### [繁體中文](https://github.com/pyfbsdk59/Flask-ChatGPT-TelegramBot-Vercel/blob/main/README.md)
6 | ### [English](https://github.com/pyfbsdk59/Flask-ChatGPT-TelegramBot-Vercel/blob/main/README_en.md)
7 |
8 |
9 | #### 1. このプロジェクトは、以下のプロジェクトを参照しており、Flask を学習したばかりの人が Vercel に TelegramBot をデプロイするためのものです。
10 |
11 | https://github.com/howarder3/GPT-Linebot-python-flask-on-vercel
12 | https://github.com/zaoldyeck/telegram-innovation-chatbot/tree/basic
13 |
14 | #### 2. このプロジェクトは Vercel にデプロイされているため、コードは Docker のバージョンとは異なり、Flask フレームワークを使用し、webhook を設定する必要があります。 以下のWebhook設定のノウハウをご覧ください。
15 |
16 | https://zaoldyeck.medium.com/%E6%89%8B%E6%8A%8A%E6%89%8B%E6%95%99%E4%BD%A0%E6%80%8E%E9%BA%BC%E6%89%93%E9%80%A0-telegram-bot-a7b539c3402a
17 |
18 | #### 3. Vercel の環境変数で、OPENAI_API_KEY と TELEGRAM_BOT_TOKEN という 2 つの環境変数を設定する必要があります。
19 |
20 | #### 4. ブラウザを開き、以下の URL を入力し、Webhook を Vercel をデプロイした後の最後のステップとして設定してください。 フォーマットは次のように示されます。 https://api.telegram.org/bot{$token}/setWebhook?url={$webhook_url}。
21 |
22 | ##### 実際の例は次の例のようになります (直接コピーしないでください。自分のテレグラム トークンと Vercel プロジェクトの URL を使用してください)。:
23 |
24 |
25 | https://api.telegram.org/bot606248605:AAGv_TOJdNNMc_v3toHK_X6M-dev_1tG-JA/setWebhook?url=https://xxx.vercel.app/callback
26 |
27 |
28 | #### 5. 成功すると次のテキストが表示されます:
29 |
30 | {
31 | ok: true,
32 | result: true,
33 | description: "Webhook was set"
34 | }
35 | ------
36 | ### テレグラム ボットの作成方法とトークンの取得方法については、こちらをご覧ください。.
37 | https://ithelp.ithome.com.tw/articles/10245264
38 | https://tcsky.cc/tips-01-telegram-chatbot/
39 |
40 |
--------------------------------------------------------------------------------
/README_en.md:
--------------------------------------------------------------------------------
1 | # Flask-ChatGPT-TelegramBot-Vercel
2 | # A Flask ChatGPT TelegramBot quickly built on the platform Vercel.
3 |
4 |
5 | ### [繁體中文](https://github.com/pyfbsdk59/Flask-ChatGPT-TelegramBot-Vercel/blob/main/README.md)
6 | ### [日本語](https://github.com/pyfbsdk59/Flask-ChatGPT-TelegramBot-Vercel/blob/main/README_jp.md)
7 |
8 |
9 | #### 0. Migrating to GPT3.5 model...
10 |
11 |
12 |
13 | #### 1. This project refers to the following predecessors' projects, and it is only for friends who have just learned Flask to deploy TelegramBot on Vercel:
14 |
15 | https://github.com/howarder3/GPT-Linebot-python-flask-on-vercel
16 | https://github.com/zaoldyeck/telegram-innovation-chatbot/tree/basic
17 |
18 | #### 2. Since this project is deployed on Vercel, the code is different from the version of Docker, and Flask framework must be used and webhook must be set. Please see knowhows of setting webhook below.
19 |
20 | https://zaoldyeck.medium.com/%E6%89%8B%E6%8A%8A%E6%89%8B%E6%95%99%E4%BD%A0%E6%80%8E%E9%BA%BC%E6%89%93%E9%80%A0-telegram-bot-a7b539c3402a
21 |
22 | #### 3. Two environment variables must be set in Vercel's Environment Variables, namely OPENAI_API_KEY and TELEGRAM_BOT_TOKEN.
23 |
24 | #### 4. Please open the browser, enter the following URL, and set the webhook as the last step after deploying Vercel. The format is shown as https://api.telegram.org/bot{$token}/setWebhook?url={$webhook_url}。
25 |
26 | ##### The actual example is like the following example (Don't copy it directly, please use your own telegram token and the URL of the Vercel project):
27 |
28 |
29 | https://api.telegram.org/bot606248605:AAGv_TOJdNNMc_v3toHK_X6M-dev_1tG-JA/setWebhook?url=https://xxx.vercel.app/callback
30 |
31 |
32 | #### 5. The following text will be shown after success:
33 |
34 | {
35 | ok: true,
36 | result: true,
37 | description: "Webhook was set"
38 | }
39 | ------
40 | ### You can learn how to create a telegram bot and get the token here.
41 | https://ithelp.ithome.com.tw/articles/10245264
42 | https://tcsky.cc/tips-01-telegram-chatbot/
43 |
44 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Flask-official-ChatGPT-TelegramBot-Vercel
2 | # 一個使用Flask框架和official ChatGPT/GPT3.5 turbo api創造TelegramBot,快速建置於平台Vercel。
3 |
4 |
6 |
12 |
18 |
24 |
30 |
34 |
40 |
55 |
71 |
77 |