@kudoai/chatgpt.js 2.9.1 → 2.9.3
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 +54 -46
- package/chatgpt.js +28 -22
- package/dist/chatgpt.min.js +3 -3
- package/docs/README.md +54 -46
- package/docs/USERGUIDE.md +4 -4
- package/package.json +3 -2
- package/starters/chrome/docs/README.md +3 -3
- package/starters/chrome/extension/lib/chatgpt.js +28 -22
- package/starters/chrome/extension/manifest.json +1 -1
- package/starters/docs/README.md +2 -2
- package/starters/greasemonkey/chatgpt.js-greasemonkey-starter.user.js +4 -4
- package/starters/media/images/icons/tampermonkey-icon28.png +0 -0
- package/starters/media/images/icons/violentmonkey-icon100.png +0 -0
package/README.md
CHANGED
|
@@ -45,7 +45,8 @@
|
|
|
45
45
|
[](https://github.com/KudoAI/chatgpt.js/stargazers)
|
|
46
46
|
[](https://github.com/KudoAI/chatgpt.js/blob/main/LICENSE.md)
|
|
47
47
|
[](https://github.com/KudoAI/chatgpt.js/commits/main)
|
|
48
|
-
|
|
48
|
+

|
|
49
|
+
[](https://github.com/KudoAI/chatgpt.js/tree/v2.9.3/dist/chatgpt.min.js)
|
|
49
50
|
[](https://www.codefactor.io/repository/github/kudoai/chatgpt.js)
|
|
50
51
|
[](https://sonarcloud.io/component_measures?metric=new_vulnerabilities&id=kudoai_chatgpt.js)
|
|
51
52
|
[](https://github.com/sindresorhus/awesome-chatgpt#javascript)
|
|
@@ -83,7 +84,7 @@
|
|
|
83
84
|
|
|
84
85
|
```js
|
|
85
86
|
(async () => {
|
|
86
|
-
await import('https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.9.
|
|
87
|
+
await import('https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.9.3/dist/chatgpt.min.js');
|
|
87
88
|
// Your code here...
|
|
88
89
|
})();
|
|
89
90
|
```
|
|
@@ -92,7 +93,7 @@
|
|
|
92
93
|
|
|
93
94
|
```js
|
|
94
95
|
var xhr = new XMLHttpRequest();
|
|
95
|
-
xhr.open('GET', 'https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.9.
|
|
96
|
+
xhr.open('GET', 'https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.9.3/dist/chatgpt.min.js');
|
|
96
97
|
xhr.onload = function () {
|
|
97
98
|
if (xhr.status === 200) {
|
|
98
99
|
var chatgptJS = document.createElement('script');
|
|
@@ -108,19 +109,19 @@ function yourCode() {
|
|
|
108
109
|
}
|
|
109
110
|
```
|
|
110
111
|
|
|
111
|
-
### <img style="margin: 0 2px -0.065rem 0" height=17 src="https://
|
|
112
|
+
### <img style="margin: 0 2px -0.065rem 0" height=17 src="https://media.chatgptjs.org/images/icons/platforms/tampermonkey/icon28.png?a3e53bf7"><img style="margin: 0 2px -0.035rem 1px" height=17.5 src="https://media.chatgptjs.org/images/icons/platforms/violentmonkey/icon25.png?a3e53bf7"> Greasemonkey:
|
|
112
113
|
|
|
113
114
|
> **Note** _To use a starter template: [kudoai/chatgpt.js-greasemonkey-starter](https://github.com/KudoAI/chatgpt.js-greasemonkey-starter)_
|
|
114
115
|
|
|
115
116
|
```js
|
|
116
117
|
...
|
|
117
|
-
// @require https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.9.
|
|
118
|
+
// @require https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.9.3/dist/chatgpt.min.js
|
|
118
119
|
// ==/UserScript==
|
|
119
120
|
|
|
120
121
|
// Your code here...
|
|
121
122
|
```
|
|
122
123
|
|
|
123
|
-
### <img style="margin: 0 2px -1px 0" height=16 src="https://
|
|
124
|
+
### <img style="margin: 0 2px -1px 0" height=16 src="https://media.chatgptjs.org/images/icons/platforms/chrome/icon16.png?8c852fa5"> Chrome:
|
|
124
125
|
|
|
125
126
|
> **Note** _To use a starter template: [kudoai/chatgpt.js-chrome-starter](https://github.com/KudoAI/chatgpt.js-chrome-starter)_
|
|
126
127
|
|
|
@@ -189,7 +190,7 @@ chatgpt.get('reply', 'last');
|
|
|
189
190
|
|
|
190
191
|
Each call equally fetches the last response. If you think it works, it probably will... so just type it!
|
|
191
192
|
|
|
192
|
-
If it didn't, check out the extended [userguide](https://github.com/KudoAI/chatgpt.js/blob/v2.9.
|
|
193
|
+
If it didn't, check out the extended [userguide](https://github.com/KudoAI/chatgpt.js/blob/v2.9.3/docs/USERGUIDE.md), or simply submit an [issue](https://github.com/KudoAI/chatgpt.js/issues) or [PR](https://github.com/KudoAI/chatgpt.js/pulls) and it will be integrated, ezpz!
|
|
193
194
|
|
|
194
195
|
<img height=8px width="100%" src="https://media.chatgptjs.org/images/separators/gradient-aqua.png?78210a7">
|
|
195
196
|
|
|
@@ -203,58 +204,65 @@ https://github.com/KudoAI/chatgpt.js/assets/10906554/f53c740f-d5e0-49b6-ae02-3b3
|
|
|
203
204
|
|
|
204
205
|
#
|
|
205
206
|
|
|
206
|
-
### <picture><source media="(prefers-color-scheme: dark)" srcset="https://
|
|
207
|
+
### <picture><source type="image/png" media="(prefers-color-scheme: dark)" srcset="https://media.autoclearchatgpt.com/images/icons/openai/white/icon48.png?cece513"><img width=21 src="https://media.autoclearchatgpt.com/images/icons/openai/black/icon48.png?cece513"></picture> [Autoclear ChatGPT History](https://autoclearchatgpt.com) <a href="https://github.com/awesome-scripts/awesome-userscripts#chatgpt" target="_blank" rel="noopener"><img src="https://media.autoclearchatgpt.com/images/badges/awesome/badge.svg?2c0d9fc" style="margin:0 0 -2px 5px"></a>
|
|
207
208
|
|
|
208
209
|
> Auto-clear your ChatGPT query history for maximum privacy.
|
|
209
210
|
<br>[Install](https://docs.autoclearchatgpt.com/#-installation) /
|
|
210
211
|
[Readme](https://docs.autoclearchatgpt.com/#readme) /
|
|
211
212
|
[Discuss](https://github.autoclearchatgpt.com/discussions)
|
|
212
213
|
|
|
213
|
-
### <img src="https://media.bravegpt.com/images/icons/bravegpt/icon48.png"
|
|
214
|
+
### <img width=24 src="https://media.bravegpt.com/images/icons/bravegpt/icon48.png?0a9e287"> [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>
|
|
214
215
|
|
|
215
216
|
> Display ChatGPT answers in Brave Search sidebar (powered by GPT-4!)
|
|
216
217
|
<br>[Install](https://docs.bravegpt.com/#-installation) /
|
|
217
218
|
[Readme](https://docs.bravegpt.com/#readme) /
|
|
218
219
|
[Discuss](https://github.bravegpt.com/discussions)
|
|
219
220
|
|
|
220
|
-
### <picture><source media="(prefers-color-scheme: dark)" srcset="https://
|
|
221
|
+
### <picture><source type="image/png" media="(prefers-color-scheme: dark)" srcset="https://media.chatgptautocontinue.com/images/icons/openai/white/icon48.png?7bbd222"><img width=21 src="https://media.chatgptautocontinue.com/images/icons/openai/black/icon48.png?7bbd222"></picture> [ChatGPT Auto-Continue ⏩](https://chatgptautocontinue.com) <a href="https://github.com/awesome-scripts/awesome-userscripts#chatgpt" target="_blank" rel="noopener"><img src="https://media.chatgptautocontinue.com/images/badges/awesome/badge.svg?3c80c0c" style="margin:0 0 -3px 3px"></a>
|
|
221
222
|
|
|
222
223
|
> Automatically continue generating multiple ChatGPT responses.
|
|
223
224
|
<br>[Install](https://docs.chatgptautocontinue.com/#-installation) /
|
|
224
225
|
[Readme](https://docs.chatgptautocontinue.com/#readme) /
|
|
225
226
|
[Discuss](https://github.chatgptautocontinue.com/discussions)
|
|
226
227
|
|
|
227
|
-
### <picture><source media="(prefers-color-scheme: dark)" srcset="https://
|
|
228
|
+
### <picture><source type="image/png" media="(prefers-color-scheme: dark)" srcset="https://media.chatgptautorefresh.com/images/icons/openai/white/icon48.png?a45cf1e"><img width=21 src="https://media.chatgptautorefresh.com/images/icons/openai/black/icon48.png?a45cf1e"></picture> [ChatGPT Auto Refresh ↻](https://chatgptautorefresh.com) <a href="https://github.com/awesome-scripts/awesome-userscripts#chatgpt" target="_blank" rel="noopener"><img src="https://media.chatgptautorefresh.com/images/badges/awesome/badge.svg?1080f44" style="margin:0 0 -2px 5px"></a>
|
|
228
229
|
|
|
229
230
|
> Keeps ChatGPT sessions fresh to eliminate network errors + Cloudflare checks.
|
|
230
231
|
<br>[Install](https://docs.chatgptautorefresh.com/#-installation) /
|
|
231
232
|
[Readme](https://docs.chatgptautorefresh.com/#readme) /
|
|
232
233
|
[Discuss](https://github.chatgptautorefresh.com/discussions)
|
|
233
234
|
|
|
234
|
-
### <img src="https://media.ddgpt.com/images/icons/duckduckgpt/icon48.png"
|
|
235
|
+
### <img width=23 src="https://media.ddgpt.com/images/icons/duckduckgpt/icon48.png?af89302"> [DuckDuckGPT](https://duckduckgpt.com) <a href="https://www.producthunt.com/posts/duckduckgpt?utm_source=badge-featured&utm_medium=badge&utm_souce=badge-duckduckgpt" target="_blank" rel="noopener"><img src="https://api.producthunt.com/widgets/embed-image/v1/featured.svg?post_id=379261&theme=light" style="width: 112px; height: 24px; margin:0 0 -4px 5px;" width="112" height="24" /></a>
|
|
235
236
|
|
|
236
237
|
> Display ChatGPT answers in DuckDuckGo sidebar (powered by GPT-4!)
|
|
237
238
|
<br>[Install](https://docs.ddgpt.com/#-installation) /
|
|
238
239
|
[Readme](https://docs.ddgpt.com/#readme) /
|
|
239
240
|
[Discuss](https://github.ddgpt.com/discussions)
|
|
240
241
|
|
|
241
|
-
### <picture><source media="(prefers-color-scheme: dark)" srcset="https://media.googlegpt.io/images/icons/googlegpt/white/icon32.png"><img width=
|
|
242
|
+
### <picture><source type="image/png" media="(prefers-color-scheme: dark)" srcset="https://media.googlegpt.io/images/icons/googlegpt/white/icon32.png?8652a6e"><img width=21 src="https://media.googlegpt.io/images/icons/googlegpt/black/icon32.png?8652a6e"></picture> [GoogleGPT](https://googlegpt.io) <a href="https://github.com/awesome-scripts/awesome-userscripts#chatgpt" target="_blank" rel="noopener"><img src="https://media.googlegpt.io/images/badges/awesome/badge.svg?699c63d" style="margin:0 0 -2px 5px"></a>
|
|
242
243
|
|
|
243
244
|
> Display ChatGPT answers in Google Search sidebar (powered by GPT-4!)
|
|
244
245
|
<br>[Install](https://greasyfork.org/scripts/478597-googlegpt) /
|
|
245
246
|
[Readme](https://docs.googlegpt.io/#readme) /
|
|
246
247
|
[Discuss](https://github.googlegpt.io/discussions)
|
|
247
248
|
|
|
249
|
+
### <img width=23 src="https://media.chatgptjs.org/images/icons/platforms/thunderbird/icon32.png?313a9c5"> [ThunderAI](https://micz.it/thunderdbird-addon-thunderai/)
|
|
250
|
+
|
|
251
|
+
> Use ChatGPT in Thunderbird to enhance you emails, even with a free account!
|
|
252
|
+
<br>[Install](https://addons.thunderbird.net/thunderbird/addon/thunderai/) /
|
|
253
|
+
[Readme](https://micz.it/thunderdbird-addon-thunderai/) /
|
|
254
|
+
[Support](https://github.com/micz/ThunderAI/issues)
|
|
255
|
+
|
|
248
256
|
<p><br>
|
|
249
257
|
|
|
250
258
|
<a href="https://chatgptinfinity.com" target="_blank" rel="noopener">
|
|
251
|
-
<img width=555 src="https://
|
|
259
|
+
<img width=555 src="https://cdn.jsdelivr.net/gh/adamlui/chatgpt-infinity@0f48c4e/chrome/media/images/tiles/marquee-promo-tile-1400x560.png">
|
|
252
260
|
</a>
|
|
253
261
|
|
|
254
262
|
<p><br>
|
|
255
263
|
|
|
256
264
|
<a href="https://chatgptwidescreen.com" target="_blank" rel="noopener">
|
|
257
|
-
<img width=555 src="https://
|
|
265
|
+
<img width=555 src="https://cdn.jsdelivr.net/gh/adamlui/chatgpt-widescreen@3ed0950/chrome/media/images/tiles/marquee-promo-tile-1400x560.png">
|
|
258
266
|
</a>
|
|
259
267
|
|
|
260
268
|
<p><br>
|
|
@@ -275,36 +283,36 @@ This library exists thanks to code, translations, issues & ideas from the follow
|
|
|
275
283
|
|
|
276
284
|
<div align="center"><br>
|
|
277
285
|
|
|
278
|
-
[" srcset="https://images.weserv.nl/?url=https://cdn.jsdelivr.net/gh/KudoAI/chatgpt.js@main/media/images/icons/platforms/chatgpt/black-on-white/icon189.png?h=
|
|
307
|
-
<a href="https://poe.com"><picture><source media="(prefers-color-scheme: dark)" srcset="https://images.weserv.nl/?url=https://cdn.jsdelivr.net/gh/KudoAI/chatgpt.js@main/media/images/icons/platforms/poe/w-purple-blue-stripes/black-on-white/icon175.png?h=
|
|
286
|
+
[](https://github.com/adamlui)
|
|
287
|
+
[](https://github.com/mefengl)
|
|
288
|
+
[](https://github.com/Zin6969)
|
|
289
|
+
[](https://github.com/madruga8)
|
|
290
|
+
[](https://github.com/XiaoYingYo)
|
|
291
|
+
[](https://github.com/AliAlSarre)
|
|
292
|
+
[](https://github.com/madkarmaa)
|
|
293
|
+
[](https://github.com/wamoyo)
|
|
294
|
+
[](https://github.com/meiraleal)
|
|
295
|
+
[](https://github.com/eltociear)
|
|
296
|
+
[](https://github.com/Rojojun)
|
|
297
|
+
[](https://github.com/iamnishantgaharwar)
|
|
298
|
+
[](https://github.com/hakimel)
|
|
299
|
+
[](https://github.com/omahs)
|
|
300
|
+
[](https://www.linkedin.com/in/najam-ul-arfeen-khan/)
|
|
301
|
+
[](https://github.com/iambijayd)
|
|
302
|
+
[](https://github.com/abhinavm24)
|
|
303
|
+
[](https://github.com/deyvisml)
|
|
304
|
+
[](https://github.com/philly88r)
|
|
305
|
+
[](https://github.com/thomasgauthier)
|
|
306
|
+
[](https://github.com/pranav-bhatt)
|
|
307
|
+
[](https://github.com/hopana)
|
|
308
|
+
[](https://github.com/emtry)
|
|
309
|
+
[](https://github.com/thedayofcondor)
|
|
310
|
+
[](https://github.com/Luwa-Tech)
|
|
311
|
+
[](https://github.com/micz)
|
|
312
|
+
[](https://github.com/imranaalam)
|
|
313
|
+
[](https://github.com/dependabot)
|
|
314
|
+
<a href="https://chatgpt.com"><picture><source type="image/png" media="(prefers-color-scheme: dark)" srcset="https://images.weserv.nl/?url=https://cdn.jsdelivr.net/gh/KudoAI/chatgpt.js@main/media/images/icons/platforms/chatgpt/black-on-white/icon189.png?h=46&w=46&mask=circle&maxage=7d"><img src="https://images.weserv.nl/?url=https://cdn.jsdelivr.net/gh/KudoAI/chatgpt.js@main/media/images/icons/platforms/chatgpt/white-on-black/icon189.png?h=46&w=46&mask=circle&maxage=7d" title="ChatGPT"></picture></a>
|
|
315
|
+
<a href="https://poe.com"><picture><source type="image/png" media="(prefers-color-scheme: dark)" srcset="https://images.weserv.nl/?url=https://cdn.jsdelivr.net/gh/KudoAI/chatgpt.js@main/media/images/icons/platforms/poe/w-purple-blue-stripes/black-on-white/icon175.png?h=46&w=46&mask=circle&maxage=7d"><img src="https://images.weserv.nl/?url=https://cdn.jsdelivr.net/gh/KudoAI/chatgpt.js@main/media/images/icons/platforms/poe/w-purple-blue-stripes/white-on-black/icon175.png?h=46&w=46&mask=circle&maxage=7d" title="Poe"></picture></a>
|
|
308
316
|
[](https://github.com/ImgBotApp)
|
|
309
317
|
|
|
310
318
|
</div><br>
|
|
@@ -335,7 +343,7 @@ This library exists thanks to code, translations, issues & ideas from the follow
|
|
|
335
343
|
<div align="center">
|
|
336
344
|
|
|
337
345
|
**[Releases](https://github.com/KudoAI/chatgpt.js/releases)** /
|
|
338
|
-
[Userguide](https://github.com/KudoAI/chatgpt.js/blob/v2.9.
|
|
346
|
+
[Userguide](https://github.com/KudoAI/chatgpt.js/blob/v2.9.3/docs/USERGUIDE.md) /
|
|
339
347
|
[Discuss](https://github.com/KudoAI/chatgpt.js/discussions) /
|
|
340
348
|
<a href="#--------------------------------------------------------------------------------english---------简体中文---------繁體中文---------日本---------한국인---------हिंदी---------नेपाली---------deutsch---------español---------français---------italiano---------nederlands---------português---------việt----">Back to top ↑</a>
|
|
341
349
|
|
package/chatgpt.js
CHANGED
|
@@ -147,7 +147,7 @@ const chatgpt = { // eslint-disable-line no-redeclare
|
|
|
147
147
|
|
|
148
148
|
// Insert text into elements
|
|
149
149
|
modalTitle.innerText = title || '';
|
|
150
|
-
modalMessage.innerText = msg || '';
|
|
150
|
+
modalMessage.innerText = msg || ''; chatgpt.renderHTML(modalMessage);
|
|
151
151
|
|
|
152
152
|
// Create/append buttons (if provided) to buttons div
|
|
153
153
|
const modalButtons = document.createElement('div');
|
|
@@ -400,7 +400,7 @@ const chatgpt = { // eslint-disable-line no-redeclare
|
|
|
400
400
|
} catch (err) {
|
|
401
401
|
console.error(err.message);
|
|
402
402
|
if (arguments.length == 0) {
|
|
403
|
-
console.info('Using backend API method instead.');
|
|
403
|
+
console.info('Using backend API method instead.'); chatgpt.clearChats('api'); }
|
|
404
404
|
}
|
|
405
405
|
|
|
406
406
|
} else { // API method
|
|
@@ -497,7 +497,7 @@ const chatgpt = { // eslint-disable-line no-redeclare
|
|
|
497
497
|
}
|
|
498
498
|
},
|
|
499
499
|
|
|
500
|
-
continue: function() {
|
|
500
|
+
continue: function() { chatgpt.response.continue(); },
|
|
501
501
|
|
|
502
502
|
detectLanguage: async function(text) {
|
|
503
503
|
if (!text) return console.error('Text argument not supplied. Pass some text!');
|
|
@@ -869,7 +869,8 @@ const chatgpt = { // eslint-disable-line no-redeclare
|
|
|
869
869
|
|
|
870
870
|
getNewChatButton: function() {
|
|
871
871
|
for (const navBtnSVG of document.querySelectorAll('nav button svg'))
|
|
872
|
-
if (navBtnSVG.querySelector('path[d*="M15.673 3.913a3.121"]'
|
|
872
|
+
if (navBtnSVG.querySelector('path[d*="M15.673 3.913a3.121"], ' // pencil-on-pad icon
|
|
873
|
+
+ 'path[d*="M3.07 10.876C3.623"]')) // refresh icon if temp chat
|
|
873
874
|
return navBtnSVG.parentNode;
|
|
874
875
|
},
|
|
875
876
|
|
|
@@ -917,7 +918,7 @@ const chatgpt = { // eslint-disable-line no-redeclare
|
|
|
917
918
|
return new Promise(resolve => {
|
|
918
919
|
(function checkChatHistory() {
|
|
919
920
|
if (document.querySelector('nav')) resolve(true);
|
|
920
|
-
else setTimeout(checkChatHistory,
|
|
921
|
+
else setTimeout(checkChatHistory, 200);
|
|
921
922
|
})();
|
|
922
923
|
});}
|
|
923
924
|
},
|
|
@@ -1056,7 +1057,7 @@ const chatgpt = { // eslint-disable-line no-redeclare
|
|
|
1056
1057
|
return new Promise(resolve => {
|
|
1057
1058
|
(function checkIsIdle() {
|
|
1058
1059
|
if (chatgpt.getRegenerateButton()) resolve(true);
|
|
1059
|
-
else setTimeout(checkIsIdle,
|
|
1060
|
+
else setTimeout(checkIsIdle, 200);
|
|
1060
1061
|
})();
|
|
1061
1062
|
});},
|
|
1062
1063
|
|
|
@@ -1064,7 +1065,7 @@ const chatgpt = { // eslint-disable-line no-redeclare
|
|
|
1064
1065
|
return new Promise(resolve => {
|
|
1065
1066
|
(function checkIsLoaded() {
|
|
1066
1067
|
if (chatgpt.getNewChatButton()) resolve(true);
|
|
1067
|
-
else setTimeout(checkIsLoaded,
|
|
1068
|
+
else setTimeout(checkIsLoaded, 200);
|
|
1068
1069
|
})();
|
|
1069
1070
|
});},
|
|
1070
1071
|
|
|
@@ -1367,9 +1368,9 @@ const chatgpt = { // eslint-disable-line no-redeclare
|
|
|
1367
1368
|
nodeContent = node.childNodes;
|
|
1368
1369
|
|
|
1369
1370
|
// Preserve consecutive spaces + line breaks
|
|
1370
|
-
if (!
|
|
1371
|
-
node.style.whiteSpace = 'pre-wrap';
|
|
1372
|
-
setTimeout(() => {
|
|
1371
|
+
if (!chatgpt.renderHTML.preWrapSet) {
|
|
1372
|
+
node.style.whiteSpace = 'pre-wrap'; chatgpt.renderHTML.preWrapSet = true;
|
|
1373
|
+
setTimeout(() => { chatgpt.renderHTML.preWrapSet = false; }, 100);
|
|
1373
1374
|
}
|
|
1374
1375
|
|
|
1375
1376
|
// Process child nodes
|
|
@@ -1393,7 +1394,7 @@ const chatgpt = { // eslint-disable-line no-redeclare
|
|
|
1393
1394
|
tagNode.setAttribute(name, value);
|
|
1394
1395
|
});
|
|
1395
1396
|
|
|
1396
|
-
const renderedNode =
|
|
1397
|
+
const renderedNode = chatgpt.renderHTML(tagNode); // render child elements of newly created node
|
|
1397
1398
|
|
|
1398
1399
|
// Insert newly rendered node
|
|
1399
1400
|
const beforeTextNode = document.createTextNode(text.substring(0, elem.index)),
|
|
@@ -1406,7 +1407,7 @@ const chatgpt = { // eslint-disable-line no-redeclare
|
|
|
1406
1407
|
}
|
|
1407
1408
|
|
|
1408
1409
|
// Process element nodes recursively
|
|
1409
|
-
} else if (childNode.nodeType == Node.ELEMENT_NODE)
|
|
1410
|
+
} else if (childNode.nodeType == Node.ELEMENT_NODE) chatgpt.renderHTML(childNode);
|
|
1410
1411
|
}
|
|
1411
1412
|
|
|
1412
1413
|
return node; // if assignment used
|
|
@@ -1485,7 +1486,7 @@ const chatgpt = { // eslint-disable-line no-redeclare
|
|
|
1485
1486
|
for (let i = 0; i < arguments.length; i++) if (typeof arguments[i] !== 'string')
|
|
1486
1487
|
return console.error(`Argument ${ i + 1 } must be a string!`);
|
|
1487
1488
|
const textArea = document.querySelector('form textarea'),
|
|
1488
|
-
sendBtn =
|
|
1489
|
+
sendBtn = chatgpt.getSendButton();
|
|
1489
1490
|
textArea.value = msg;
|
|
1490
1491
|
textArea.dispatchEvent(new Event('input', { bubbles: true })); // enable send button
|
|
1491
1492
|
|
|
@@ -1761,17 +1762,22 @@ const chatgpt = { // eslint-disable-line no-redeclare
|
|
|
1761
1762
|
if (isToggleBtn(btn)) { btn.click(); return; }
|
|
1762
1763
|
},
|
|
1763
1764
|
|
|
1764
|
-
isLoaded: function() {
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1765
|
+
isLoaded: async function() {
|
|
1766
|
+
await chatgpt.isLoaded();
|
|
1767
|
+
return Promise.race([
|
|
1768
|
+
new Promise(resolve => {
|
|
1769
|
+
(function checkNewChatLink() {
|
|
1770
|
+
if (chatgpt.getNewChatLink()) resolve(true);
|
|
1771
|
+
else setTimeout(checkNewChatLink, 200);
|
|
1772
|
+
})();
|
|
1773
|
+
}),
|
|
1774
|
+
new Promise(resolve => setTimeout(resolve, 5000)) // since New Chat link not always present
|
|
1775
|
+
]);
|
|
1776
|
+
}
|
|
1771
1777
|
},
|
|
1772
1778
|
|
|
1773
|
-
startNewChat: function() { try {
|
|
1774
|
-
stop: function() {
|
|
1779
|
+
startNewChat: function() { try { chatgpt.getNewChatBtn().click(); } catch (err) { console.error(err.message); }},
|
|
1780
|
+
stop: function() { chatgpt.response.stopGenerating(); },
|
|
1775
1781
|
|
|
1776
1782
|
suggest: async function(ideaType, details) {
|
|
1777
1783
|
if (!ideaType) return console.error('ideaType (1st argument) not supplied'
|