项目
在 GitHub 查看
franalgaba/chatgpt-telegram-bot-serverless
关于
ChatGPT Telegram Bot running in AWS Lambda
人工智能与机器学习可以做什么
- New ChatGPT API support. :brain:
- Voice messages support! :fire:
- Markdown rendering support.
实测星标增长
- 24小时
- 0
- 7天
- 0
- 15天
- -2
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文ChatGPT Telegram Bot in AWS Lambda
This a Telegram bot that lets you chat with ChatGPT. This bot is created using the brand new ChatGPT API. The Telegram bot is deployed in completely serverless in AWS Lambda. No need to setup a local server or do login in the browser.
Features
- New ChatGPT API support. :brain:
- Voice messages support! :fire:
- Markdown rendering support.
Initial Setup
- Create an OpenAI account and get an API Key.
- Create an AWS account.
- Setup your Telegram bot. You can follow this instructions to get your token.
[
](/img/session_token.png)
](/img/session_token.png)
- To enable support for voice messages you need to create a S3 bucket in your AWS account.
- Go to the top search bar and write
S3.
[
](/img/s3_browser.png)
](/img/s3_browser.png)
- Click the Create Bucket button.
[
](/img/create_bucket_button.png)
](/img/create_bucket_button.png)
- Configure the creation of your bucket. The name must be unique worldwide. Scroll to bottom and click Create Bucket and don't change any other configuration.
[
](/img/create_bucket_config.png)
](/img/create_bucket_config.png)
- Go to
.chalice/config.jsonand stablish the configurations:
TELEGRAM_TOKENwith your Telegram token.OPENAI_API_KEYwith the value of your Open AI API Token.VOICE_MESSAGES_BUCKETwith the bucket name you created previously.
Installation
- Install Python using pyenv or your prefered Python installation.
- Create a virtual environment:
python3 -m venv .venv. - Activate you virtual environment:
source .venv/bin/activate. - Install dependencies:
pip install -r requirements.txt. - Install the AWS CLI and configure your credentials.
Deployment
- Run
chalice deploy. - Go to the AWS Console -> Lambda -> chatgpt-telegram-bot-dev-message-handler-lambda -> Configuration -> Function URL.
- Click Create Function URL and set Auth type to NONE.
- Copy the created function URL.
- Stablish your Telegram webhook to point to you AWS Lambda running
curl --request POST --url https://api.telegram.org/bot<YOUR_TELEGRAM_TOKEN>/setWebhook --header 'content-type: application/json' --data '{"url": "YOUR_FUNCTION_URL"}'
Great! Everything is setup :) Now go to Telegram and find your bot name and use ChatGPT from there!
Coming soon!
- Decoupled Token refresh in conversation.
- Increase response performance.
- Error handling from ChatGPT services.
- Deploy solution with one-click using CloudFormation.
Credits
探索相关项目
加载中…