chatgpt.js是一個功能強大的JavaScript庫,允許使用Chatgpt DOM進行超級簡單的交互。
筆記
始終導入最新版本(不建議在生產中推薦!)用https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js/chatgpt.min.js
方式替換版本的JSdelivr URL:
( async ( ) => {
await import ( 'https://cdn.jsdelivr.net/npm/@kudoai/[email protected]/dist/chatgpt.min.js' ) ;
// Your code here...
} ) ( ) ;
var xhr = new XMLHttpRequest ( ) ;
xhr . open ( 'GET' , 'https://cdn.jsdelivr.net/npm/@kudoai/[email protected]/dist/chatgpt.min.js' ) ;
xhr . onload = function ( ) {
if ( xhr . status === 200 ) {
var chatgptJS = document . createElement ( 'script' ) ;
chatgptJS . textContent = xhr . responseText ;
document . head . append ( chatgptJS ) ;
yourCode ( ) ; // runs your code
}
} ;
xhr . send ( ) ;
function yourCode ( ) {
// Your code here...
}
筆記
要使用入門模板:kudoai/chatgpt.js-greasemonkey-starter
...
// @require https://cdn.jsdelivr.net/npm/@kudoai/[email protected]/dist/chatgpt.min.js
// ==/UserScript==
// Your code here...
筆記
要使用入門模板:kudoai/chatgpt.js-chrome-starter
由於Google不允許遠程代碼,因此需要在本地導入chatgpt.js:
保存https://raw.githubusercontent.com/kudoai/chatgpt.js/main/chatgpt.js到子目錄(此示例lib
)
在項目(v3) manifest.json
中,添加lib/chatgpt.js
作為網絡訪問資源
"web_accessible_resources" : [{
"matches" : [ " <all_urls> " ],
"resources" : [ " lib/chatgpt.js " ]
}],
chatgpt.js
(前景/背景)的腳本中,類似地導入它: ( async ( ) => {
await import ( chrome . runtime . getURL ( 'lib/chatgpt.js' ) ) ;
// Your code here...
} ) ( ) ;
要下載用於本地自定義的ChatGpt.js ,請在項目的根部運行以下命令:
npm install @kudoai/chatgpt.js
安裝後,導航到node_modules/@kudoai/chatgpt.js
查找庫源。
chatgpt.js撰寫了帶有超靈活性的書寫。
例如:
chatgpt . getLastResponse ( ) ;
chatgpt . getLastReply ( ) ;
chatgpt . response . getLast ( ) ;
chatgpt . get ( 'reply' , 'last' ) ;
每個呼叫都同樣獲得最後一個響應。如果您認為它有效,它可能會...所以鍵入它!
如果沒有,請查看擴展的USERGUIDE,或者簡單地提交問題或PR,然後將其集成,EZPZ!
將AI添加到亞馬遜購物中。
安裝 /讀書 /討論
自動清除您的Chatgpt查詢歷史記錄,以獲得最大的隱私。
安裝 /讀書 /討論
添加了勇敢搜索的AI答案(由GPT-4O提供支持!)
安裝 /讀書 /討論
自動繼續生成多個chatgpt響應。
安裝 /讀書 /討論
自動播放ChatGpt響應。
安裝 /讀書 /討論
將ChatGpt會話保持新鮮,以消除網絡錯誤 + CloudFlare檢查。
安裝 /讀書 /討論
為DuckDuckgo添加了AI答案(由GPT-4O提供支持!)
安裝 /讀書 /討論
添加了Google搜索的AI答案(由Google Gemma + GPT-4O提供支持!)
安裝 /讀書 /討論
即使有一個免費帳戶,使用Thunderbird中的Chatgpt來增強您的電子郵件!
安裝 /讀取 /支持
如果您要分享w/ chatgpt.js的東西,請發送電子郵件至[email protected]或只是打開拉請請求!
該庫存在得益於以下貢獻者的代碼,翻譯,問題和想法:
發行/ USERGUIDE /討論 /回到頂部↑