tinyding 發表於 23-2-17 11:11

將 ChatGPT 與 Telegram 機器人銜接在一起 ...

參考 :
ChatGPT 接入到微信和Telegram 的完整教程!想怎麼聊就怎麼聊,太方便了! | 零度解說

EfuTvNJFZbU


把 ChatGPT 接入微信和 telegram(电报)就这么简单!零度解說


====begin from BotFather
Done! Congratulations on your new bot. You will find it at t.me/Your_ChatGPT_bot. You can now add a description, about section and profile picture for your bot, see /help for a list of commands. By the way, when you've finished creating your cool bot, ping our Bot Support if you want a better username for it. Just make sure the bot is fully operational before you do this.



Use this token to access the HTTP API:

1234567890:some_token_xxxxxxxxxxxxxxxxxxx

Keep your token secure and store it safely, it can be used by anyone to control your bot.



For a description of the Bot API, see this page: https://core.telegram.org/bots/api
==========End from BotFather



底下是在 Debian 系統下操作的 ... :

所需的套件 :
git
nodejs
你的 ChatGPT API Key
你在 BotFather 裡頭, 你的機器人的 "HTTP API token"


安裝 nodejs :
curl -fsSL https://deb.nodesource.com/setup_19.x | bash - &&apt-get install -y nodejs

使用 npm 安裝 pm2 :
npm install pm2 -g



安裝銜接 "Telegram 機器人" 的接口 ... :
git clone https://github.com/harshitethic/chatgpt-bot-telegram.git
cd chatgpt-bot-telegram
npm install


將所需的 Token Key 寫入 ".env" 檔案中 ... :

API = Your ChatGPT API Key
TG_API = Your Telegram bot token


使用 pm2 執行 "Telegram 機器人接口" ... :
## 目前所在目錄為 /home/tinyding/Download-Files/chatgpt-bot-telegram
pm2 start index.js

如果下次開機後要可以自動執行 ... :
pm2 startup



底下是在 Telegram ChatGPT bot 機器人的畫面中的操作 ... :
/ask -> ank anything from me ...
/image -> to create image from text ...


底下是在 Debian 下一般的操作 ... :

systemctl enable pm2-root
Freeze a process list on reboot via:
$ pm2 save

Remove init script via:
$ pm2 unstartup systemd

pm2 的狀態 ... :
pm2 status
┌────┬────────────────────┬──────────┬──────┬───────────┬──────────┬──────────┐
│ id │ name               │ mode   │ ?    │ status    │ cpu      │ memory   │
├────┼────────────────────┼──────────┼──────┼───────────┼──────────┼──────────┤
│ 0│ index            │ fork   │ 0    │ online    │ 0%       │ 60.3mb   │
└────┴────────────────────┴──────────┴──────┴───────────┴──────────┴──────────┘



tinyding 發表於 23-2-18 02:20


底下是我問 ChatGPT 的一些對話 ...










綠茶妹 發表於 23-2-18 22:12

感謝大大的分享。
有機會來試試看。

我剛剛還把chatgpt的網頁連結設定在手機桌面上。

Evil 發表於 23-2-20 13:59

厲害!!!!!

tinyding 發表於 23-3-6 13:02

當你使用 API key, 會有試用期限與試用額度(18美元) ...

查詢自身的使用額度與期限:
https://platform.openai.com/account/usage


網頁版的 ChatGPT (這個應該也是有試用期限的 ... ) :
https://chat.openai.com/chat

tinyding 發表於 23-3-11 16:50

tinyding 發表於 23-3-6 13:02
當你使用 API key, 會有試用期限與試用額度(18美元) ...

查詢自身的使用額度與期限:


https://openai.com/pricing

Is the ChatGPT API included in the ChatGPT Plus subscription?

No, the ChatGPT API and ChatGPT Plus subscription are billed separately. The API has its own pricing, which can be found at https://openai.com/pricing. The ChatGPT Plus subscription covers usage on chat.openai.com only and costs $20/month.

tinyding 發表於 23-3-11 16:52


仅需5分钟,用ChatGPT API 和 gpt-3.5-turbo 模型,搭建你自己的ChatGPT对话界面
0_xnIhokAXc

頁: [1]
查看完整版本: 將 ChatGPT 與 Telegram 機器人銜接在一起 ...