@kudoai/chatgpt.js 3.3.3 → 3.3.4
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
CHANGED
|
@@ -44,9 +44,7 @@
|
|
|
44
44
|
|
|
45
45
|
[](https://github.com/KudoAI/chatgpt.js/stargazers)
|
|
46
46
|
[](https://github.com/KudoAI/chatgpt.js/blob/main/LICENSE.md)
|
|
47
|
-
[
|
|
49
|
-
[](https://github.com/KudoAI/chatgpt.js/tree/v3.3.3/dist/chatgpt.min.js)
|
|
47
|
+
[](https://github.com/KudoAI/chatgpt.js/tree/v3.3.4/dist/chatgpt.min.js)
|
|
50
48
|
[](https://www.codefactor.io/repository/github/kudoai/chatgpt.js)
|
|
51
49
|
[](https://sonarcloud.io/component_measures?metric=new_vulnerabilities&id=kudoai_chatgpt.js)
|
|
52
50
|
[](https://github.com/sindresorhus/awesome-chatgpt#javascript)
|
|
@@ -84,7 +82,7 @@
|
|
|
84
82
|
|
|
85
83
|
```js
|
|
86
84
|
(async () => {
|
|
87
|
-
await import('https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@3.3.
|
|
85
|
+
await import('https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@3.3.4/dist/chatgpt.min.js');
|
|
88
86
|
// Your code here...
|
|
89
87
|
})();
|
|
90
88
|
```
|
|
@@ -93,7 +91,7 @@
|
|
|
93
91
|
|
|
94
92
|
```js
|
|
95
93
|
var xhr = new XMLHttpRequest();
|
|
96
|
-
xhr.open('GET', 'https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@3.3.
|
|
94
|
+
xhr.open('GET', 'https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@3.3.4/dist/chatgpt.min.js');
|
|
97
95
|
xhr.onload = function () {
|
|
98
96
|
if (xhr.status === 200) {
|
|
99
97
|
var chatgptJS = document.createElement('script');
|
|
@@ -115,7 +113,7 @@ function yourCode() {
|
|
|
115
113
|
|
|
116
114
|
```js
|
|
117
115
|
...
|
|
118
|
-
// @require https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@3.3.
|
|
116
|
+
// @require https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@3.3.4/dist/chatgpt.min.js
|
|
119
117
|
// ==/UserScript==
|
|
120
118
|
|
|
121
119
|
// Your code here...
|
|
@@ -184,7 +182,7 @@ chatgpt.get('reply', 'last');
|
|
|
184
182
|
|
|
185
183
|
Each call equally fetches the last response. If you think it works, it probably will... so just type it!
|
|
186
184
|
|
|
187
|
-
If it didn't, check out the extended [userguide](https://github.com/KudoAI/chatgpt.js/blob/v3.3.
|
|
185
|
+
If it didn't, check out the extended [userguide](https://github.com/KudoAI/chatgpt.js/blob/v3.3.4/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!
|
|
188
186
|
|
|
189
187
|
<img height=8px width="100%" src="https://media.chatgptjs.org/images/separators/gradient-aqua.png?78210a7">
|
|
190
188
|
|
|
@@ -247,7 +245,51 @@ https://github.com/KudoAI/chatgpt.js/assets/10906554/f53c740f-d5e0-49b6-ae02-3b3
|
|
|
247
245
|
[Readme](https://docs.ddgpt.com/#readme) /
|
|
248
246
|
[Discuss](https://github.ddgpt.com/discussions)
|
|
249
247
|
|
|
250
|
-
### <picture><source type="image/png" media="(prefers-color-scheme: dark)" srcset="https://media.googlegpt.io/images/icons/googlegpt/white/icon32.
|
|
248
|
+
### <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>
|
|
249
|
+
|
|
250
|
+
> Adds AI answers to Google Search (powered by Google Gemma + GPT-4o!)
|
|
251
|
+
<br>[Install](https://greasyfork.googlegpt.io) /
|
|
252
|
+
[Readme](https://docs.googlegpt.io/#readme) /
|
|
253
|
+
[Discuss](https://github.googlegpt.io/discussions)
|
|
254
|
+
|
|
255
|
+
### <img width=23 src="https://media.chatgptjs.org/images/icons/platforms/thunderbird/icon32.png?313a9c5"> [ThunderAI](https://micz.it/thunderdbird-addon-thunderai/) <a href="https://addons.thunderbird.net/thunderbird/addon/thunderai/reviews" target="_blank" rel="noopener"><picture><source type="image/png" media="(prefers-color-scheme: dark)" srcset="https://media.chatgptjs.org/images/badges/5-star/blue-stars.png?0943672"><img width=92 alt="[Rated 5-stars]" src="https://media.chatgptjs.org/images/badges/5-star/yellow-stars-in-white-pill.png?0943672"></picture></a>
|
|
256
|
+
|
|
257
|
+
> Use ChatGPT in Thunderbird to enhance you emails, even with a free account!
|
|
258
|
+
<br>[Install](https://addons.thunderbird.net/thunderbird/addon/thunderai/) /
|
|
259
|
+
[Readme](https://micz.it/thunderdbird-addon-thunderai/) /
|
|
260
|
+
[Support](https://github.com/micz/ThunderAI/issues)
|
|
261
|
+
|
|
262
|
+
<p><br>
|
|
263
|
+
|
|
264
|
+
<a href="https://chatgptinfinity.com" target="_blank" rel="noopener">
|
|
265
|
+
<img width=555 src="https://cdn.jsdelivr.net/gh/adamlui/chatgpt-infinity@0f48c4e/chrome/media/images/tiles/marquee-promo-tile-1400x560.png">
|
|
266
|
+
</a>
|
|
267
|
+
|
|
268
|
+
<p><br>
|
|
269
|
+
|
|
270
|
+
<a href="https://chatgptwidescreen.com" target="_blank" rel="noopener">
|
|
271
|
+
<img width=555 src="https://cdn.jsdelivr.net/gh/adamlui/chatgpt-widescreen@3ed0950/chrome/media/images/tiles/marquee-promo-tile-1400x560.png">
|
|
272
|
+
</a>
|
|
273
|
+
|
|
274
|
+
<p><br>
|
|
275
|
+
|
|
276
|
+
<p id="showcase-cta">
|
|
277
|
+
If you've made something w/ chatgpt.js you want to share, email <a href="mailto:showcase@chatgptjs.org">showcase@chatgptjs.org</a> or just open a <a href="https://github.com/KudoAI/chatgpt.js/pulls" target="_blank" rel="noopener">pull request</a>!
|
|
278
|
+
</p>
|
|
279
|
+
|
|
280
|
+
<img height=8px width="100%" src="https://media.chatgptjs.org/images/separators/gradient-aqua.png?78210a7">
|
|
281
|
+
|
|
282
|
+
<div id="contributors">
|
|
283
|
+
|
|
284
|
+
## 🧠 Contributors
|
|
285
|
+
|
|
286
|
+
</div>
|
|
287
|
+
|
|
288
|
+
This library exists thanks to code, translations, issues & ideas from the following contributors:
|
|
289
|
+
|
|
290
|
+
<div align="center"><br>
|
|
291
|
+
|
|
292
|
+
[](https://github.com/adamlui)
|
|
251
293
|
[](https://github.com/mefengl)
|
|
252
294
|
[](https://github.com/Zin6969)
|
|
253
295
|
[](https://github.com/madruga8)
|
|
@@ -266,7 +308,53 @@ https://github.com/KudoAI/chatgpt.js/assets/10906554/f53c740f-d5e0-49b6-ae02-3b3
|
|
|
266
308
|
[](https://github.com/abhinavm24)
|
|
267
309
|
[](https://github.com/deyvisml)
|
|
268
310
|
[](https://github.com/philly88r)
|
|
269
|
-
[](https://github.com/thomasgauthier)
|
|
312
|
+
[](https://github.com/pranav-bhatt)
|
|
313
|
+
[](https://github.com/gadelkareem)
|
|
314
|
+
[](https://github.com/hopana)
|
|
315
|
+
[](https://github.com/emtry)
|
|
316
|
+
[](https://github.com/thedayofcondor)
|
|
317
|
+
[](https://github.com/Luwa-Tech)
|
|
318
|
+
[](https://github.com/micz)
|
|
319
|
+
[](https://github.com/imranaalam)
|
|
320
|
+
[](https://github.com/grayfallstown)
|
|
321
|
+
[](https://github.com/svan-b)
|
|
322
|
+
[](https://github.com/Jeff-Zzh)
|
|
323
|
+
[](https://github.com/ae3e)
|
|
324
|
+
[](https://github.com/dependabot)
|
|
325
|
+
<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>
|
|
326
|
+
<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>
|
|
327
|
+
[](https://github.com/ImgBotApp)
|
|
328
|
+
|
|
329
|
+
</div><br>
|
|
330
|
+
|
|
331
|
+
<img height=8px width="100%" src="https://media.chatgptjs.org/images/separators/gradient-aqua.png?78210a7">
|
|
332
|
+
|
|
333
|
+
<div id="partners">
|
|
334
|
+
|
|
335
|
+
## 🤝 Partners
|
|
336
|
+
|
|
337
|
+
</div>
|
|
338
|
+
|
|
339
|
+
**chatgpt.js** is funded in part by:
|
|
340
|
+
|
|
341
|
+
<div id="partners-collage" align="center">
|
|
342
|
+
|
|
343
|
+
<picture>
|
|
344
|
+
<source type="image/png" media="(prefers-color-scheme: dark)" srcset="https://media.chatgptjs.org/images/logos/partners/collage/white.png?3109608">
|
|
345
|
+
<img width=888 src="https://media.chatgptjs.org/images/logos/partners/collage/black.png?3109608">
|
|
346
|
+
</picture>
|
|
347
|
+
|
|
348
|
+
</div>
|
|
349
|
+
|
|
350
|
+
<br>
|
|
351
|
+
|
|
352
|
+
<img height=8px width="100%" src="https://media.chatgptjs.org/images/separators/gradient-aqua.png?78210a7">
|
|
353
|
+
|
|
354
|
+
<div align="center">
|
|
355
|
+
|
|
356
|
+
**[Releases](https://github.com/KudoAI/chatgpt.js/releases)** /
|
|
357
|
+
[Userguide](https://github.com/KudoAI/chatgpt.js/blob/v3.3.4/docs/USERGUIDE.md) /
|
|
270
358
|
[Discuss](https://github.com/KudoAI/chatgpt.js/discussions) /
|
|
271
359
|
<a href="#--------------------------------------------------------------------------------english---------简体中文---------繁體中文---------日本---------한국인---------हिंदी---------नेपाली---------deutsch---------español---------français---------italiano---------nederlands---------português---------việt----">Back to top ↑</a>
|
|
272
360
|
|
package/dist/chatgpt.min.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* User guide: https://chatgptjs.org/userguide
|
|
5
5
|
* Latest minified release: https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js/chatgpt.min.js
|
|
6
6
|
*/
|
|
7
|
-
localStorage.alertQueue=JSON.stringify([]),localStorage.notifyProps=JSON.stringify({queue:{topRight:[],bottomRight:[],bottomLeft:[],topLeft:[]}});let chatgpt={openAIaccessToken:{},endpoints:{assets:"https://cdn.jsdelivr.net/gh/KudoAI/chatgpt.js@c5210ba9e82d1444c35796b60c3c45d3641ce0dc",openAI:{session:"https://chatgpt.com/api/auth/session",chats:"https://chatgpt.com/backend-api/conversations",chat:"https://chatgpt.com/backend-api/conversation",share_create:"https://chatgpt.com/backend-api/share/create",share:"https://chatgpt.com/backend-api/share",instructions:"https://chatgpt.com/backend-api/user_system_messages"}},actAs(s){return new Promise((o,a)=>{let n=new XMLHttpRequest;n.open("GET","https://raw.githubusercontent.com/KudoAI/chat-prompts/main/dist/personas.min.json",!0),n.send(),n.onload=()=>{if(200!==n.status)return a("🤖 chatgpt.js >> Request failed. Cannot retrieve prompts data.");var e=JSON.parse(n.responseText).personas;if(s){var t=e.find(e=>e.title.toLowerCase()==s.toLowerCase());if(!t)return a(`🤖 chatgpt.js >> Persona '${s}' was not found!`);chatgpt.send(t.prompt,"click"),console.info(`Loading ${s} persona...`),chatgpt.isIdle().then(()=>{console.info("Persona activated!")})}else{console.log("\n%c🤖 chatgpt.js personas\n","font-family: sans-serif ; font-size: xxx-large ; font-weight: bold");for(var r of e)console.log("%c"+r.title,"font-family: monospace ; font-size: larger ;")}return o()}})},activateDarkMode(){document.documentElement.classList.replace("light","dark"),document.documentElement.style.colorScheme="dark",localStorage.setItem("theme","dark")},activateLightMode(){document.documentElement.classList.replace("dark","light"),document.documentElement.style.colorScheme="light",localStorage.setItem("theme","light")},alert(r,o,e,a,t){let n=chatgpt.isDarkMode()?"dark":"light",s=chatgpt.browser.isMobile(),i=document.createElement("div"),c=(i.id=Math.floor(1e6*chatgpt.randomFloat())+Date.now(),i.classList.add("chatgpt-modal"),document.createElement("div")),l=document.createElement("h2"),d=document.createElement("p");var g=20231203;let u=document.querySelector("#chatgpt-modal-style"),p=((!u||parseInt(u.getAttribute("last-updated"),10)<g)&&(u||((u=document.createElement("style")).id="chatgpt-modal-style",u.setAttribute("last-updated",g.toString()),document.head.append(u)),u.innerText=".no-mobile-tap-outline { outline: none ; -webkit-tap-highlight-color: transparent }.chatgpt-modal {position: fixed ; top: 0 ; left: 0 ; width: 100% ; height: 100% ;background-color: rgba(67, 70, 72, 0) ;transition: background-color 0.05s ease ;display: flex ; justify-content: center ; align-items: center ; z-index: 9999 }.chatgpt-modal > div {opacity: 0 ; transform: translateX(-2px) translateY(5px) ; max-width: 75vw ; word-wrap: break-word ;transition: opacity 0.1s cubic-bezier(.165,.84,.44,1), transform 0.2s cubic-bezier(.165,.84,.44,1) ;"+`background-color: ${"dark"==n?"black":"white"} ;`+("dark"!=n?"border: 1px solid rgba(0, 0, 0, 0.3) ;":"")+"padding: 20px ; margin: 12px 23px ; border-radius: 15px ; box-shadow: 0 30px 60px rgba(0, 0, 0, .12) ; -webkit-user-select: none ; -moz-user-select: none ; -ms-user-select: none ; user-select: none ; }.chatgpt-modal h2 { margin-bottom: 9px }"+`.chatgpt-modal a { color: ${"dark"==n?"#00cfff":"#1e9ebb"}}`+".chatgpt-modal.animated > div { opacity: 1 ; transform: translateX(0) translateY(0) }@keyframes alert-zoom-fade-out { 0% { opacity: 1 ; transform: scale(1) }50% { opacity: 0.25 ; transform: scale(1.05) }100% { opacity: 0 ; transform: scale(1.35) }}.modal-buttons { display: flex ; justify-content: flex-end ; margin: 20px -5px -3px 0 ;"+(s?"flex-direction: column-reverse":"")+"}.chatgpt-modal button {"+`margin-left: ${s?0:10}px ; padding: ${s?15:4}px 18px ; border-radius: 15px ;`+(s?"margin-top: 5px ; margin-bottom: 3px ;":"")+`border: 1px solid ${"dark"==n?"white":"black"}}`+".primary-modal-btn {"+`border: 1px solid ${"dark"==n?"white":"black"} ;`+`background: ${"dark"==n?"white":"black"} ;`+`color: ${"dark"==n?"black":"white"}}`+".chatgpt-modal button:hover { color: #3d5d71 ; border-color: #6d9cb9 ;background-color: "+("dark"==n?"#00cfff":"#9cdaff")+";box-shadow: 2px 1px "+("dark"==n?"54px #00cfff":"30px #9cdaff")+"}.modal-close-btn {cursor: pointer ; width: 29px ; height: 29px ; border-radius: 17px ;float: right ; position: relative ; right: -6px ; top: -5px }.modal-close-btn svg { margin: 10px }"+`.modal-close-btn:hover { background-color: #f2f2f2${"dark"==n?"00":""}}`+".chatgpt-modal .checkbox-group { display: flex ; margin-top: -18px }.chatgpt-modal .checkbox-group label {font-size: .7rem ; margin: -.04rem 0 0px .3rem ;"+`color: ${"dark"==n?"#e1e1e1":"#1e1e1e"}}`+'.chatgpt-modal input[type="checkbox"] { transform: scale(0.7) ;'+`border: 1px solid ${"dark"==n?"white":"black"}}`+'.chatgpt-modal input[type="checkbox"]:checked {'+`border: 1px solid ${"dark"==n?"white":"black"} ;`+'background-color: black ; position: inherit }.chatgpt-modal input[type="checkbox"]:focus { outline: none ; box-shadow: none }'),l.innerText=r||"",d.innerText=o||"",chatgpt.renderHTML(d),document.createElement("div"));p.classList.add("modal-buttons","no-mobile-tap-outline"),e&&(e=Array.isArray(e)?e:[e]).forEach(e=>{var t=document.createElement("button");t.textContent=e.name.replace(/[_-]\w/g,e=>e.slice(1).toUpperCase()).replace(/([A-Z])/g," $1").replace(/^\w/,e=>e.toUpperCase()),t.onclick=()=>{y(),e()},p.insertBefore(t,p.firstChild)});g=document.createElement("button"),g.textContent=e?"Dismiss":"OK",p.insertBefore(g,p.firstChild),p.lastChild.classList.add("primary-modal-btn"),r=document.createElement("div");if(a){r.classList.add("checkbox-group");let e=a,t=document.createElement("input");t.type="checkbox",t.onchange=e;o=document.createElement("label");o.onclick=()=>{t.checked=!t.checked,e()},o.textContent=e.name.charAt(0).toUpperCase()+e.name.slice(1).replace(/([A-Z])/g,(e,t)=>" "+t.toLowerCase()).replace(/\b(\w+)nt\b/gi,"$1n't").trim(),r.append(t),r.append(o)}e=document.createElement("div"),e.title="Close",e.classList.add("modal-close-btn","no-mobile-tap-outline"),a=document.createElementNS("http://www.w3.org/2000/svg","svg"),a.setAttribute("height","10px"),a.setAttribute("viewBox","0 0 14 14"),a.setAttribute("fill","none"),o=document.createElementNS("http://www.w3.org/2000/svg","path");o.setAttribute("fill-rule","evenodd"),o.setAttribute("clip-rule","evenodd"),o.setAttribute("fill",chatgpt.isDarkMode()?"white":"black"),o.setAttribute("d","M13.7071 1.70711C14.0976 1.31658 14.0976 0.683417 13.7071 0.292893C13.3166 -0.0976312 12.6834 -0.0976312 12.2929 0.292893L7 5.58579L1.70711 0.292893C1.31658 -0.0976312 0.683417 -0.0976312 0.292893 0.292893C-0.0976312 0.683417 -0.0976312 1.31658 0.292893 1.70711L5.58579 7L0.292893 12.2929C-0.0976312 12.6834 -0.0976312 13.3166 0.292893 13.7071C0.683417 14.0976 1.31658 14.0976 1.70711 13.7071L7 8.41421L12.2929 13.7071C12.6834 14.0976 13.3166 14.0976 13.7071 13.7071C14.0976 13.3166 14.0976 12.6834 13.7071 12.2929L8.41421 7L13.7071 1.70711Z"),a.append(o),e.append(a),[e,l,d,p,r].forEach(e=>{c.append(e)}),c.style.width=`${t||458}px`,i.append(c),document.body.append(i);let h=JSON.parse(localStorage.alertQueue),m=(h.push(i.id),localStorage.alertQueue=JSON.stringify(h),i.style.display="none",1===h.length&&(i.style.display="",setTimeout(()=>{i.style.backgroundColor=`rgba(67, 70, 72, ${"dark"==n?.62:.1})`,i.classList.add("animated")},100)),e=>{(e.target==e.currentTarget||e.target instanceof SVGPathElement)&&y()}),f=e=>{if([" ","Spacebar","Enter","Return","Escape","Esc"].includes(e.key)||[32,13,27].includes(e.keyCode))for(var t of h){var t=document.getElementById(t);if(t&&"none"!==t.style.display)return void(e.key.includes("Esc")||27==e.keyCode?y():([" ","Spacebar","Enter","Return"].includes(e.key)||[32,13].includes(e.keyCode))&&(t=t.querySelector(".modal-buttons").lastChild)&&(t.click(),e.preventDefault()))}},y=([i,e,a,g].forEach(e=>e.onclick=m),document.addEventListener("keydown",f),()=>{i.style.backgroundColor="transparent",c.style.animation="alert-zoom-fade-out 0.075s ease-out",setTimeout(()=>{if(i.remove(),(h=JSON.parse(localStorage.alertQueue)).shift(),localStorage.alertQueue=JSON.stringify(h),document.removeEventListener("keydown",f),0<h.length){let e=document.getElementById(h[0]);setTimeout(()=>{e.style.display="",setTimeout(()=>{e.classList.add("animated")},100)},500)}},50)});return i.id},async askAndGetReply(e){return chatgpt.send(e),await chatgpt.isIdle(),chatgpt.getChatData("active","msg","chatgpt","latest")},autoRefresh:{activate(e){if(this.isActive)console.log("↻ ChatGPT >> ["+chatgpt.autoRefresh.nowTimeStamp()+"] Auto refresh already active!");else{let r=this,o=(this.toggle.refreshFrame(),t=>{var e=Math.max(2,Math.floor(21*chatgpt.randomFloat()-10));r.isActive=setTimeout(()=>{var e=document.querySelector('script[src*="_ssgManifest.js"]');e&&(document.querySelector("#refresh-frame").src=e.src+"?"+Date.now(),console.log("↻ ChatGPT >> ["+r.nowTimeStamp()+"] ChatGPT session refreshed")),o(t)},1e3*(t+e))});o(e?parseInt(e,10):30),console.log("↻ ChatGPT >> ["+chatgpt.autoRefresh.nowTimeStamp()+"] Auto refresh activated"),navigator.userAgent.includes("Chrome")&&void 0!==document.hidden&&document.addEventListener("visibilitychange",this.toggle.beacons)}},deactivate(){this.isActive?(this.toggle.refreshFrame(),document.removeEventListener("visibilitychange",this.toggle.beacons),clearTimeout(this.isActive),this.isActive=null,console.log("↻ ChatGPT >> ["+chatgpt.autoRefresh.nowTimeStamp()+"] Auto refresh de-activated")):console.log("↻ ChatGPT >> ["+chatgpt.autoRefresh.nowTimeStamp()+"] Auto refresh already inactive!")},nowTimeStamp(){var e=new Date,t=e.getHours()%12||12;let r=e.getMinutes(),o=e.getSeconds();r<10&&(r="0"+r),o<10&&(o="0"+o);e=e.getHours()<12?"AM":"PM";return t+":"+r+":"+o+" "+e},toggle:{beacons(){chatgpt.autoRefresh.beaconID?(clearInterval(chatgpt.autoRefresh.beaconID),chatgpt.autoRefresh.beaconID=null,console.log("↻ ChatGPT >> ["+chatgpt.autoRefresh.nowTimeStamp()+"] Beacons de-activated")):(chatgpt.autoRefresh.beaconID=setInterval(()=>{navigator.sendBeacon("https://httpbin.org/post",new Uint8Array),console.log("↻ ChatGPT >> ["+chatgpt.autoRefresh.nowTimeStamp()+"] Beacon sent")},9e4),console.log("↻ ChatGPT >> ["+chatgpt.autoRefresh.nowTimeStamp()+"] Beacons activated"))},refreshFrame(){let e=document.querySelector("#refresh-frame");e?e.remove():(e=Object.assign(document.createElement("iframe"),{id:"refresh-frame",style:"display: none"}),document.head.prepend(e))}}},browser:{isLightMode(){return window.matchMedia?.("(prefers-color-scheme: light)")?.matches},isDarkMode(){return window.matchMedia?.("(prefers-color-scheme: dark)")?.matches},isChromium(){return!!JSON.stringify(navigator.userAgentData?.brands)?.includes("Chromium")},isChrome(){return!!JSON.stringify(navigator.userAgentData?.brands)?.includes("Chrome")},isEdge(){return!!JSON.stringify(navigator.userAgentData?.brands)?.includes("Edge")},isBrave(){return!!JSON.stringify(navigator.userAgentData?.brands)?.includes("Brave")},isFirefox(){return navigator.userAgent.includes("Firefox")},isFullScreen(){var e=navigator.userAgent;return e.includes("Chrome")?window.matchMedia("(display-mode: fullscreen)").matches:e.includes("Firefox")?window.fullScreen:/MSIE|rv:/.test(e)?document.msFullscreenElement:document.webkitIsFullScreen},isMobile(){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}},async clearChats(){return new Promise((r,o)=>{chatgpt.getAccessToken().then(e=>{let t=new XMLHttpRequest;t.open("PATCH",chatgpt.endpoints.openAI.chats,!0),t.setRequestHeader("Content-Type","application/json"),t.setRequestHeader("Authorization","Bearer "+e),t.onload=()=>{if(200!==t.status)return o("🤖 chatgpt.js >> Request failed. Cannot clear chats.");console.info("Chats successfully cleared"),r()},t.send(JSON.stringify({is_visible:!1}))}).catch(e=>o(new Error(e.message)))})},code:{async execute(e){return e?"string"!=typeof e?console.error("Code argument must be a string!"):(chatgpt.send("Display the output as if you were terminal:\n\n"+e),console.info("Executing code..."),await chatgpt.isIdle(),chatgpt.code.extract(await chatgpt.getChatData("active","msg","chatgpt","latest"))):console.error("Code argument not supplied. Pass some code!")},extract(e){var t=e.match(/(?<=```.*\n)[\s\S]*?(?=```)/g);return t?t[t.length-1]:e},async isIdle(t=null){let a={childList:!0,subtree:!0},n={msgDiv:"div[data-message-author-role]",replyDiv:'div[data-message-author-role="assistant"]'};var e=t?new Promise(e=>setTimeout(()=>e(!1),t)):null,r=(async()=>{await new Promise(r=>{document.querySelector(n.msgDiv)?r():new MutationObserver((e,t)=>{document.querySelector(n.msgDiv)&&(t.disconnect(),r())}).observe(document.body,a)}),await new Promise(r=>{new MutationObserver((e,t)=>{chatgpt.getStopBtn()&&(t.disconnect(),r())}).observe(document.body,{childList:!0,subtree:!0})});let e=document.querySelectorAll(n.replyDiv),o=e[e.length-1];return await new Promise(r=>{new MutationObserver((e,t)=>{o?.querySelector("pre")&&(t.disconnect(),r())}).observe(document.body,a)}),new Promise(r=>{new MutationObserver((e,t)=>{!o?.querySelector("pre")?.nextElementSibling&&chatgpt.getStopBtn()||(t.disconnect(),r(!0))}).observe(document.body,a)})})();return e?Promise.race([r,e]):r},async minify(e){return e?"string"!=typeof e?console.error("Code argument must be a string!"):(chatgpt.send("Minify the following code:\n\n"+e),console.info("Minifying code..."),await chatgpt.isIdle(),chatgpt.code.extract(await chatgpt.getChatData("active","msg","chatgpt","latest"))):console.error("Code argument not supplied. Pass some code!")},async obfuscate(e){return e?"string"!=typeof e?console.error("Code argument must be a string!"):(chatgpt.send("Obfuscate the following code:\n\n"+e),console.info("Obfuscating code..."),await chatgpt.isIdle(),chatgpt.code.extract(await chatgpt.getChatData("active","msg","chatgpt","latest"))):console.error("Code argument not supplied. Pass some code!")},async refactor(e,t){if(!e)return console.error("Code (1st) argument not supplied. Pass some code!");for(let e=0;e<arguments.length;e++)if("string"!=typeof arguments[e])return console.error(`Argument ${e+1} must be a string.`);return chatgpt.send("Refactor the following code for "+(t||"brevity")+":\n\n"+e),console.info("Refactoring code..."),await chatgpt.isIdle(),chatgpt.code.extract(await chatgpt.getChatData("active","msg","chatgpt","latest"))},async review(e){return e?"string"!=typeof e?console.error("Code argument must be a string!"):(chatgpt.send("Review the following code for me:\n\n"+e),console.info("Reviewing code..."),await chatgpt.isIdle(),chatgpt.getChatData("active","msg","chatgpt","latest")):console.error("Code argument not supplied. Pass some code!")},async unminify(e){return e?"string"!=typeof e?console.error("Code argument must be a string!"):(chatgpt.send("Unminify the following code.:\n\n"+e),console.info("Unminifying code..."),await chatgpt.isIdle(),chatgpt.code.extract(await chatgpt.getChatData("active","msg","chatgpt","latest"))):console.error("Code argument not supplied. Pass some code!")},async write(e,t){if(!e)return console.error("Prompt (1st) argument not supplied. Pass a prompt!");if(!t)return console.error("outputLang (2nd) argument not supplied. Pass a language!");for(let e=0;e<arguments.length;e++)if("string"!=typeof arguments[e])return console.error(`Argument ${e+1} must be a string.`);return chatgpt.send(e+"\n\nWrite this as code in "+t),console.info("Writing code..."),await chatgpt.isIdle(),chatgpt.code.extract(await chatgpt.getChatData("active","msg","chatgpt","latest"))}},continue(){chatgpt.response.continue()},async detectLanguage(e){return e?"string"!=typeof e?console.error("Text argument must be a string!"):(chatgpt.send("Detect the language of the following text:\n\n"+e+"\n\nOnly respond with the name of the language"),console.info("Reviewing text..."),await chatgpt.isIdle(),chatgpt.getChatData("active","msg","chatgpt","latest")):console.error("Text argument not supplied. Pass some text!")},executeCode(){chatgpt.code.execute()},async exportChat(e,t){e=e?Number.isInteger(e)||/^\d+$/.test(e)?parseInt(e,10):e:"active",t=t.toLowerCase()||"html",console.info("Generating transcript...");let a="",r;if(/te?xt/.test(t)){var o=new Date,n=o.getDate().toString().padStart(2,"0"),s=(o.getMonth()+1).toString().padStart(2,"0"),i=o.getFullYear(),c=o.getHours().toString().padStart(2,"0"),o=o.getMinutes().toString().padStart(2,"0");if(r=`ChatGPT_${n}-${s}-${i}_${c}-${o}.txt`,"active"==e&&/\/\w{8}-\w{4}-\w{4}-\w{4}-\w{12}$/.test(window.location.href)){n=document.querySelectorAll("main > div > div > div > div > div > div[class*=group]");if(0===n.length)return console.error("Chat is empty!");let r=[],o=!0;n.forEach(e=>{var t=o?"USER":"CHATGPT",e=(o=!o,Array.from(e.childNodes).map(e=>e.innerText).join("\n\n").replace("Copy code",""));r.push(t+": "+e)}),a=r.join("\n\n")}else for(var l of await chatgpt.getChatData(e,"msg","both","all"))a=(a+=`USER: ${l.user}
|
|
7
|
+
localStorage.alertQueue=JSON.stringify([]),localStorage.notifyProps=JSON.stringify({queue:{topRight:[],bottomRight:[],bottomLeft:[],topLeft:[]}});let chatgpt={openAIaccessToken:{},endpoints:{assets:"https://cdn.jsdelivr.net/gh/KudoAI/chatgpt.js@4348cbeda3bed1d9e8c8caf71c4a1b6825e83130",openAI:{session:"https://chatgpt.com/api/auth/session",chats:"https://chatgpt.com/backend-api/conversations",chat:"https://chatgpt.com/backend-api/conversation",share_create:"https://chatgpt.com/backend-api/share/create",share:"https://chatgpt.com/backend-api/share",instructions:"https://chatgpt.com/backend-api/user_system_messages"}},actAs(s){return new Promise((o,a)=>{let n=new XMLHttpRequest;n.open("GET","https://raw.githubusercontent.com/KudoAI/chat-prompts/main/dist/personas.min.json",!0),n.send(),n.onload=()=>{if(200!==n.status)return a("🤖 chatgpt.js >> Request failed. Cannot retrieve prompts data.");var e=JSON.parse(n.responseText).personas;if(s){var t=e.find(e=>e.title.toLowerCase()==s.toLowerCase());if(!t)return a(`🤖 chatgpt.js >> Persona '${s}' was not found!`);chatgpt.send(t.prompt,"click"),console.info(`Loading ${s} persona...`),chatgpt.isIdle().then(()=>{console.info("Persona activated!")})}else{console.log("\n%c🤖 chatgpt.js personas\n","font-family: sans-serif ; font-size: xxx-large ; font-weight: bold");for(var r of e)console.log("%c"+r.title,"font-family: monospace ; font-size: larger ;")}return o()}})},activateDarkMode(){document.documentElement.classList.replace("light","dark"),document.documentElement.style.colorScheme="dark",localStorage.setItem("theme","dark")},activateLightMode(){document.documentElement.classList.replace("dark","light"),document.documentElement.style.colorScheme="light",localStorage.setItem("theme","light")},alert(r,o,e,a,t){let n=chatgpt.isDarkMode()?"dark":"light",s=chatgpt.browser.isMobile(),i=document.createElement("div"),c=(i.id=Math.floor(1e6*chatgpt.randomFloat())+Date.now(),i.classList.add("chatgpt-modal"),document.createElement("div")),l=document.createElement("h2"),d=document.createElement("p");var g=20231203;let u=document.querySelector("#chatgpt-modal-style"),p=((!u||parseInt(u.getAttribute("last-updated"),10)<g)&&(u||((u=document.createElement("style")).id="chatgpt-modal-style",u.setAttribute("last-updated",g.toString()),document.head.append(u)),u.innerText=".no-mobile-tap-outline { outline: none ; -webkit-tap-highlight-color: transparent }.chatgpt-modal {position: fixed ; top: 0 ; left: 0 ; width: 100% ; height: 100% ;background-color: rgba(67, 70, 72, 0) ;transition: background-color 0.05s ease ;display: flex ; justify-content: center ; align-items: center ; z-index: 9999 }.chatgpt-modal > div {opacity: 0 ; transform: translateX(-2px) translateY(5px) ; max-width: 75vw ; word-wrap: break-word ;transition: opacity 0.1s cubic-bezier(.165,.84,.44,1), transform 0.2s cubic-bezier(.165,.84,.44,1) ;"+`background-color: ${"dark"==n?"black":"white"} ;`+("dark"!=n?"border: 1px solid rgba(0, 0, 0, 0.3) ;":"")+"padding: 20px ; margin: 12px 23px ; border-radius: 15px ; box-shadow: 0 30px 60px rgba(0, 0, 0, .12) ; -webkit-user-select: none ; -moz-user-select: none ; -ms-user-select: none ; user-select: none ; }.chatgpt-modal h2 { margin-bottom: 9px }"+`.chatgpt-modal a { color: ${"dark"==n?"#00cfff":"#1e9ebb"}}`+".chatgpt-modal.animated > div { opacity: 1 ; transform: translateX(0) translateY(0) }@keyframes alert-zoom-fade-out { 0% { opacity: 1 ; transform: scale(1) }50% { opacity: 0.25 ; transform: scale(1.05) }100% { opacity: 0 ; transform: scale(1.35) }}.modal-buttons { display: flex ; justify-content: flex-end ; margin: 20px -5px -3px 0 ;"+(s?"flex-direction: column-reverse":"")+"}.chatgpt-modal button {"+`margin-left: ${s?0:10}px ; padding: ${s?15:4}px 18px ; border-radius: 15px ;`+(s?"margin-top: 5px ; margin-bottom: 3px ;":"")+`border: 1px solid ${"dark"==n?"white":"black"}}`+".primary-modal-btn {"+`border: 1px solid ${"dark"==n?"white":"black"} ;`+`background: ${"dark"==n?"white":"black"} ;`+`color: ${"dark"==n?"black":"white"}}`+".chatgpt-modal button:hover { color: #3d5d71 ; border-color: #6d9cb9 ;background-color: "+("dark"==n?"#00cfff":"#9cdaff")+";box-shadow: 2px 1px "+("dark"==n?"54px #00cfff":"30px #9cdaff")+"}.modal-close-btn {cursor: pointer ; width: 29px ; height: 29px ; border-radius: 17px ;float: right ; position: relative ; right: -6px ; top: -5px }.modal-close-btn svg { margin: 10px }"+`.modal-close-btn:hover { background-color: #f2f2f2${"dark"==n?"00":""}}`+".chatgpt-modal .checkbox-group { display: flex ; margin-top: -18px }.chatgpt-modal .checkbox-group label {font-size: .7rem ; margin: -.04rem 0 0px .3rem ;"+`color: ${"dark"==n?"#e1e1e1":"#1e1e1e"}}`+'.chatgpt-modal input[type="checkbox"] { transform: scale(0.7) ;'+`border: 1px solid ${"dark"==n?"white":"black"}}`+'.chatgpt-modal input[type="checkbox"]:checked {'+`border: 1px solid ${"dark"==n?"white":"black"} ;`+'background-color: black ; position: inherit }.chatgpt-modal input[type="checkbox"]:focus { outline: none ; box-shadow: none }'),l.innerText=r||"",d.innerText=o||"",chatgpt.renderHTML(d),document.createElement("div"));p.classList.add("modal-buttons","no-mobile-tap-outline"),e&&(e=Array.isArray(e)?e:[e]).forEach(e=>{var t=document.createElement("button");t.textContent=e.name.replace(/[_-]\w/g,e=>e.slice(1).toUpperCase()).replace(/([A-Z])/g," $1").replace(/^\w/,e=>e.toUpperCase()),t.onclick=()=>{y(),e()},p.insertBefore(t,p.firstChild)});g=document.createElement("button"),g.textContent=e?"Dismiss":"OK",p.insertBefore(g,p.firstChild),p.lastChild.classList.add("primary-modal-btn"),r=document.createElement("div");if(a){r.classList.add("checkbox-group");let e=a,t=document.createElement("input");t.type="checkbox",t.onchange=e;o=document.createElement("label");o.onclick=()=>{t.checked=!t.checked,e()},o.textContent=e.name.charAt(0).toUpperCase()+e.name.slice(1).replace(/([A-Z])/g,(e,t)=>" "+t.toLowerCase()).replace(/\b(\w+)nt\b/gi,"$1n't").trim(),r.append(t),r.append(o)}e=document.createElement("div"),e.title="Close",e.classList.add("modal-close-btn","no-mobile-tap-outline"),a=document.createElementNS("http://www.w3.org/2000/svg","svg"),a.setAttribute("height","10px"),a.setAttribute("viewBox","0 0 14 14"),a.setAttribute("fill","none"),o=document.createElementNS("http://www.w3.org/2000/svg","path");o.setAttribute("fill-rule","evenodd"),o.setAttribute("clip-rule","evenodd"),o.setAttribute("fill",chatgpt.isDarkMode()?"white":"black"),o.setAttribute("d","M13.7071 1.70711C14.0976 1.31658 14.0976 0.683417 13.7071 0.292893C13.3166 -0.0976312 12.6834 -0.0976312 12.2929 0.292893L7 5.58579L1.70711 0.292893C1.31658 -0.0976312 0.683417 -0.0976312 0.292893 0.292893C-0.0976312 0.683417 -0.0976312 1.31658 0.292893 1.70711L5.58579 7L0.292893 12.2929C-0.0976312 12.6834 -0.0976312 13.3166 0.292893 13.7071C0.683417 14.0976 1.31658 14.0976 1.70711 13.7071L7 8.41421L12.2929 13.7071C12.6834 14.0976 13.3166 14.0976 13.7071 13.7071C14.0976 13.3166 14.0976 12.6834 13.7071 12.2929L8.41421 7L13.7071 1.70711Z"),a.append(o),e.append(a),[e,l,d,p,r].forEach(e=>{c.append(e)}),c.style.width=`${t||458}px`,i.append(c),document.body.append(i);let h=JSON.parse(localStorage.alertQueue),m=(h.push(i.id),localStorage.alertQueue=JSON.stringify(h),i.style.display="none",1===h.length&&(i.style.display="",setTimeout(()=>{i.style.backgroundColor=`rgba(67, 70, 72, ${"dark"==n?.62:.1})`,i.classList.add("animated")},100)),e=>{(e.target==e.currentTarget||e.target instanceof SVGPathElement)&&y()}),f=e=>{if([" ","Spacebar","Enter","Return","Escape","Esc"].includes(e.key)||[32,13,27].includes(e.keyCode))for(var t of h){var t=document.getElementById(t);if(t&&"none"!==t.style.display)return void(e.key.includes("Esc")||27==e.keyCode?y():([" ","Spacebar","Enter","Return"].includes(e.key)||[32,13].includes(e.keyCode))&&(t=t.querySelector(".modal-buttons").lastChild)&&(t.click(),e.preventDefault()))}},y=([i,e,a,g].forEach(e=>e.onclick=m),document.addEventListener("keydown",f),()=>{i.style.backgroundColor="transparent",c.style.animation="alert-zoom-fade-out 0.075s ease-out",setTimeout(()=>{if(i.remove(),(h=JSON.parse(localStorage.alertQueue)).shift(),localStorage.alertQueue=JSON.stringify(h),document.removeEventListener("keydown",f),0<h.length){let e=document.getElementById(h[0]);setTimeout(()=>{e.style.display="",setTimeout(()=>{e.classList.add("animated")},100)},500)}},50)});return i.id},async askAndGetReply(e){return chatgpt.send(e),await chatgpt.isIdle(),chatgpt.getChatData("active","msg","chatgpt","latest")},autoRefresh:{activate(e){if(this.isActive)console.log("↻ ChatGPT >> ["+chatgpt.autoRefresh.nowTimeStamp()+"] Auto refresh already active!");else{let r=this,o=(this.toggle.refreshFrame(),t=>{var e=Math.max(2,Math.floor(21*chatgpt.randomFloat()-10));r.isActive=setTimeout(()=>{var e=document.querySelector('script[src*="_ssgManifest.js"]');e&&(document.querySelector("#refresh-frame").src=e.src+"?"+Date.now(),console.log("↻ ChatGPT >> ["+r.nowTimeStamp()+"] ChatGPT session refreshed")),o(t)},1e3*(t+e))});o(e?parseInt(e,10):30),console.log("↻ ChatGPT >> ["+chatgpt.autoRefresh.nowTimeStamp()+"] Auto refresh activated"),navigator.userAgent.includes("Chrome")&&void 0!==document.hidden&&document.addEventListener("visibilitychange",this.toggle.beacons)}},deactivate(){this.isActive?(this.toggle.refreshFrame(),document.removeEventListener("visibilitychange",this.toggle.beacons),clearTimeout(this.isActive),this.isActive=null,console.log("↻ ChatGPT >> ["+chatgpt.autoRefresh.nowTimeStamp()+"] Auto refresh de-activated")):console.log("↻ ChatGPT >> ["+chatgpt.autoRefresh.nowTimeStamp()+"] Auto refresh already inactive!")},nowTimeStamp(){var e=new Date,t=e.getHours()%12||12;let r=e.getMinutes(),o=e.getSeconds();r<10&&(r="0"+r),o<10&&(o="0"+o);e=e.getHours()<12?"AM":"PM";return t+":"+r+":"+o+" "+e},toggle:{beacons(){chatgpt.autoRefresh.beaconID?(clearInterval(chatgpt.autoRefresh.beaconID),chatgpt.autoRefresh.beaconID=null,console.log("↻ ChatGPT >> ["+chatgpt.autoRefresh.nowTimeStamp()+"] Beacons de-activated")):(chatgpt.autoRefresh.beaconID=setInterval(()=>{navigator.sendBeacon("https://httpbin.org/post",new Uint8Array),console.log("↻ ChatGPT >> ["+chatgpt.autoRefresh.nowTimeStamp()+"] Beacon sent")},9e4),console.log("↻ ChatGPT >> ["+chatgpt.autoRefresh.nowTimeStamp()+"] Beacons activated"))},refreshFrame(){let e=document.querySelector("#refresh-frame");e?e.remove():(e=Object.assign(document.createElement("iframe"),{id:"refresh-frame",style:"display: none"}),document.head.prepend(e))}}},browser:{isLightMode(){return window.matchMedia?.("(prefers-color-scheme: light)")?.matches},isDarkMode(){return window.matchMedia?.("(prefers-color-scheme: dark)")?.matches},isChromium(){return!!JSON.stringify(navigator.userAgentData?.brands)?.includes("Chromium")},isChrome(){return!!JSON.stringify(navigator.userAgentData?.brands)?.includes("Chrome")},isEdge(){return!!JSON.stringify(navigator.userAgentData?.brands)?.includes("Edge")},isBrave(){return!!JSON.stringify(navigator.userAgentData?.brands)?.includes("Brave")},isFirefox(){return navigator.userAgent.includes("Firefox")},isFullScreen(){var e=navigator.userAgent;return e.includes("Chrome")?window.matchMedia("(display-mode: fullscreen)").matches:e.includes("Firefox")?window.fullScreen:/MSIE|rv:/.test(e)?document.msFullscreenElement:document.webkitIsFullScreen},isMobile(){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}},async clearChats(){return new Promise((r,o)=>{chatgpt.getAccessToken().then(e=>{let t=new XMLHttpRequest;t.open("PATCH",chatgpt.endpoints.openAI.chats,!0),t.setRequestHeader("Content-Type","application/json"),t.setRequestHeader("Authorization","Bearer "+e),t.onload=()=>{if(200!==t.status)return o("🤖 chatgpt.js >> Request failed. Cannot clear chats.");console.info("Chats successfully cleared"),r()},t.send(JSON.stringify({is_visible:!1}))}).catch(e=>o(new Error(e.message)))})},code:{async execute(e){return e?"string"!=typeof e?console.error("Code argument must be a string!"):(chatgpt.send("Display the output as if you were terminal:\n\n"+e),console.info("Executing code..."),await chatgpt.isIdle(),chatgpt.code.extract(await chatgpt.getChatData("active","msg","chatgpt","latest"))):console.error("Code argument not supplied. Pass some code!")},extract(e){var t=e.match(/(?<=```.*\n)[\s\S]*?(?=```)/g);return t?t[t.length-1]:e},async isIdle(t=null){let a={childList:!0,subtree:!0},n={msgDiv:"div[data-message-author-role]",replyDiv:'div[data-message-author-role="assistant"]'};var e=t?new Promise(e=>setTimeout(()=>e(!1),t)):null,r=(async()=>{await new Promise(r=>{document.querySelector(n.msgDiv)?r():new MutationObserver((e,t)=>{document.querySelector(n.msgDiv)&&(t.disconnect(),r())}).observe(document.body,a)}),await new Promise(r=>{new MutationObserver((e,t)=>{chatgpt.getStopBtn()&&(t.disconnect(),r())}).observe(document.body,{childList:!0,subtree:!0})});let e=document.querySelectorAll(n.replyDiv),o=e[e.length-1];return await new Promise(r=>{new MutationObserver((e,t)=>{o?.querySelector("pre")&&(t.disconnect(),r())}).observe(document.body,a)}),new Promise(r=>{new MutationObserver((e,t)=>{!o?.querySelector("pre")?.nextElementSibling&&chatgpt.getStopBtn()||(t.disconnect(),r(!0))}).observe(document.body,a)})})();return e?Promise.race([r,e]):r},async minify(e){return e?"string"!=typeof e?console.error("Code argument must be a string!"):(chatgpt.send("Minify the following code:\n\n"+e),console.info("Minifying code..."),await chatgpt.isIdle(),chatgpt.code.extract(await chatgpt.getChatData("active","msg","chatgpt","latest"))):console.error("Code argument not supplied. Pass some code!")},async obfuscate(e){return e?"string"!=typeof e?console.error("Code argument must be a string!"):(chatgpt.send("Obfuscate the following code:\n\n"+e),console.info("Obfuscating code..."),await chatgpt.isIdle(),chatgpt.code.extract(await chatgpt.getChatData("active","msg","chatgpt","latest"))):console.error("Code argument not supplied. Pass some code!")},async refactor(e,t){if(!e)return console.error("Code (1st) argument not supplied. Pass some code!");for(let e=0;e<arguments.length;e++)if("string"!=typeof arguments[e])return console.error(`Argument ${e+1} must be a string.`);return chatgpt.send("Refactor the following code for "+(t||"brevity")+":\n\n"+e),console.info("Refactoring code..."),await chatgpt.isIdle(),chatgpt.code.extract(await chatgpt.getChatData("active","msg","chatgpt","latest"))},async review(e){return e?"string"!=typeof e?console.error("Code argument must be a string!"):(chatgpt.send("Review the following code for me:\n\n"+e),console.info("Reviewing code..."),await chatgpt.isIdle(),chatgpt.getChatData("active","msg","chatgpt","latest")):console.error("Code argument not supplied. Pass some code!")},async unminify(e){return e?"string"!=typeof e?console.error("Code argument must be a string!"):(chatgpt.send("Unminify the following code.:\n\n"+e),console.info("Unminifying code..."),await chatgpt.isIdle(),chatgpt.code.extract(await chatgpt.getChatData("active","msg","chatgpt","latest"))):console.error("Code argument not supplied. Pass some code!")},async write(e,t){if(!e)return console.error("Prompt (1st) argument not supplied. Pass a prompt!");if(!t)return console.error("outputLang (2nd) argument not supplied. Pass a language!");for(let e=0;e<arguments.length;e++)if("string"!=typeof arguments[e])return console.error(`Argument ${e+1} must be a string.`);return chatgpt.send(e+"\n\nWrite this as code in "+t),console.info("Writing code..."),await chatgpt.isIdle(),chatgpt.code.extract(await chatgpt.getChatData("active","msg","chatgpt","latest"))}},continue(){chatgpt.response.continue()},async detectLanguage(e){return e?"string"!=typeof e?console.error("Text argument must be a string!"):(chatgpt.send("Detect the language of the following text:\n\n"+e+"\n\nOnly respond with the name of the language"),console.info("Reviewing text..."),await chatgpt.isIdle(),chatgpt.getChatData("active","msg","chatgpt","latest")):console.error("Text argument not supplied. Pass some text!")},executeCode(){chatgpt.code.execute()},async exportChat(e,t){e=e?Number.isInteger(e)||/^\d+$/.test(e)?parseInt(e,10):e:"active",t=t.toLowerCase()||"html",console.info("Generating transcript...");let a="",r;if(/te?xt/.test(t)){var o=new Date,n=o.getDate().toString().padStart(2,"0"),s=(o.getMonth()+1).toString().padStart(2,"0"),i=o.getFullYear(),c=o.getHours().toString().padStart(2,"0"),o=o.getMinutes().toString().padStart(2,"0");if(r=`ChatGPT_${n}-${s}-${i}_${c}-${o}.txt`,"active"==e&&/\/\w{8}-\w{4}-\w{4}-\w{4}-\w{12}$/.test(window.location.href)){n=document.querySelectorAll("main > div > div > div > div > div > div[class*=group]");if(0===n.length)return console.error("Chat is empty!");let r=[],o=!0;n.forEach(e=>{var t=o?"USER":"CHATGPT",e=(o=!o,Array.from(e.childNodes).map(e=>e.innerText).join("\n\n").replace("Copy code",""));r.push(t+": "+e)}),a=r.join("\n\n")}else for(var l of await chatgpt.getChatData(e,"msg","both","all"))a=(a+=`USER: ${l.user}
|
|
8
8
|
|
|
9
9
|
`)+`CHATGPT: ${l.chatgpt}
|
|
10
10
|
|
package/docs/README.md
CHANGED
|
@@ -44,9 +44,7 @@
|
|
|
44
44
|
|
|
45
45
|
[](https://github.com/KudoAI/chatgpt.js/stargazers)
|
|
46
46
|
[](https://github.com/KudoAI/chatgpt.js/blob/main/LICENSE.md)
|
|
47
|
-
[
|
|
49
|
-
[](https://github.com/KudoAI/chatgpt.js/tree/v3.3.3/dist/chatgpt.min.js)
|
|
47
|
+
[](https://github.com/KudoAI/chatgpt.js/tree/v3.3.4/dist/chatgpt.min.js)
|
|
50
48
|
[](https://www.codefactor.io/repository/github/kudoai/chatgpt.js)
|
|
51
49
|
[](https://sonarcloud.io/component_measures?metric=new_vulnerabilities&id=kudoai_chatgpt.js)
|
|
52
50
|
[](https://github.com/sindresorhus/awesome-chatgpt#javascript)
|
|
@@ -84,7 +82,7 @@
|
|
|
84
82
|
|
|
85
83
|
```js
|
|
86
84
|
(async () => {
|
|
87
|
-
await import('https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@3.3.
|
|
85
|
+
await import('https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@3.3.4/dist/chatgpt.min.js');
|
|
88
86
|
// Your code here...
|
|
89
87
|
})();
|
|
90
88
|
```
|
|
@@ -93,7 +91,7 @@
|
|
|
93
91
|
|
|
94
92
|
```js
|
|
95
93
|
var xhr = new XMLHttpRequest();
|
|
96
|
-
xhr.open('GET', 'https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@3.3.
|
|
94
|
+
xhr.open('GET', 'https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@3.3.4/dist/chatgpt.min.js');
|
|
97
95
|
xhr.onload = function () {
|
|
98
96
|
if (xhr.status === 200) {
|
|
99
97
|
var chatgptJS = document.createElement('script');
|
|
@@ -115,7 +113,7 @@ function yourCode() {
|
|
|
115
113
|
|
|
116
114
|
```js
|
|
117
115
|
...
|
|
118
|
-
// @require https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@3.3.
|
|
116
|
+
// @require https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@3.3.4/dist/chatgpt.min.js
|
|
119
117
|
// ==/UserScript==
|
|
120
118
|
|
|
121
119
|
// Your code here...
|
|
@@ -184,7 +182,7 @@ chatgpt.get('reply', 'last');
|
|
|
184
182
|
|
|
185
183
|
Each call equally fetches the last response. If you think it works, it probably will... so just type it!
|
|
186
184
|
|
|
187
|
-
If it didn't, check out the extended [userguide](https://github.com/KudoAI/chatgpt.js/blob/v3.3.
|
|
185
|
+
If it didn't, check out the extended [userguide](https://github.com/KudoAI/chatgpt.js/blob/v3.3.4/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!
|
|
188
186
|
|
|
189
187
|
<img height=8px width="100%" src="https://media.chatgptjs.org/images/separators/gradient-aqua.png?78210a7">
|
|
190
188
|
|
|
@@ -198,7 +196,7 @@ https://github.com/KudoAI/chatgpt.js/assets/10906554/f53c740f-d5e0-49b6-ae02-3b3
|
|
|
198
196
|
|
|
199
197
|
#
|
|
200
198
|
|
|
201
|
-
### <img src="https://amazongpt.kudoai.com/assets/images/icons/amazongpt/black-gold-teal/icon48.png" width=20> [AmazonGPT](https://amazongpt.kudoai.com)
|
|
199
|
+
### <img src="https://amazongpt.kudoai.com/assets/images/icons/amazongpt/black-gold-teal/icon48.png" width=20> [AmazonGPT](https://amazongpt.kudoai.com) <a href="https://devpost.com/software/amazongpt" target="_blank" rel="noopener"><img height=20 src="https://amazongpt.kudoai.com/assets/images/badges/wolfram-award/gold-badge.png" style="margin:0 0 -2px 5px"></a>
|
|
202
200
|
|
|
203
201
|
> Add AI to Amazon shopping.
|
|
204
202
|
<br>[Install](https://greasyfork.org/scripts/500663-amazongpt) /
|
|
@@ -247,7 +245,51 @@ https://github.com/KudoAI/chatgpt.js/assets/10906554/f53c740f-d5e0-49b6-ae02-3b3
|
|
|
247
245
|
[Readme](https://docs.ddgpt.com/#readme) /
|
|
248
246
|
[Discuss](https://github.ddgpt.com/discussions)
|
|
249
247
|
|
|
250
|
-
### <picture><source type="image/png" media="(prefers-color-scheme: dark)" srcset="https://media.googlegpt.io/images/icons/googlegpt/white/icon32.
|
|
248
|
+
### <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>
|
|
249
|
+
|
|
250
|
+
> Adds AI answers to Google Search (powered by Google Gemma + GPT-4o!)
|
|
251
|
+
<br>[Install](https://greasyfork.googlegpt.io) /
|
|
252
|
+
[Readme](https://docs.googlegpt.io/#readme) /
|
|
253
|
+
[Discuss](https://github.googlegpt.io/discussions)
|
|
254
|
+
|
|
255
|
+
### <img width=23 src="https://media.chatgptjs.org/images/icons/platforms/thunderbird/icon32.png?313a9c5"> [ThunderAI](https://micz.it/thunderdbird-addon-thunderai/) <a href="https://addons.thunderbird.net/thunderbird/addon/thunderai/reviews" target="_blank" rel="noopener"><picture><source type="image/png" media="(prefers-color-scheme: dark)" srcset="https://media.chatgptjs.org/images/badges/5-star/blue-stars.png?0943672"><img width=92 alt="[Rated 5-stars]" src="https://media.chatgptjs.org/images/badges/5-star/yellow-stars-in-white-pill.png?0943672"></picture></a>
|
|
256
|
+
|
|
257
|
+
> Use ChatGPT in Thunderbird to enhance you emails, even with a free account!
|
|
258
|
+
<br>[Install](https://addons.thunderbird.net/thunderbird/addon/thunderai/) /
|
|
259
|
+
[Readme](https://micz.it/thunderdbird-addon-thunderai/) /
|
|
260
|
+
[Support](https://github.com/micz/ThunderAI/issues)
|
|
261
|
+
|
|
262
|
+
<p><br>
|
|
263
|
+
|
|
264
|
+
<a href="https://chatgptinfinity.com" target="_blank" rel="noopener">
|
|
265
|
+
<img width=555 src="https://cdn.jsdelivr.net/gh/adamlui/chatgpt-infinity@0f48c4e/chrome/media/images/tiles/marquee-promo-tile-1400x560.png">
|
|
266
|
+
</a>
|
|
267
|
+
|
|
268
|
+
<p><br>
|
|
269
|
+
|
|
270
|
+
<a href="https://chatgptwidescreen.com" target="_blank" rel="noopener">
|
|
271
|
+
<img width=555 src="https://cdn.jsdelivr.net/gh/adamlui/chatgpt-widescreen@3ed0950/chrome/media/images/tiles/marquee-promo-tile-1400x560.png">
|
|
272
|
+
</a>
|
|
273
|
+
|
|
274
|
+
<p><br>
|
|
275
|
+
|
|
276
|
+
<p id="showcase-cta">
|
|
277
|
+
If you've made something w/ chatgpt.js you want to share, email <a href="mailto:showcase@chatgptjs.org">showcase@chatgptjs.org</a> or just open a <a href="https://github.com/KudoAI/chatgpt.js/pulls" target="_blank" rel="noopener">pull request</a>!
|
|
278
|
+
</p>
|
|
279
|
+
|
|
280
|
+
<img height=8px width="100%" src="https://media.chatgptjs.org/images/separators/gradient-aqua.png?78210a7">
|
|
281
|
+
|
|
282
|
+
<div id="contributors">
|
|
283
|
+
|
|
284
|
+
## 🧠 Contributors
|
|
285
|
+
|
|
286
|
+
</div>
|
|
287
|
+
|
|
288
|
+
This library exists thanks to code, translations, issues & ideas from the following contributors:
|
|
289
|
+
|
|
290
|
+
<div align="center"><br>
|
|
291
|
+
|
|
292
|
+
[](https://github.com/adamlui)
|
|
251
293
|
[](https://github.com/mefengl)
|
|
252
294
|
[](https://github.com/Zin6969)
|
|
253
295
|
[](https://github.com/madruga8)
|
|
@@ -266,7 +308,53 @@ https://github.com/KudoAI/chatgpt.js/assets/10906554/f53c740f-d5e0-49b6-ae02-3b3
|
|
|
266
308
|
[](https://github.com/abhinavm24)
|
|
267
309
|
[](https://github.com/deyvisml)
|
|
268
310
|
[](https://github.com/philly88r)
|
|
269
|
-
[](https://github.com/thomasgauthier)
|
|
312
|
+
[](https://github.com/pranav-bhatt)
|
|
313
|
+
[](https://github.com/gadelkareem)
|
|
314
|
+
[](https://github.com/hopana)
|
|
315
|
+
[](https://github.com/emtry)
|
|
316
|
+
[](https://github.com/thedayofcondor)
|
|
317
|
+
[](https://github.com/Luwa-Tech)
|
|
318
|
+
[](https://github.com/micz)
|
|
319
|
+
[](https://github.com/imranaalam)
|
|
320
|
+
[](https://github.com/grayfallstown)
|
|
321
|
+
[](https://github.com/svan-b)
|
|
322
|
+
[](https://github.com/Jeff-Zzh)
|
|
323
|
+
[](https://github.com/ae3e)
|
|
324
|
+
[](https://github.com/dependabot)
|
|
325
|
+
<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>
|
|
326
|
+
<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>
|
|
327
|
+
[](https://github.com/ImgBotApp)
|
|
328
|
+
|
|
329
|
+
</div><br>
|
|
330
|
+
|
|
331
|
+
<img height=8px width="100%" src="https://media.chatgptjs.org/images/separators/gradient-aqua.png?78210a7">
|
|
332
|
+
|
|
333
|
+
<div id="partners">
|
|
334
|
+
|
|
335
|
+
## 🤝 Partners
|
|
336
|
+
|
|
337
|
+
</div>
|
|
338
|
+
|
|
339
|
+
**chatgpt.js** is funded in part by:
|
|
340
|
+
|
|
341
|
+
<div id="partners-collage" align="center">
|
|
342
|
+
|
|
343
|
+
<picture>
|
|
344
|
+
<source type="image/png" media="(prefers-color-scheme: dark)" srcset="https://media.chatgptjs.org/images/logos/partners/collage/white.png?3109608">
|
|
345
|
+
<img width=888 src="https://media.chatgptjs.org/images/logos/partners/collage/black.png?3109608">
|
|
346
|
+
</picture>
|
|
347
|
+
|
|
348
|
+
</div>
|
|
349
|
+
|
|
350
|
+
<br>
|
|
351
|
+
|
|
352
|
+
<img height=8px width="100%" src="https://media.chatgptjs.org/images/separators/gradient-aqua.png?78210a7">
|
|
353
|
+
|
|
354
|
+
<div align="center">
|
|
355
|
+
|
|
356
|
+
**[Releases](https://github.com/KudoAI/chatgpt.js/releases)** /
|
|
357
|
+
[Userguide](https://github.com/KudoAI/chatgpt.js/blob/v3.3.4/docs/USERGUIDE.md) /
|
|
270
358
|
[Discuss](https://github.com/KudoAI/chatgpt.js/discussions) /
|
|
271
359
|
<a href="#--------------------------------------------------------------------------------english---------简体中文---------繁體中文---------日本---------한국인---------हिंदी---------नेपाली---------deutsch---------español---------français---------italiano---------nederlands---------português---------việt----">Back to top ↑</a>
|
|
272
360
|
|
package/docs/USERGUIDE.md
CHANGED
|
@@ -159,7 +159,7 @@
|
|
|
159
159
|
|
|
160
160
|
```js
|
|
161
161
|
(async () => {
|
|
162
|
-
await import('https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@3.3.
|
|
162
|
+
await import('https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@3.3.4/dist/chatgpt.min.js');
|
|
163
163
|
// Your code here...
|
|
164
164
|
})();
|
|
165
165
|
```
|
|
@@ -168,7 +168,7 @@
|
|
|
168
168
|
|
|
169
169
|
```js
|
|
170
170
|
var xhr = new XMLHttpRequest();
|
|
171
|
-
xhr.open('GET', 'https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@3.3.
|
|
171
|
+
xhr.open('GET', 'https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@3.3.4/dist/chatgpt.min.js');
|
|
172
172
|
xhr.onload = function () {
|
|
173
173
|
if (xhr.status === 200) {
|
|
174
174
|
var chatgptJS = document.createElement('script');
|
|
@@ -190,7 +190,7 @@ function yourCode() {
|
|
|
190
190
|
|
|
191
191
|
```js
|
|
192
192
|
...
|
|
193
|
-
// @require https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@3.3.
|
|
193
|
+
// @require https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@3.3.4/dist/chatgpt.min.js
|
|
194
194
|
// ==/UserScript==
|
|
195
195
|
|
|
196
196
|
// Your code here...
|
package/package.json
CHANGED
|
@@ -3,13 +3,13 @@
|
|
|
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.10.3
|
|
6
|
+
// @version 2024.10.3.1
|
|
7
7
|
// @license MIT
|
|
8
8
|
// @match *://chatgpt.com/*
|
|
9
9
|
// @match *://chat.openai.com/*
|
|
10
|
-
// @icon https://cdn.jsdelivr.net/gh/KudoAI/chatgpt.js@3.3.
|
|
11
|
-
// @icon64 https://cdn.jsdelivr.net/gh/KudoAI/chatgpt.js@3.3.
|
|
12
|
-
// @require https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@3.3.
|
|
10
|
+
// @icon https://cdn.jsdelivr.net/gh/KudoAI/chatgpt.js@3.3.4/starters/greasemonkey/media/images/icons/robot/icon48.png
|
|
11
|
+
// @icon64 https://cdn.jsdelivr.net/gh/KudoAI/chatgpt.js@3.3.4/starters/greasemonkey/media/images/icons/robot/icon64.png
|
|
12
|
+
// @require https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@3.3.4/dist/chatgpt.min.js
|
|
13
13
|
// @grant GM_getValue
|
|
14
14
|
// @grant GM_setValue
|
|
15
15
|
// @noframes
|