COCO研究院

 找回密碼
 註冊
搜索
查看: 1521|回復: 6

[心得] 將 ChatGPT 與 Telegram 機器人銜接在一起 ...

[複製鏈接]
發表於 23-2-17 11:11 | 顯示全部樓層 |閱讀模式
參考 :
ChatGPT 接入到微信和Telegram 的完整教程!想怎麼聊就怎麼聊,太方便了! | 零度解說




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


  1. ====begin from BotFather
  2. 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.



  3. Use this token to access the HTTP API:

  4. 1234567890:some_token_xxxxxxxxxxxxxxxxxxx

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



  6. For a description of the Bot API, see this page: https://core.telegram.org/bots/api
  7. ==========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
[PM2] Freeze a process list on reboot via:
$ pm2 save

[PM2] Remove init script via:
$ pm2 unstartup systemd

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



 樓主| 發表於 23-2-18 02:20 | 顯示全部樓層

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

20230217-01.png


20230217-02.png

20230217-03.png

20230217-04.png

回復 支持 1 反對 0

使用道具 舉報

發表於 23-2-18 22:12 | 顯示全部樓層
感謝大大的分享。
有機會來試試看。

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

評分

參與人數 1金錢 +1 收起 理由
tinyding + 1 ^_^

查看全部評分

 樓主| 發表於 23-3-6 13:02 | 顯示全部樓層
當你使用 API key, 會有試用期限與試用額度(18美元) ...

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


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

 樓主| 發表於 23-3-11 16:50 | 顯示全部樓層
tinyding 發表於 23-3-6 13:02
當你使用 API key, 會有試用期限與試用額度(18美元) ...

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

https://openai.com/pricing

  1. Is the ChatGPT API included in the ChatGPT Plus subscription?

  2. 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.
複製代碼


 樓主| 發表於 23-3-11 16:52 | 顯示全部樓層

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


您需要登錄後才可以回帖 登錄 | 註冊

本版積分規則

手機版|Archiver|站長信箱|廣告洽詢|COCO研究院

GMT+8, 24-4-27 20:45

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回復 返回頂部 返回列表
理財討論網站 | AI繪圖AI超擬真美女AI beauty AI Stable DiffusionAI正妹AI Lookbook