2 Star 1 Fork 1

Gitee 极速下载 / chatgpt-js

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
此仓库是为了提升国内下载速度的镜像仓库,每日同步一次。 原始仓库: https://github.com/kudoai/chatgpt.js
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

🤖 A powerful client-side JavaScript library for ChatGPT


💡 About

chatgpt.js is a powerful JavaScript library that allows for super easy interaction w/ the ChatGPT DOM.

  • Feature-rich
  • Object-oriented
  • Easy-to-use
  • Lightweight (yet optimally performant)

⚡ Importing the library

Note To always import the latest version (not recommended in production!) replace the versioned jsDelivr URL with: https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js/chatgpt.min.js

ES6:

(async () => {
    await import('https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.9.3/dist/chatgpt.min.js');
    // Your code here...
})();

ES5:

var xhr = new XMLHttpRequest();
xhr.open('GET', 'https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.9.3/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...
}

Greasemonkey:

Note To use a starter template: kudoai/chatgpt.js-greasemonkey-starter

...
// @require https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.9.3/dist/chatgpt.min.js
// ==/UserScript==

// Your code here...

Chrome:

Note To use a starter template: kudoai/chatgpt.js-chrome-starter

Since Google does not allow remote code, importing chatgpt.js locally is required:

  1. Save https://raw.githubusercontent.com/KudoAI/chatgpt.js/main/chatgpt.js to a subdirectory (lib in this example)

  2. Add ES6 export statement to end of lib/chatgpt.js

...
export { chatgpt }
  1. In project's (V3) manifest.json, add lib/chatgpt.js as a web accessible resource
    "web_accessible_resources": [{
        "matches": ["<all_urls>"],
        "resources": ["lib/chatgpt.js"]
    }],
  1. In scripts that need chatgpt.js (foreground/background alike), import it like so:
(async () => {
    const { chatgpt } = await import(chrome.runtime.getURL('lib/chatgpt.js'));
    // Your code here...
})();

💾 Downloading via npm:

To download chatgpt.js for local customization, run the following command in your project's root:

npm install @kudoai/chatgpt.js

After installation, navigate to node_modules/@kudoai/chatgpt.js to find the library source.

💻 Usage

chatgpt.js was written w/ ultra flexibility in mind.

For example:

chatgpt.getLastResponse();
chatgpt.getLastReply();
chatgpt.response.getLast();
chatgpt.get('reply', 'last');

Each call equally fetches the last response. If you think it works, it probably will... so just type it!

If it didn't, check out the extended userguide, or simply submit an issue or PR and it will be integrated, ezpz!

🤖 Made with chatgpt.js

https://github.com/KudoAI/chatgpt.js/assets/10906554/f53c740f-d5e0-49b6-ae02-3b3140b0f8a4

Autoclear ChatGPT History  

Auto-clear your ChatGPT query history for maximum privacy.
Install / Readme / Discuss

BraveGPT  

Display ChatGPT answers in Brave Search sidebar (powered by GPT-4o!)
Install / Readme / Discuss

ChatGPT Auto-Continue ⏩  

Automatically continue generating multiple ChatGPT responses.
Install / Readme / Discuss

ChatGPT Auto Refresh ↻  

Keeps ChatGPT sessions fresh to eliminate network errors + Cloudflare checks.
Install / Readme / Discuss

DuckDuckGPT  

Display ChatGPT answers in DuckDuckGo sidebar (powered by GPT-4o!)
Install / Readme / Discuss

GoogleGPT  

Display ChatGPT answers in Google Search sidebar (powered by GPT-4o!)
Install / Readme / Discuss

ThunderAI

Use ChatGPT in Thunderbird to enhance you emails, even with a free account!
Install / Readme / Support




If you've made something w/ chatgpt.js you want to share, email showcase@chatgptjs.org or just open a pull request!

🧠 Contributors

This library exists thanks to code, translations, issues & ideas from the following contributors:



🤝 Partners

chatgpt.js is funded in part by:


# MIT License **Copyright © 2023–2024 [KudoAI](https://github.com/KudoAI) & [contributors](.#-contributors).** Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

chatgpt.js 是一个功能强大的 JavaScript 库,可轻松与 ChatGPT DOM 进行交互 展开 收起
JavaScript 等 3 种语言
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/mirrors/chatgpt-js.git
git@gitee.com:mirrors/chatgpt-js.git
mirrors
chatgpt-js
chatgpt-js
main

搜索帮助

344bd9b3 5694891 D2dac590 5694891