@kudoai/chatgpt.js 2.6.8 → 2.6.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -13
- package/chatgpt.js +17 -72
- package/dist/chatgpt.min.js +9 -3
- package/docs/README.md +7 -13
- package/docs/USERGUIDE.md +3 -62
- package/package.json +12 -12
- package/starters/chrome/extension/lib/chatgpt.js +17 -72
- package/starters/chrome/extension/manifest.json +1 -1
- package/starters/greasemonkey/chatgpt.js-greasemonkey-starter.user.js +2 -2
- package/docs/de/LICENSE.md +0 -29
- package/docs/de/README.md +0 -345
- package/docs/de/SECURITY.md +0 -25
- package/docs/es/LICENSE.md +0 -29
- package/docs/es/README.md +0 -345
- package/docs/es/SECURITY.md +0 -25
- package/docs/fr/LICENSE.md +0 -29
- package/docs/fr/README.md +0 -345
- package/docs/fr/SECURITY.md +0 -25
- package/docs/hi/LICENSE.md +0 -29
- package/docs/hi/README.md +0 -346
- package/docs/hi/SECURITY.md +0 -25
- package/docs/it/LICENSE.md +0 -27
- package/docs/it/README.md +0 -345
- package/docs/it/SECURITY.md +0 -25
- package/docs/ja/LICENSE.md +0 -29
- package/docs/ja/README.md +0 -345
- package/docs/ja/SECURITY.md +0 -25
- package/docs/ko/LICENSE.md +0 -32
- package/docs/ko/README.md +0 -350
- package/docs/ko/SECURITY.md +0 -25
- package/docs/ne/LICENSE.md +0 -35
- package/docs/ne/README.md +0 -346
- package/docs/ne/SECURITY.md +0 -25
- package/docs/nl/LICENSE.md +0 -29
- package/docs/nl/README.md +0 -345
- package/docs/nl/SECURITY.md +0 -25
- package/docs/pt/LICENSE.md +0 -29
- package/docs/pt/README.md +0 -345
- package/docs/pt/SECURITY.md +0 -25
- package/docs/vi/LICENSE.md +0 -29
- package/docs/vi/README.md +0 -345
- package/docs/vi/SECURITY.md +0 -25
- package/docs/zh-cn/LICENSE.md +0 -29
- package/docs/zh-cn/README.md +0 -344
- package/docs/zh-cn/SECURITY.md +0 -25
- package/docs/zh-tw/LICENSE.md +0 -29
- package/docs/zh-tw/README.md +0 -344
- package/docs/zh-tw/SECURITY.md +0 -25
- package/starters/chrome/docs/de/LICENSE.md +0 -31
- package/starters/chrome/docs/de/README.md +0 -93
- package/starters/chrome/docs/es/LICENSE.md +0 -31
- package/starters/chrome/docs/es/README.md +0 -93
- package/starters/chrome/docs/fr/LICENSE.md +0 -31
- package/starters/chrome/docs/fr/README.md +0 -93
- package/starters/chrome/docs/hi/LICENSE.md +0 -31
- package/starters/chrome/docs/hi/README.md +0 -93
- package/starters/chrome/docs/hi/SECURITY.md +0 -17
- package/starters/chrome/docs/it/LICENSE.md +0 -29
- package/starters/chrome/docs/it/README.md +0 -93
- package/starters/chrome/docs/ja/LICENSE.md +0 -31
- package/starters/chrome/docs/ja/README.md +0 -93
- package/starters/chrome/docs/ko/LICENSE.md +0 -34
- package/starters/chrome/docs/ko/README.md +0 -93
- package/starters/chrome/docs/nl/LICENSE.md +0 -31
- package/starters/chrome/docs/nl/README.md +0 -93
- package/starters/chrome/docs/pt/LICENSE.md +0 -31
- package/starters/chrome/docs/pt/README.md +0 -93
- package/starters/chrome/docs/vi/LICENSE.md +0 -31
- package/starters/chrome/docs/vi/README.md +0 -93
- package/starters/chrome/docs/zh-cn/LICENSE.md +0 -31
- package/starters/chrome/docs/zh-cn/README.md +0 -93
- package/starters/chrome/docs/zh-cn/SECURITY.md +0 -17
- package/starters/chrome/docs/zh-tw/LICENSE.md +0 -31
- package/starters/chrome/docs/zh-tw/README.md +0 -93
- package/starters/docs/de/LICENSE.md +0 -13
- package/starters/docs/de/README.md +0 -29
- package/starters/docs/es/LICENSE.md +0 -13
- package/starters/docs/es/README.md +0 -29
- package/starters/docs/fr/LICENSE.md +0 -13
- package/starters/docs/fr/README.md +0 -29
- package/starters/docs/hi/LICENSE.md +0 -13
- package/starters/docs/hi/README.md +0 -29
- package/starters/docs/it/LICENSE.md +0 -11
- package/starters/docs/it/README.md +0 -29
- package/starters/docs/ja/LICENSE.md +0 -13
- package/starters/docs/ja/README.md +0 -30
- package/starters/docs/ko/LICENSE.md +0 -16
- package/starters/docs/ko/README.md +0 -29
- package/starters/docs/nl/LICENSE.md +0 -13
- package/starters/docs/nl/README.md +0 -29
- package/starters/docs/pt/LICENSE.md +0 -13
- package/starters/docs/pt/README.md +0 -29
- package/starters/docs/vi/LICENSE.md +0 -13
- package/starters/docs/vi/README.md +0 -29
- package/starters/docs/zh-cn/LICENSE.md +0 -13
- package/starters/docs/zh-cn/README.md +0 -30
- package/starters/docs/zh-tw/LICENSE.md +0 -13
- package/starters/docs/zh-tw/README.md +0 -29
- package/starters/greasemonkey/docs/de/LICENSE.md +0 -31
- package/starters/greasemonkey/docs/es/LICENSE.md +0 -31
- package/starters/greasemonkey/docs/fr/LICENSE.md +0 -31
- package/starters/greasemonkey/docs/hi/LICENSE.md +0 -31
- package/starters/greasemonkey/docs/hi/SECURITY.md +0 -17
- package/starters/greasemonkey/docs/it/LICENSE.md +0 -29
- package/starters/greasemonkey/docs/ja/LICENSE.md +0 -31
- package/starters/greasemonkey/docs/ko/LICENSE.md +0 -34
- package/starters/greasemonkey/docs/nl/LICENSE.md +0 -31
- package/starters/greasemonkey/docs/pt/LICENSE.md +0 -31
- package/starters/greasemonkey/docs/vi/LICENSE.md +0 -31
- package/starters/greasemonkey/docs/zh-cn/LICENSE.md +0 -31
- package/starters/greasemonkey/docs/zh-cn/SECURITY.md +0 -17
- package/starters/greasemonkey/docs/zh-tw/LICENSE.md +0 -31
package/docs/README.md
CHANGED
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
[](https://sonarcloud.io/component_measures?metric=new_vulnerabilities&id=kudoai_chatgpt.js)
|
|
51
51
|
[](https://github.com/sindresorhus/awesome-chatgpt#javascript)
|
|
52
52
|
[](https://www.producthunt.com/posts/chatgpt-js)
|
|
53
|
-
|
|
53
|
+

|
|
54
54
|
|
|
55
55
|
</div>
|
|
56
56
|
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
|
|
84
84
|
```js
|
|
85
85
|
(async () => {
|
|
86
|
-
await import('https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.
|
|
86
|
+
await import('https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.9/dist/chatgpt.min.js');
|
|
87
87
|
// Your code here...
|
|
88
88
|
})();
|
|
89
89
|
```
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
|
|
93
93
|
```js
|
|
94
94
|
var xhr = new XMLHttpRequest();
|
|
95
|
-
xhr.open('GET', 'https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.
|
|
95
|
+
xhr.open('GET', 'https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.9/dist/chatgpt.min.js');
|
|
96
96
|
xhr.onload = function () {
|
|
97
97
|
if (xhr.status === 200) {
|
|
98
98
|
var chatgptJS = document.createElement('script');
|
|
@@ -114,7 +114,7 @@ function yourCode() {
|
|
|
114
114
|
|
|
115
115
|
```js
|
|
116
116
|
...
|
|
117
|
-
// @require https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.
|
|
117
|
+
// @require https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.9/dist/chatgpt.min.js
|
|
118
118
|
// ==/UserScript==
|
|
119
119
|
|
|
120
120
|
// Your code here...
|
|
@@ -210,13 +210,6 @@ https://github.com/KudoAI/chatgpt.js/assets/10906554/f53c740f-d5e0-49b6-ae02-3b3
|
|
|
210
210
|
[Readme](https://github.com/adamlui/autoclear-chatgpt-history#readme) /
|
|
211
211
|
[Discuss](https://autoclearchatgpt.com/discuss)
|
|
212
212
|
|
|
213
|
-
### <img width=16 src="https://i.imgur.com/1yjmK3W.png"> [Automatic ChatGPT DAN](https://github.com/madkarmaa/automatic-chatgpt-dan)
|
|
214
|
-
|
|
215
|
-
> Automatically send DAN prompts to ChatGPT.
|
|
216
|
-
<br>[Install](https://github.com/madkarmaa/automatic-chatgpt-dan#%EF%B8%8F-installation) /
|
|
217
|
-
[Readme](https://github.com/madkarmaa/automatic-chatgpt-dan#readme) /
|
|
218
|
-
[Discuss](https://github.com/madkarmaa/automatic-chatgpt-dan/issues)
|
|
219
|
-
|
|
220
213
|
### <img src="https://media.bravegpt.com/images/icons/bravegpt/icon48.png" width=18> [BraveGPT](https://bravegpt.com) <a href="https://www.producthunt.com/posts/bravegpt?utm_source=badge-featured&utm_medium=badge&utm_souce=badge-bravegpt" target="_blank" rel="noopener"><img src="https://api.producthunt.com/widgets/embed-image/v1/featured.svg?post_id=385630&theme=light" style="width: 112px; height: 24px; margin:0 0 -4px 5px;" width="112" height="24" /></a>
|
|
221
214
|
|
|
222
215
|
> Display ChatGPT answers in Brave Search sidebar (powered by GPT-4!)
|
|
@@ -303,7 +296,8 @@ This library exists thanks to code, translations, issues & ideas from the follow
|
|
|
303
296
|
[](https://github.com/philly88r)
|
|
304
297
|
[](https://github.com/thomasgauthier)
|
|
305
298
|
[](https://github.com/pranav-bhatt)
|
|
306
|
-
[](https://github.com/hopana)
|
|
300
|
+
[](https://github.com/emtry)
|
|
307
301
|
[](https://github.com/Luwa-Tech)
|
|
308
302
|
[](https://github.com/dependabot)
|
|
309
303
|
[](https://chat.openai.com)
|
|
@@ -340,6 +334,6 @@ This library exists thanks to code, translations, issues & ideas from the follow
|
|
|
340
334
|
**[Releases](https://www.npmjs.com/package/@kudoai/chatgpt.js?activeTab=versions)** /
|
|
341
335
|
[Userguide](https://github.com/KudoAI/chatgpt.js/blob/main/docs/USERGUIDE.md) /
|
|
342
336
|
[Discuss](https://github.com/KudoAI/chatgpt.js/discussions) /
|
|
343
|
-
<a href="
|
|
337
|
+
<a href="#--------------------------------------------------------------------------------english---------简体中文---------繁體中文---------日本---------한국인---------हिंदी---------नेपाली---------deutsch---------español---------français---------italiano---------nederlands---------português---------việt----">Back to top ↑</a>
|
|
344
338
|
|
|
345
339
|
</div>
|
package/docs/USERGUIDE.md
CHANGED
|
@@ -99,12 +99,7 @@
|
|
|
99
99
|
- [unminify `async`](#unminify-async)
|
|
100
100
|
- [write `async`](#write-async)
|
|
101
101
|
- [history `api`](#history-api)
|
|
102
|
-
- [isOn](#ison)
|
|
103
|
-
- [isOff](#isoff)
|
|
104
|
-
- [activate](#activate-1)
|
|
105
|
-
- [deactivate](#deactivate-1)
|
|
106
102
|
- [isLoaded](#isloaded-async-1)
|
|
107
|
-
- [toggle](#toggle)
|
|
108
103
|
- [instructions `api`](#instructions-api)
|
|
109
104
|
- [add `async`](#add-async)
|
|
110
105
|
- [clear `async`](#clear-async)
|
|
@@ -143,7 +138,7 @@
|
|
|
143
138
|
|
|
144
139
|
```js
|
|
145
140
|
(async () => {
|
|
146
|
-
await import('https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.
|
|
141
|
+
await import('https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.9/dist/chatgpt.min.js');
|
|
147
142
|
// Your code here...
|
|
148
143
|
})();
|
|
149
144
|
```
|
|
@@ -152,7 +147,7 @@
|
|
|
152
147
|
|
|
153
148
|
```js
|
|
154
149
|
var xhr = new XMLHttpRequest();
|
|
155
|
-
xhr.open('GET', 'https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.
|
|
150
|
+
xhr.open('GET', 'https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.9/dist/chatgpt.min.js');
|
|
156
151
|
xhr.onload = function () {
|
|
157
152
|
if (xhr.status === 200) {
|
|
158
153
|
var chatgptJS = document.createElement('script');
|
|
@@ -174,7 +169,7 @@ function yourCode() {
|
|
|
174
169
|
|
|
175
170
|
```js
|
|
176
171
|
...
|
|
177
|
-
// @require https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.
|
|
172
|
+
// @require https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.9/dist/chatgpt.min.js
|
|
178
173
|
// ==/UserScript==
|
|
179
174
|
|
|
180
175
|
// Your code here...
|
|
@@ -1450,50 +1445,6 @@ Example code:
|
|
|
1450
1445
|
|
|
1451
1446
|
API related to the chat history.
|
|
1452
1447
|
|
|
1453
|
-
### isOn
|
|
1454
|
-
|
|
1455
|
-
Returns a boolean value. `true` if the chat history is enabled, `false` otherwise.
|
|
1456
|
-
|
|
1457
|
-
Example code:
|
|
1458
|
-
|
|
1459
|
-
```js
|
|
1460
|
-
if (chatgpt.history.isOn()) {
|
|
1461
|
-
// Do something
|
|
1462
|
-
}
|
|
1463
|
-
```
|
|
1464
|
-
|
|
1465
|
-
### isOff
|
|
1466
|
-
|
|
1467
|
-
Returns a boolean value. `true` if the chat history is disabled, `false` otherwise.
|
|
1468
|
-
|
|
1469
|
-
Example code:
|
|
1470
|
-
|
|
1471
|
-
```js
|
|
1472
|
-
if (chatgpt.history.isOff()) {
|
|
1473
|
-
// Do something
|
|
1474
|
-
}
|
|
1475
|
-
```
|
|
1476
|
-
|
|
1477
|
-
### activate
|
|
1478
|
-
|
|
1479
|
-
Activates the chat history.
|
|
1480
|
-
|
|
1481
|
-
Example code:
|
|
1482
|
-
|
|
1483
|
-
```js
|
|
1484
|
-
chatgpt.history.activate();
|
|
1485
|
-
```
|
|
1486
|
-
|
|
1487
|
-
### deactivate
|
|
1488
|
-
|
|
1489
|
-
Deactivates the chat history.
|
|
1490
|
-
|
|
1491
|
-
Example code:
|
|
1492
|
-
|
|
1493
|
-
```js
|
|
1494
|
-
chatgpt.history.deactivate();
|
|
1495
|
-
```
|
|
1496
|
-
|
|
1497
1448
|
### isLoaded `async`
|
|
1498
1449
|
|
|
1499
1450
|
Resolves a promise when chat history has finished loading.
|
|
@@ -1507,16 +1458,6 @@ Example code:
|
|
|
1507
1458
|
})();
|
|
1508
1459
|
```
|
|
1509
1460
|
|
|
1510
|
-
### toggle
|
|
1511
|
-
|
|
1512
|
-
Toggles the chat history.
|
|
1513
|
-
|
|
1514
|
-
Example code:
|
|
1515
|
-
|
|
1516
|
-
```js
|
|
1517
|
-
chatgpt.history.toggle();
|
|
1518
|
-
```
|
|
1519
|
-
|
|
1520
1461
|
## instructions `api`
|
|
1521
1462
|
|
|
1522
1463
|
### add `async`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kudoai/chatgpt.js",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.9",
|
|
4
4
|
"description": "Client-side JavaScript library for ChatGPT",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "KudoAI & contributors",
|
|
@@ -13,17 +13,18 @@
|
|
|
13
13
|
"files": [
|
|
14
14
|
"chatgpt.js",
|
|
15
15
|
"dist/chatgpt.min.js",
|
|
16
|
-
"docs
|
|
17
|
-
"starters/"
|
|
16
|
+
"docs/*.md",
|
|
17
|
+
"starters/",
|
|
18
|
+
"!starters/**/docs/*/"
|
|
18
19
|
],
|
|
19
20
|
"scripts": {
|
|
20
|
-
"lint": "eslint . --
|
|
21
|
-
"lint:all": "eslint .
|
|
22
|
-
"lint:fix": "eslint . --
|
|
23
|
-
"lint:fix-all": "eslint . --
|
|
21
|
+
"lint": "eslint . --cache",
|
|
22
|
+
"lint:all": "eslint .",
|
|
23
|
+
"lint:fix": "eslint . --fix --cache",
|
|
24
|
+
"lint:fix-all": "eslint . --fix",
|
|
24
25
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
25
26
|
"preview:docs": "docsify serve docs",
|
|
26
|
-
"build:js": "
|
|
27
|
+
"build:js": "bash utils/build.sh",
|
|
27
28
|
"build:css": "scss-to-css",
|
|
28
29
|
"bump:patch": "bash utils/bump.sh patch",
|
|
29
30
|
"bump:minor": "bash utils/bump.sh minor",
|
|
@@ -62,12 +63,11 @@
|
|
|
62
63
|
"url": "https://github.com/sponsors/KudoAI"
|
|
63
64
|
},
|
|
64
65
|
"devDependencies": {
|
|
65
|
-
"@adamlui/minify.js": "^1.
|
|
66
|
-
"@adamlui/scss-to-css": "^1.
|
|
66
|
+
"@adamlui/minify.js": "^1.5.8",
|
|
67
|
+
"@adamlui/scss-to-css": "^1.8.3",
|
|
67
68
|
"docsify-cli": "^4.4.4",
|
|
68
|
-
"eslint": "^
|
|
69
|
+
"eslint": "^9.1.1",
|
|
69
70
|
"eslint-plugin-json-schema-validator": "^5.1.0",
|
|
70
|
-
"eslint-plugin-yml": "^1.14.0",
|
|
71
71
|
"husky": "^9.0.11"
|
|
72
72
|
}
|
|
73
73
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// © 2023–2024 KudoAI & contributors under the MIT license.
|
|
2
2
|
// Source: https://github.com/KudoAI/chatgpt.js
|
|
3
|
+
// User guide: https://chatgptjs.org/userguide
|
|
3
4
|
// Latest minified release: https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js/chatgpt.min.js
|
|
4
5
|
|
|
5
6
|
// Init endpoints
|
|
@@ -22,45 +23,12 @@ localStorage.notifyProps = JSON.stringify({
|
|
|
22
23
|
lastNthAudio: 0 // to prevent immediate repetition of base sound
|
|
23
24
|
});
|
|
24
25
|
|
|
25
|
-
// Init environment flags
|
|
26
|
-
const
|
|
27
|
-
isFFuserScript = navigator.userAgent.includes('Firefox') && typeof unsafeWindow != 'undefined',
|
|
26
|
+
// Init environment flags
|
|
27
|
+
const isFFuserScript = navigator.userAgent.includes('Firefox') && typeof unsafeWindow != 'undefined',
|
|
28
28
|
isFFtmScript = isFFuserScript && GM_info.scriptHandler == 'Tampermonkey';
|
|
29
29
|
|
|
30
|
-
// Define messages
|
|
31
|
-
let cjsMessages;
|
|
32
|
-
if (!isChromeUserScript && !(isFFuserScript && !isFFtmScript)) { (async () => {
|
|
33
|
-
const cjsMsgsLoaded = new Promise(resolve => {
|
|
34
|
-
const userLanguage = navigator.languages[0] || navigator.language || navigator.browserLanguage ||
|
|
35
|
-
navigator.systemLanguage || navigator.userLanguage || '',
|
|
36
|
-
msgHostDir = endpoints.assets + '/data/_locales/',
|
|
37
|
-
msgLocaleDir = ( userLanguage ? userLanguage.replace('-', '_') : 'en' ) + '/';
|
|
38
|
-
let msgHref = msgHostDir + msgLocaleDir + 'messages.json', msgXHRtries = 0;
|
|
39
|
-
(function loadMsgs() {
|
|
40
|
-
const xhr = new XMLHttpRequest();
|
|
41
|
-
xhr.open('GET', msgHref); xhr.send();
|
|
42
|
-
xhr.onload = () => {
|
|
43
|
-
try { // to return localized messages.json
|
|
44
|
-
const messages = new Proxy(JSON.parse(xhr.responseText), {
|
|
45
|
-
get(target, prop) { // remove need to ref nested keys
|
|
46
|
-
if (typeof target[prop] == 'object' && target[prop] !== null && 'message' in target[prop]) {
|
|
47
|
-
return target[prop].message;
|
|
48
|
-
}}}); resolve(messages);
|
|
49
|
-
} catch (err) {
|
|
50
|
-
msgXHRtries++; if (msgXHRtries === 3) resolve({}); // try up to 3X (original/region-stripped/EN) only
|
|
51
|
-
msgHref = userLanguage.includes('-') && msgXHRtries === 1 ? // if regional lang on 1st try...
|
|
52
|
-
msgHref.replace(/([^_]*)_[^/]*(\/.*)/, '$1$2') // ...strip region before retrying
|
|
53
|
-
: ( msgHostDir + 'en/messages.json' ); // else use default English messages
|
|
54
|
-
loadMsgs();
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
xhr.onerror = () => { resolve({}); };
|
|
58
|
-
})();
|
|
59
|
-
}); cjsMessages = await cjsMsgsLoaded;
|
|
60
|
-
})();}
|
|
61
|
-
|
|
62
30
|
// Define chatgpt.methods
|
|
63
|
-
const chatgpt = {
|
|
31
|
+
const chatgpt = { // eslint-disable-line no-redeclare
|
|
64
32
|
openAIaccessToken: {},
|
|
65
33
|
|
|
66
34
|
actAs: function(persona) {
|
|
@@ -236,7 +204,7 @@ const chatgpt = {
|
|
|
236
204
|
|
|
237
205
|
// Create close button
|
|
238
206
|
const closeBtn = document.createElement('div');
|
|
239
|
-
closeBtn.title =
|
|
207
|
+
closeBtn.title = 'Close'; closeBtn.classList.add('modal-close-btn');
|
|
240
208
|
const closeSVG = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
|
|
241
209
|
closeSVG.setAttribute('height', '10px');
|
|
242
210
|
closeSVG.setAttribute('viewBox', '0 0 14 14');
|
|
@@ -426,23 +394,17 @@ const chatgpt = {
|
|
|
426
394
|
|
|
427
395
|
if (method == 'dom') {
|
|
428
396
|
try { await chatgpt.getChatData(); } catch { return; } // check if chat history exists
|
|
429
|
-
chatgpt.menu.open();
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
if (/settings/i.test(menuItem.text)) { menuItem.click(); break; }
|
|
397
|
+
chatgpt.menu.open(); setTimeout(() => { // open settings
|
|
398
|
+
const settingsBtn = document.querySelector(
|
|
399
|
+
'a[role="menuitem"] svg path[d*="M11.6439 3C10.9352"]').parentNode.parentNode;
|
|
400
|
+
if (settingsBtn) settingsBtn.click();
|
|
434
401
|
setTimeout(() => { // clear chats
|
|
435
|
-
const settingsBtns = document.querySelectorAll('[id*=radix] button')
|
|
436
|
-
|
|
437
|
-
|
|
402
|
+
const settingsBtns = document.querySelectorAll('[id*=radix] button'),
|
|
403
|
+
deleteBtn = settingsBtns[settingsBtns.length - 1];
|
|
404
|
+
if (deleteBtn) deleteBtn.click();
|
|
438
405
|
setTimeout(() => { // confirm clear
|
|
439
|
-
document.querySelector('[
|
|
440
|
-
setTimeout(() => {
|
|
441
|
-
exitMenu();
|
|
442
|
-
try { document.querySelector('#prompt-textarea').focus(); } catch (err) {}
|
|
443
|
-
}, 10);
|
|
406
|
+
document.querySelector('button[class*="danger"').click();
|
|
444
407
|
}, 10); }, 333); }, 10);
|
|
445
|
-
const exitMenu = () => { document.querySelector('div[id*=radix] button').click(); };
|
|
446
408
|
|
|
447
409
|
} else { // API method
|
|
448
410
|
// NOTE: DOM is not updated to reflect new empty chat list (until session refresh)
|
|
@@ -835,7 +797,7 @@ const chatgpt = {
|
|
|
835
797
|
|
|
836
798
|
// Fill [userMessages]
|
|
837
799
|
for (const key in data)
|
|
838
|
-
if (
|
|
800
|
+
if (data[key].message != null && data[key].message.author.role == 'user')
|
|
839
801
|
userMessages.push({ id: data[key].id, msg: data[key].message });
|
|
840
802
|
userMessages.sort((a, b) => a.msg.create_time - b.msg.create_time); // sort in chronological order
|
|
841
803
|
|
|
@@ -847,7 +809,7 @@ const chatgpt = {
|
|
|
847
809
|
for (const userMessage of userMessages) {
|
|
848
810
|
let sub = [];
|
|
849
811
|
for (const key in data) {
|
|
850
|
-
if (
|
|
812
|
+
if (data[key].message != null && data[key].message.author.role == 'assistant' && data[key].parent == userMessage.id) {
|
|
851
813
|
sub.push(data[key].message);
|
|
852
814
|
}
|
|
853
815
|
}
|
|
@@ -944,17 +906,6 @@ const chatgpt = {
|
|
|
944
906
|
navigator.systemLanguage || navigator.userLanguage || ''; },
|
|
945
907
|
|
|
946
908
|
history: {
|
|
947
|
-
activate: function() { this.isOff() ? this.toggle() : console.info('Chat history is already enabled!'); },
|
|
948
|
-
deactivate: function() { this.isOn() ? this.toggle() : console.info('Chat history is already disabled!'); },
|
|
949
|
-
|
|
950
|
-
isOn: function() {
|
|
951
|
-
const navDivs = document.querySelectorAll('nav div'),
|
|
952
|
-
offDiv = [...navDivs].find(div => div.textContent.includes('Chat History is off')) || {};
|
|
953
|
-
return offDiv.classList.toString().includes('invisible');
|
|
954
|
-
},
|
|
955
|
-
|
|
956
|
-
isOff: function() { return !this.isOn(); },
|
|
957
|
-
|
|
958
909
|
isLoaded: function() {
|
|
959
910
|
return new Promise(resolve => {
|
|
960
911
|
const checkChatHistory = () => {
|
|
@@ -962,13 +913,7 @@ const chatgpt = {
|
|
|
962
913
|
else setTimeout(checkChatHistory, 100);
|
|
963
914
|
};
|
|
964
915
|
checkChatHistory();
|
|
965
|
-
});}
|
|
966
|
-
|
|
967
|
-
toggle: function() {
|
|
968
|
-
for (const navBtn of document.querySelectorAll('nav button')) {
|
|
969
|
-
if (/chat history/i.test(navBtn.textContent)) {
|
|
970
|
-
navBtn.click(); return;
|
|
971
|
-
}}}
|
|
916
|
+
});}
|
|
972
917
|
},
|
|
973
918
|
|
|
974
919
|
instructions: {
|
|
@@ -1239,7 +1184,7 @@ const chatgpt = {
|
|
|
1239
1184
|
|
|
1240
1185
|
// Create/append close button
|
|
1241
1186
|
const closeBtn = document.createElement('div');
|
|
1242
|
-
closeBtn.title =
|
|
1187
|
+
closeBtn.title = 'Dismiss'; closeBtn.classList.add('notif-close-btn');
|
|
1243
1188
|
const closeSVG = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
|
|
1244
1189
|
closeSVG.setAttribute('height', '8px');
|
|
1245
1190
|
closeSVG.setAttribute('viewBox', '0 0 14 14');
|
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
// @description A Greasemonkey template to start using chatgpt.js like a boss
|
|
4
4
|
// @author chatgpt.js
|
|
5
5
|
// @namespace https://chatgpt.js.org
|
|
6
|
-
// @version 2024.
|
|
6
|
+
// @version 2024.5.1
|
|
7
7
|
// @license MIT
|
|
8
8
|
// @match https://chat.openai.com/*
|
|
9
9
|
// @icon https://raw.githubusercontent.com/KudoAI/chatgpt.js-greasemonkey-starter/main/media/images/icons/robot/icon48.png
|
|
10
10
|
// @icon64 https://raw.githubusercontent.com/KudoAI/chatgpt.js-greasemonkey-starter/main/media/images/icons/robot/icon64.png
|
|
11
|
-
// @require https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.
|
|
11
|
+
// @require https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.9/dist/chatgpt.min.js
|
|
12
12
|
// @grant GM_getValue
|
|
13
13
|
// @grant GM_setValue
|
|
14
14
|
// @noframes
|
package/docs/de/LICENSE.md
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
<div align="center">
|
|
2
|
-
<h6>
|
|
3
|
-
<a href="../"><img height=15 style="margin: 0 3px -2px" src="https://raw.githubusercontent.com/KudoAI/chatgpt.js/6fa1659feadaf70853996dc7d7f6e1ab5a1e6301/media/images/icons/earth-americas.svg"></a>
|
|
4
|
-
Deutsch |
|
|
5
|
-
<a href="../../LICENSE.md">English</a> |
|
|
6
|
-
<a href="../zh-cn/LICENSE.md">简体中文</a> |
|
|
7
|
-
<a href="../zh-tw/LICENSE.md">繁體中文</a> |
|
|
8
|
-
<a href="../ja/LICENSE.md">日本</a> |
|
|
9
|
-
<a href="../ko/LICENSE.md">한국인</a> |
|
|
10
|
-
<a href="../hi/LICENSE.md">हिंदी</a> |
|
|
11
|
-
<a href="../ne/LICENSE.md">नेपाली</a> |
|
|
12
|
-
<a href="../es/LICENSE.md">Español</a> |
|
|
13
|
-
<a href="../fr/LICENSE.md">Français</a> |
|
|
14
|
-
<a href="../it/LICENSE.md">Italiano</a> |
|
|
15
|
-
<a href="../nl/LICENSE.md">Nederlands</a> |
|
|
16
|
-
<a href="../pt/LICENSE.md">Português</a> |
|
|
17
|
-
<a href="../vi/LICENSE.md">Việt</a>
|
|
18
|
-
</h6>
|
|
19
|
-
</div>
|
|
20
|
-
|
|
21
|
-
# MIT-Lizenz
|
|
22
|
-
|
|
23
|
-
Urheberrechte © 2023–2024 [KudoAI](https://github.com/KudoAI) & [Mitwirkende](.#-Mitwirkende)
|
|
24
|
-
|
|
25
|
-
Hiermit wird jeder Person, die eine Kopie erhält, kostenlos die Erlaubnis erteilt dieser Software und der zugehörigen Dokumentationsdateien (die „Software“) zu handeln an der Software ohne Einschränkung, einschließlich und ohne Einschränkung der Rechte zum Verwenden, Kopieren, Modifizieren, Zusammenführen, Veröffentlichen, Verteilen, Unterlizenzieren und/oder Verkaufen Kopien der Software zu erwerben und Personen zu gestatten, denen die Software gehört unter folgenden Bedingungen zur Verfügung gestellt:
|
|
26
|
-
|
|
27
|
-
Der obige Urheberrechtshinweis und dieser Genehmigungshinweis sind in allen Bestandteilen enthalten Kopien oder wesentliche Teile der Software.
|
|
28
|
-
|
|
29
|
-
DIE SOFTWARE WIRD „WIE BESEHEN“ ZUR VERFÜGUNG GESTELLT, OHNE JEGLICHE AUSDRÜCKLICHE ODER GEWÄHRLEISTUNG STILLSCHWEIGEND, EINSCHLIESSLICH, ABER NICHT BESCHRÄNKT AUF DIE GARANTIEN DER MARKTGÄNGIGKEIT, EIGNUNG FÜR EINEN BESTIMMTEN ZWECK UND NICHTVERLETZUNG. IN KEINEM FALL DÜRFEN DIE Die Autoren oder Urheberrechtsinhaber haften für Ansprüche, Schäden oder sonstiges HAFTUNG, SEI ES AUS EINEM VERTRAG, EINER HANDLUNG AUS VERLETZLICHER HANDLUNG ODER ANDERWEITIG, ENTSTEHEND AUS: AUS ODER IN VERBINDUNG MIT DER SOFTWARE ODER DER NUTZUNG ODER ANDEREN HANDELN IN DER SOFTWARE.
|