MyGit

KudoAI/chatgpt.js

Fork: 122 Star: 1860 (更新于 2024-09-10 13:59:43)

license: MIT

Language: JavaScript .

🤖 A powerful, open source client-side JavaScript library for ChatGPT

最后发布版本: v3.2.0 ( 2024-08-30 05:16:11)

官方网址 GitHub网址

English | 简体中文 | 繁體中文 | 日本 | 한국인 | हिंदी | नेपाली | Deutsch | Español | Français | Italiano | Nederlands | Português | Việt

🤖 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@3.2.0/dist/chatgpt.min.js');
    // Your code here...
})();

ES5:

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

最近版本更新:(数据更新于 2024-09-10 13:59:27)

2024-08-30 05:16:11 v3.2.0

2024-08-30 03:58:27 v3.1.0

2024-08-28 18:44:16 v3.0.3

2024-08-28 17:21:30 v3.0.2

2024-07-19 18:55:09 v3.0.1

2024-07-19 17:15:16 v3.0.0

2024-05-24 18:19:47 v2.9.3

2024-05-18 04:19:08 v2.9.2

2024-05-18 03:10:28 v2.9.1

2024-05-18 01:46:25 v2.9.0

主题(topics):

ai, artificial-intelligence, bot, chat, chatbot, chatgpt, clientside, conversational-ai, conversational-bots, frontend, gpt, gpt-3, gpt-4, javascript, kudoai, library, machine-learning, ml, nlp, openai

KudoAI/chatgpt.js同语言 JavaScript最近更新仓库

2024-09-19 23:16:03 vernesong/OpenClash

2024-09-18 09:14:21 Lyoko-Jeremie/DoLModLoaderBuild

2024-09-18 09:07:58 NumberSir/DoL-I18n-Build

2024-09-18 05:07:54 nodejs/node

2024-09-17 23:21:15 4ian/GDevelop

2024-09-17 15:40:51 koodo-reader/koodo-reader