MyGit

KudoAI/chatgpt.js

Fork: 143 Star: 1917 (更新于 2024-11-26 11:41:28)

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

ES11 (2020):

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

ES5 (2009):

var xhr = new XMLHttpRequest();
xhr.open('GET', 'https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@3.3.5/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.3.5/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. 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 () => {
    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-12-21 12:14:02 layui/layui

2024-12-21 08:27:48 gethomepage/homepage

2024-12-21 03:44:01 emberjs/ember.js

2024-12-20 02:57:09 nodejs/node

2024-12-19 17:54:54 MHSanaei/3x-ui

2024-12-14 02:13:44 bigskysoftware/htmx