Quora的Poe的反向工程節點端。
支持:獲取所需信息並寫入.ENV文件|將消息發送到其他機器人|設置代理|清除/刪除/清除消息|獲取歷史記錄消息|獲取機器人信息|獲取下一個數據
我仍在努力,所以它可能不穩定。如果您遇到任何問題,請創建一個問題。
npm install poe-node-api要求:
- 節點> = 18
- .env:要存儲所需的參數,例如
poe-formkey/cookie/buildId/ botid .....
從poe.com獲取cookie:f12/Inspect,應用程序> cookie> https://poe.com> pb
在項目root路徑中創建.ENV文件,然後將cookie添加到.env文件中
cookie = p-b=xxxxxxxxxxxxxxxxxxxxxxxxxxx const client = new PoeClient ( { logLevel : 'debug' } ) ;
await client . init ( )
// If no poe-formkey and buildId in .env file, client will download needed params, next time will not need to fetch these params again until cookie is changed/logout(For now).如何創建客戶:
import { PoeClient } from "poe-node-api" ;
const client = new PoeClient ( { logLevel : 'debug' } ) ;如何啟動客戶
await client . init ( )buildId / poe-formkey之類的必要參數,並在本地'.env'文件中覆蓋它們。為了防止衝突,使用多學院時,您應該將
rewriteToLocalEnvFile設置為False
機器人暱稱
botnickname <==> botdisplayname
- A2 <==> Claude-Instant
- A2_2 <==> Claude+
- 海狸<==> gpt-4
- Capybara <==> Sage
- nutria <==>蜻蜓
- Chinchilla <==> chatgpt
- Hutia <==> Neevaai
- 您自己的機器人
/**
* send message to bot
* @param text user input
* @param botNickName bot nick name, like capybara(Sage) / a2(Claude-instant) / a2_2(Claude+) etc.
* @param withChatBreak Add a chat break or not. (Empty context)
* @param callback When ws on message, will invoke this callback function.
*/
await client . sendMessage ( text , botNickName , withChatBreak , ( result : string ) => { console . log ( ` ${ result } ` ) } )文字:字符串
botnickname:字符串
與Chatbreak:布爾值
回調:(結果:字符串)=> void
警告:一分鐘內太多請求將導致(免費)帳戶被阻止!!!!
我在一分鐘內發送了大約20條消息,現在它被阻止了。錯誤消息失敗:
Something went wrong. Please wait a moment and try again.因此,請確保您知道自己在做什麼〜
const res = await client . addChatBreak ( botNickName ) ; const res = await client . deleteMessage ( messageIds ) ; const res = await client . purgeAllMessage ( ) ;刪除所有機器人消息,等於單擊POE.com>設置>刪除所有消息
const history = await client . getHistory ( botNickName , count ) ; const history = await client . getBotByNickName ( botNickName , retryCount , retryIntervalMs ) ; const history = await client . getNextData ( ) ;可以獲取
poe-formkey/buildId/latest messages(例如最新5條消息)和startCursor(使用startcursor來獲取歷史記錄消息) /availableBots/x-forwarded-for/ .....
await client . updateAllBotInfo ( )此功能將獲取POE-FORMKEY,buildID,最新消息,啟動器和所有bot Info(chatid / id,這兩個參數將用於使用)。
此功能將將
poe-formkey/cookie/buildId/${botDisplayName}_chatId和${botDisplayName}_id設置為.env file(這些參數與cookie相同,並且不需要每次要求)。下次您將MSG發送到任何機器人時,將不需要再次獲取bot信息,客戶端將獲得所需的params,例如
buildId從local .env文件中獲得。
示例-SendMessage.ts
示例-SendMessage.ts
示例-troxy.ts
示例-Thistory.ts
示例-FetchallneededInfo.ts
麻省理工學院