@kudoai/chatgpt.js 3.6.1 → 3.6.2

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
@@ -49,8 +49,8 @@
49
49
  <img src="https://img.shields.io/github/stars/KudoAI/chatgpt.js?label=Stars&color=af68ff&logo=github&logoColor=white&labelColor=464646&style=for-the-badge"></a>
50
50
  <a href="https://github.com/KudoAI/chatgpt.js/blob/main/LICENSE.md">
51
51
  <img src="https://img.shields.io/badge/License-MIT-green.svg?logo=internetarchive&logoColor=white&labelColor=464646&style=for-the-badge"></a>
52
- <a href="https://github.com/KudoAI/chatgpt.js/tree/v3.6.1/dist/chatgpt.min.js">
53
- <img src="https://img.shields.io/github/size/KudoAI/chatgpt.js/dist/chatgpt.min.js?branch=v3.6.1&label=Minified%20Size&logo=databricks&logoColor=white&labelColor=464646&color=ff69b4&style=for-the-badge"></a>
52
+ <a href="https://github.com/KudoAI/chatgpt.js/tree/v3.6.2/dist/chatgpt.min.js">
53
+ <img src="https://img.shields.io/github/size/KudoAI/chatgpt.js/dist/chatgpt.min.js?branch=v3.6.2&label=Minified%20Size&logo=databricks&logoColor=white&labelColor=464646&color=ff69b4&style=for-the-badge"></a>
54
54
  <a href="https://www.codefactor.io/repository/github/kudoai/chatgpt.js">
55
55
  <img src="https://img.shields.io/codefactor/grade/github/kudoai/chatgpt.js?label=Code+Quality&logo=codefactor&logoColor=white&labelColor=464646&color=1acc6c&style=for-the-badge"></a>
56
56
  <a href="https://sonarcloud.io/component_measures?metric=new_vulnerabilities&id=kudoai_chatgpt.js">
@@ -94,7 +94,7 @@
94
94
 
95
95
  ```js
96
96
  (async () => {
97
- await import('https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@3.6.1/dist/chatgpt.min.js');
97
+ await import('https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@3.6.2/dist/chatgpt.min.js');
98
98
  // Your code here...
99
99
  })();
100
100
  ```
@@ -103,7 +103,7 @@
103
103
 
104
104
  ```js
105
105
  var xhr = new XMLHttpRequest();
106
- xhr.open('GET', 'https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@3.6.1/dist/chatgpt.min.js');
106
+ xhr.open('GET', 'https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@3.6.2/dist/chatgpt.min.js');
107
107
  xhr.onload = function () {
108
108
  if (xhr.status === 200) {
109
109
  var chatgptJS = document.createElement('script');
@@ -126,7 +126,7 @@ function yourCode() {
126
126
 
127
127
  ```js
128
128
  ...
129
- // @require https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@3.6.1/dist/chatgpt.min.js
129
+ // @require https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@3.6.2/dist/chatgpt.min.js
130
130
  // ==/UserScript==
131
131
 
132
132
  // Your code here...
@@ -196,7 +196,7 @@ chatgpt.get('reply', 'last');
196
196
 
197
197
  Each call equally fetches the last response. If you think it works, it probably will... so just type it!
198
198
 
199
- If it didn't, check out the extended [userguide](https://github.com/KudoAI/chatgpt.js/blob/v3.6.1/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!
199
+ If it didn't, check out the extended [userguide](https://github.com/KudoAI/chatgpt.js/blob/v3.6.2/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!
200
200
 
201
201
  <img height=8px width="100%" src="https://assets.chatgptjs.org/images/separators/gradient-aqua.png?v=e638eac">
202
202
 
@@ -427,7 +427,7 @@ This library exists thanks to code, translations, issues & ideas from the follow
427
427
  <div align="center">
428
428
 
429
429
  **[Releases](https://github.com/KudoAI/chatgpt.js/releases)** /
430
- [Userguide](https://github.com/KudoAI/chatgpt.js/blob/v3.6.1/docs/USERGUIDE.md) /
430
+ [Userguide](https://github.com/KudoAI/chatgpt.js/blob/v3.6.2/docs/USERGUIDE.md) /
431
431
  [Discuss](https://github.com/KudoAI/chatgpt.js/discussions) /
432
432
  [Back to top ↑](#top)
433
433
 
package/chatgpt.js CHANGED
@@ -950,7 +950,12 @@ const chatgpt = {
950
950
  getLastResponse() { return chatgpt.getChatData('active', 'msg', 'chatgpt', 'latest'); },
951
951
 
952
952
  getNewChatButton() {
953
- return document.querySelector('button[data-testid*=new-chat-button], button:has([d^="M15.6729"])'); },
953
+ return document.querySelector(
954
+ 'button[data-testid*=new-chat-button],' // sidebar button (when logged in)
955
+ + 'button:has([d^="M3.06957"]),' // Cycle Arrows icon (Temp chat mode)
956
+ + 'button:has([d^="M15.6729"])' // Pencil icon (recorded chat mode)
957
+ )
958
+ },
954
959
 
955
960
  getNewChatLink() { return document.querySelector('nav a[href="/"]'); },
956
961
  getRegenerateButton() { return document.querySelector('button:has([d^="M3.06957"])'); },
@@ -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@8de49380de975451ab39b7c1588cbabdab3b255f",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((r,a)=>{let n=new XMLHttpRequest;n.open("GET","https://cdn.jsdelivr.net/gh/KudoAI/chat-prompts@8de49380de975451ab39b7c1588cbabdab3b255f/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 o of e)console.log("%c"+o.title,"font-family: monospace ; font-size: larger ;")}return r()}})},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(o,r,e,a,t){let n=chatgpt.isDarkMode()?"dark":"light",s=chatgpt.browser.isMobile(),i={dismiss:{click(e){e.target!=e.currentTarget&&!e.target.closest("[class*=-close-btn]")||f()},key(e){if(/^(?: |Space|Enter|Return|Esc)/.test(e.key)&&[32,13,27].includes(e.keyCode))for(var t of m){var t=document.getElementById(t);if(!t||"none"==t.style.display)return;e.key.startsWith("Esc")||27==e.keyCode?f():(t=t.querySelector(".modal-buttons").lastChild)&&(t.click(),e.preventDefault())}}},drag:{mousedown(e){var t;0==e.button&&"pointer"!=getComputedStyle(e.target).cursor&&(chatgpt.draggableElem=e.currentTarget,Object.assign(chatgpt.draggableElem.style,{cursor:"grabbing",transition:"0.1s",willChange:"transform",transform:"scale(1.05)"}),e.preventDefault(),["mousemove","mouseup"].forEach(e=>document.addEventListener(e,i.drag[e])),t=chatgpt.draggableElem.getBoundingClientRect(),i.drag.offsetX=e.clientX-t.left+21,i.drag.offsetY=e.clientY-t.top+12)},mousemove(e){var t;chatgpt.draggableElem&&(t=e.clientX-i.drag.offsetX,e=e.clientY-i.drag.offsetY,Object.assign(chatgpt.draggableElem.style,{left:t+"px",top:e+"px"}))},mouseup(){Object.assign(chatgpt.draggableElem.style,{cursor:"inherit",transition:"inherit",willChange:"auto",transform:"scale(1)"}),["mousemove","mouseup"].forEach(e=>document.removeEventListener(e,i.drag[e])),chatgpt.draggableElem=null}}},c=document.createElement("div"),l=(c.id=Math.floor(1e6*chatgpt.randomFloat())+Date.now(),c.classList.add("chatgpt-modal"),document.createElement("div")),d=document.createElement("h2"),g=document.createElement("p");var u=1735768363880;let h=document.querySelector("#chatgpt-modal-style"),p=((!h||parseInt(h.getAttribute("last-updated"),10)<u)&&(h||((h=document.createElement("style")).id="chatgpt-modal-style",h.setAttribute("last-updated",u.toString()),document.head.append(h)),h.innerText=".chatgpt-modal {--transition: opacity 0.65s cubic-bezier(.165,.84,.44,1),transform 0.55s cubic-bezier(.165,.84,.44,1) ;--bg-transition: background-color 0.25s ease }.no-mobile-tap-outline { outline: none ; -webkit-tap-highlight-color: transparent }.chatgpt-modal {pointer-events: auto ;position: fixed ; top: 0 ; left: 0 ; width: 100% ; height: 100% ;display: flex ; justify-content: center ; align-items: center ; z-index: 9999 ;transition: var(--bg-transition) ;-webkit-transition: var(--bg-transition) ; -moz-transition: var(--bg-transition) ;-o-transition: var(--bg-transition) ; -ms-transition: var(--bg-transition) }.chatgpt-modal > div {position: absolute ;opacity: 0 ;"+`border: 1px solid ${"dark"==n?"white":"#b5b5b5"};`+`color: ${"dark"==n?"white":"black"};`+`background-color: ${"dark"==n?"black":"white"};`+"transform: translateX(-3px) translateY(7px) ;max-width: 75vw ; word-wrap: break-word ; border-radius: 15px ;padding: 20px ; margin: 12px 23px ;"+`--shadow: 0 30px 60px rgba(0,0,0,0.12) ; box-shadow: var(--shadow) ;
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@ba59cc9a07a4a5c648a5228eca6bb1f1272c43dd",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((r,a)=>{let n=new XMLHttpRequest;n.open("GET","https://cdn.jsdelivr.net/gh/KudoAI/chat-prompts@ba59cc9a07a4a5c648a5228eca6bb1f1272c43dd/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 o of e)console.log("%c"+o.title,"font-family: monospace ; font-size: larger ;")}return r()}})},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(o,r,e,a,t){let n=chatgpt.isDarkMode()?"dark":"light",s=chatgpt.browser.isMobile(),i={dismiss:{click(e){e.target!=e.currentTarget&&!e.target.closest("[class*=-close-btn]")||f()},key(e){if(/^(?: |Space|Enter|Return|Esc)/.test(e.key)&&[32,13,27].includes(e.keyCode))for(var t of m){var t=document.getElementById(t);if(!t||"none"==t.style.display)return;e.key.startsWith("Esc")||27==e.keyCode?f():(t=t.querySelector(".modal-buttons").lastChild)&&(t.click(),e.preventDefault())}}},drag:{mousedown(e){var t;0==e.button&&"pointer"!=getComputedStyle(e.target).cursor&&(chatgpt.draggableElem=e.currentTarget,Object.assign(chatgpt.draggableElem.style,{cursor:"grabbing",transition:"0.1s",willChange:"transform",transform:"scale(1.05)"}),e.preventDefault(),["mousemove","mouseup"].forEach(e=>document.addEventListener(e,i.drag[e])),t=chatgpt.draggableElem.getBoundingClientRect(),i.drag.offsetX=e.clientX-t.left+21,i.drag.offsetY=e.clientY-t.top+12)},mousemove(e){var t;chatgpt.draggableElem&&(t=e.clientX-i.drag.offsetX,e=e.clientY-i.drag.offsetY,Object.assign(chatgpt.draggableElem.style,{left:t+"px",top:e+"px"}))},mouseup(){Object.assign(chatgpt.draggableElem.style,{cursor:"inherit",transition:"inherit",willChange:"auto",transform:"scale(1)"}),["mousemove","mouseup"].forEach(e=>document.removeEventListener(e,i.drag[e])),chatgpt.draggableElem=null}}},c=document.createElement("div"),l=(c.id=Math.floor(1e6*chatgpt.randomFloat())+Date.now(),c.classList.add("chatgpt-modal"),document.createElement("div")),d=document.createElement("h2"),g=document.createElement("p");var u=1735768363880;let h=document.querySelector("#chatgpt-modal-style"),p=((!h||parseInt(h.getAttribute("last-updated"),10)<u)&&(h||((h=document.createElement("style")).id="chatgpt-modal-style",h.setAttribute("last-updated",u.toString()),document.head.append(h)),h.innerText=".chatgpt-modal {--transition: opacity 0.65s cubic-bezier(.165,.84,.44,1),transform 0.55s cubic-bezier(.165,.84,.44,1) ;--bg-transition: background-color 0.25s ease }.no-mobile-tap-outline { outline: none ; -webkit-tap-highlight-color: transparent }.chatgpt-modal {pointer-events: auto ;position: fixed ; top: 0 ; left: 0 ; width: 100% ; height: 100% ;display: flex ; justify-content: center ; align-items: center ; z-index: 9999 ;transition: var(--bg-transition) ;-webkit-transition: var(--bg-transition) ; -moz-transition: var(--bg-transition) ;-o-transition: var(--bg-transition) ; -ms-transition: var(--bg-transition) }.chatgpt-modal > div {position: absolute ;opacity: 0 ;"+`border: 1px solid ${"dark"==n?"white":"#b5b5b5"};`+`color: ${"dark"==n?"white":"black"};`+`background-color: ${"dark"==n?"black":"white"};`+"transform: translateX(-3px) translateY(7px) ;max-width: 75vw ; word-wrap: break-word ; border-radius: 15px ;padding: 20px ; margin: 12px 23px ;"+`--shadow: 0 30px 60px rgba(0,0,0,0.12) ; box-shadow: var(--shadow) ;
8
8
  -webkit-box-shadow: var(--shadow) ; -moz-box-shadow: var(--shadow) ;`+"user-select: none ; -webkit-user-select: none ; -moz-user-select: none ; -o-user-select: none ;-ms-user-select: none ;transition: var(--transition) ;-webkit-transition: var(--transition) ; -moz-transition: var(--transition) ;-o-transition: var(--transition) ; -ms-transition: var(--transition) }"+`.chatgpt-modal h2 { margin-bottom: 9px }
9
9
  .chatgpt-modal a { color: ${"dark"==n?"#00cfff":"#1e9ebb"}}
10
10
  .chatgpt-modal a:hover { text-decoration: underline }
@@ -30,7 +30,7 @@ localStorage.alertQueue=JSON.stringify([]),localStorage.notifyProps=JSON.stringi
30
30
 
31
31
  `)+`CHATGPT: ${l.chatgpt}
32
32
 
33
- `}else{s=await(await fetch(await chatgpt.shareChat(e))).text(),i=(new DOMParser).parseFromString(s,"text/html");o=`${i.querySelector("title").textContent||"ChatGPT conversation"}.html`,i.querySelectorAll("link[rel=stylesheet]").forEach(e=>{var t=e.getAttribute("href");t?.startsWith("/")&&e.setAttribute("href","https://chat.openai.com"+t)}),a=(new XMLSerializer).serializeToString(i)}if(console.info(`Exporting transcript as ${t.toUpperCase()}...`),"pdf"==t){a=a.replace(/<svg.*?<\/svg>/g,e=>`<img src="${"data:image/svg+xml,"+encodeURIComponent(e)}">`);let e=window.open("","","toolbar=0, location=0, menubar=0, height=600, width=800");e.document.write(a),setTimeout(()=>{e.print({toPDF:!0})},100)}else{"md"==t&&(c=/<.*<h1(.|\n)*?href=".*?continue[^"]*".*?\/a>.*?<[^/]/.exec(a)[1],a=c||a,o=o.replace(".html",".md"));r=new Blob([a],{type:"text/"+("html"==t?"html":"md"==t?"markdown":"plain")}),n=document.createElement("a"),e=URL.createObjectURL(r);n.href=e,n.download=o,document.body.append(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(e)}},extractCode(){chatgpt.code.extract()},focusChatbar(){chatgpt.getChatBox()?.focus()},footer:{get(){return document.querySelector(".min-h-4")},hide(){var e=chatgpt.footer.get();return e?"hidden"==e.style.visibility?console.info("Footer already hidden!"):void(e.style.display="none"):console.error("Footer element not found!")},show(){var e=chatgpt.footer.get();return e?"hidden"!=e.style.visibility?console.info("Footer already shown!"):void(e.style.display="inherit"):console.error("Footer element not found!")}},generateRandomIP(){var e=Array.from({length:4},()=>Math.floor(256*chatgpt.randomFloat())).join(".");return console.info("IP generated: "+e),e},get(e,t=""){if("string"!=typeof e||"string"!=typeof t)throw new TypeError("Invalid arguments. Both arguments must be strings.");if(!cjsTargetTypes.includes(e.toLowerCase()))throw new Error("Invalid targetType: "+e+". Valid values are: "+JSON.stringify(cjsTargetTypes));var o,r=[],a=new RegExp("^get(.*)"+e+"$","i");for(o in chatgpt)"function"==typeof chatgpt[o]&&a.test(o)&&r.push(o.replace(a,"$1").toLowerCase());if(!r.includes(t.toLowerCase()))throw new Error("Invalid targetName: "+t+". "+(0<r.length?"Valid values are: "+JSON.stringify(r):"targetType "+e.toLowerCase()+" does not require additional options."));let n=("get"+t+e).toLowerCase();return this[Object.keys(this).find(e=>e.toLowerCase()==n)]()},getAccessToken(){return new Promise((e,t)=>{if(0<Object.keys(chatgpt.openAIaccessToken).length&&0<=Date.parse(chatgpt.openAIaccessToken.expireDate)-Date.parse(new Date))return e(chatgpt.openAIaccessToken.token);let o=new XMLHttpRequest;o.open("GET",chatgpt.endpoints.openAI.session,!0),o.setRequestHeader("Content-Type","application/json"),o.onload=()=>200!==o.status?t("🤖 chatgpt.js >> Request failed. Cannot retrieve access token."):(console.info("Token expiration: "+new Date(JSON.parse(o.responseText).expires).toLocaleString().replace(","," at")),chatgpt.openAIaccessToken={token:JSON.parse(o.responseText).accessToken,expireDate:JSON.parse(o.responseText).expires},e(chatgpt.openAIaccessToken.token)),o.send()})},getAccountDetails(...s){var e,t=["email","id","image","name","picture"];for(e of s=arguments[0]?Array.isArray(arguments[0])?arguments[0]:Array.from(arguments):t)if(!t.includes(e))return console.error("Invalid detail arg '"+e+"' supplied. Valid details are:\n ["+t+"]");return new Promise((r,a)=>{let n=new XMLHttpRequest;n.open("GET",chatgpt.endpoints.openAI.session,!0),n.setRequestHeader("Content-Type","application/json"),n.onload=()=>{if(200!==n.status)return a("🤖 chatgpt.js >> Request failed. Cannot retrieve account details.");var e,t=JSON.parse(n.responseText).user,o={};for(e of s)o[e]=t[e];return r(o)},n.send()})},getChatBox(){return document.getElementById("prompt-textarea")},getChatData(d=1,r="all",h="all",p="all"){var e,t=["all","id","title","create_time","update_time","msg"],o=["all","both","user","chatgpt"];d=d?Number.isInteger(d)||/^\d+$/.test(d)?0===parseInt(d,10)?0:parseInt(d,10)-1:d:"active",r=["all",""].includes(r)?t.filter(e=>/^(?!all$|msg$).*/.test(e)):Array.isArray(r)?r:[r],h=h?o.includes(h)?h:"invalid":"all",p=Number.isInteger(p)||/^\d+$/.test(p)?0===parseInt(p,10)?0:parseInt(p,10)-1:["all","latest"].includes(p.toLowerCase())?p.toLowerCase():p?"invalid":"all";for(e of r)if(!t.includes(e))return console.error("Invalid detail arg '"+e+"' passed. Valid details are:\n ["+t+"]");if("invalid"==h)return console.error("Invalid sender arg passed. Valid senders are:\n ["+o+"]");if("invalid"==p)return console.error("Invalid msgToGet arg passed. Valid msg's to get are:\n [ 'all' | 'latest' | index of msg to get ]");let a=(e,c)=>{let l=/\w{8}-\w{4}-\w{4}-\w{4}-\w{12}/;return new Promise((t,s)=>{let i=new XMLHttpRequest;i.open("GET",chatgpt.endpoints.openAI.chats,!0),i.setRequestHeader("Content-Type","application/json"),i.setRequestHeader("Authorization","Bearer "+e),i.onload=()=>{if(200!==i.status)return s("🤖 chatgpt.js >> Request failed. Cannot retrieve chat details.");var o=JSON.parse(i.responseText).items;if(o.length<=0)return s("🤖 chatgpt.js >> Chat list is empty.");var r={};if(Number.isInteger(d)||"latest"==d||"active"==d&&!new RegExp("/"+l.source+"$").test(window.location.href)){if((d=Number.isInteger(d)?d:0)>o.length)return s("🤖 chatgpt.js >> Chat with index "+(d+1)+" is out of bounds. Only "+o.length+" chats exist!");for(var e of c)r[e]=o[d][e]}else{var a,n="active"==d||new RegExp("^"+l.source+"$").test(d)?"id":"title";"active"==d&&(d=l.exec(window.location.href)[0]);let e,t;for(e=0;e<o.length;e++)if(o[e][n]==d){t=!0;break}if(!t)return s("🤖 chatgpt.js >> No chat with "+n+" = "+d+" found.");for(a of c)r[a]=o[e][a]}return t(r)},i.send()})};return new Promise(o=>chatgpt.getAccessToken().then(e=>{return o(r.includes("msg")?(t=e,new Promise((d,g)=>{let u=new XMLHttpRequest;a(t,["id"]).then(e=>{u.open("GET",chatgpt.endpoints.openAI.chat+"/"+e.id,!0),u.setRequestHeader("Content-Type","application/json"),u.setRequestHeader("Authorization","Bearer "+t),u.onload=()=>{if(200!==u.status)return g("🤖 chatgpt.js >> Request failed. Cannot retrieve chat messages.");var e,t,o=JSON.parse(u.responseText).mapping,r=[],a=[],n=[];for(e in o)null!=o[e].message&&"user"==o[e].message.author.role&&r.push({id:o[e].id,msg:o[e].message});if(r.sort((e,t)=>e.msg.create_time-t.msg.create_time),parseInt(p,10)+1>r.length)return g("🤖 chatgpt.js >> Message/response with index "+(p+1)+" is out of bounds. Only "+r.length+" messages/responses exist!");for(t of r){let e=[];for(var s in o)null!=o[s].message&&"assistant"==o[s].message.author.role&&o[s].parent==t.id&&e.push(o[s].message);e.sort((e,t)=>e.create_time-t.create_time),e=1===(e=e.map(e=>{switch(e.content.content_type){case"code":return e.content.text;case"text":return e.content.parts[0];default:return}})).length?e[0]:e,a.push(e)}if("user"==h)for(var i in r)n.push(r[i].msg.content.parts[0]);else if("chatgpt"==h)for(var c of a)n.push("latest"==p?a[a.length-1]:c);else{let e=0;for(var l in r)n.push({user:r[l].msg.content.parts[0],chatgpt:"latest"==p?a[e][a[e].length-1]:a[e]}),e++}return d("all"==p?n:"latest"==p?n[n.length-1]:n[p])},u.send()})})):a(e,r));var t}))},getChatInput(){return chatgpt.getChatBox().firstChild.innerText},getContinueButton(){return document.querySelector('button.btn:has([d^="M4.47189"])')},getFooterDiv(){return chatgpt.footer.get()},getHeaderDiv(){return chatgpt.header.get()},getLastPrompt(){return chatgpt.getChatData("active","msg","user","latest")},getLastResponse(){return chatgpt.getChatData("active","msg","chatgpt","latest")},getNewChatButton(){return document.querySelector('button[data-testid*=new-chat-button], button:has([d^="M15.6729"])')},getNewChatLink(){return document.querySelector('nav a[href="/"]')},getRegenerateButton(){return document.querySelector('button:has([d^="M3.06957"])')},getResponse(){return chatgpt.response.get(...arguments)},getResponseFromAPI(e,t){return chatgpt.response.getFromAPI(e,t)},getResponseFromDOM(e){return chatgpt.response.getFromDOM(e)},getScrollToBottomButton(){return document.querySelector('button:has([d^="M12 21C11.7348"])')},getSendButton(){return document.querySelector("[data-testid=send-button]")},getStopButton(){return document.querySelector("button[data-testid=stop-button]")},getUserLanguage(){return navigator.languages[0]||navigator.language||navigator.browserLanguage||navigator.systemLanguage||navigator.userLanguage||""},header:{get(){return document.querySelector("main .sticky")},hide(){chatgpt.header.get().style.display="none"},show(){chatgpt.header.get().style.display="flex"}},hideFooter(){chatgpt.footer.hide()},hideHeader(){chatgpt.header.hide()},history:{async isLoaded(t=null){var e=t?new Promise(e=>setTimeout(()=>e(!1),t)):null,o=new Promise(o=>{document.querySelector("nav")?o(!0):new MutationObserver((e,t)=>{document.querySelector("nav")&&(t.disconnect(),o(!0))}).observe(document.documentElement,{childList:!0,subtree:!0})});return e?Promise.race([o,e]):o}},instructions:{add(r,a){var e;return r?"string"!=typeof r?console.error("Instruction must be a string"):(e=["user","chatgpt"],a?"string"!=typeof a?console.error("Target must be a string"):(a=a.toLowerCase(),e.includes(a)?(r=`
33
+ `}else{s=await(await fetch(await chatgpt.shareChat(e))).text(),i=(new DOMParser).parseFromString(s,"text/html");o=`${i.querySelector("title").textContent||"ChatGPT conversation"}.html`,i.querySelectorAll("link[rel=stylesheet]").forEach(e=>{var t=e.getAttribute("href");t?.startsWith("/")&&e.setAttribute("href","https://chat.openai.com"+t)}),a=(new XMLSerializer).serializeToString(i)}if(console.info(`Exporting transcript as ${t.toUpperCase()}...`),"pdf"==t){a=a.replace(/<svg.*?<\/svg>/g,e=>`<img src="${"data:image/svg+xml,"+encodeURIComponent(e)}">`);let e=window.open("","","toolbar=0, location=0, menubar=0, height=600, width=800");e.document.write(a),setTimeout(()=>{e.print({toPDF:!0})},100)}else{"md"==t&&(c=/<.*<h1(.|\n)*?href=".*?continue[^"]*".*?\/a>.*?<[^/]/.exec(a)[1],a=c||a,o=o.replace(".html",".md"));r=new Blob([a],{type:"text/"+("html"==t?"html":"md"==t?"markdown":"plain")}),n=document.createElement("a"),e=URL.createObjectURL(r);n.href=e,n.download=o,document.body.append(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(e)}},extractCode(){chatgpt.code.extract()},focusChatbar(){chatgpt.getChatBox()?.focus()},footer:{get(){return document.querySelector(".min-h-4")},hide(){var e=chatgpt.footer.get();return e?"hidden"==e.style.visibility?console.info("Footer already hidden!"):void(e.style.display="none"):console.error("Footer element not found!")},show(){var e=chatgpt.footer.get();return e?"hidden"!=e.style.visibility?console.info("Footer already shown!"):void(e.style.display="inherit"):console.error("Footer element not found!")}},generateRandomIP(){var e=Array.from({length:4},()=>Math.floor(256*chatgpt.randomFloat())).join(".");return console.info("IP generated: "+e),e},get(e,t=""){if("string"!=typeof e||"string"!=typeof t)throw new TypeError("Invalid arguments. Both arguments must be strings.");if(!cjsTargetTypes.includes(e.toLowerCase()))throw new Error("Invalid targetType: "+e+". Valid values are: "+JSON.stringify(cjsTargetTypes));var o,r=[],a=new RegExp("^get(.*)"+e+"$","i");for(o in chatgpt)"function"==typeof chatgpt[o]&&a.test(o)&&r.push(o.replace(a,"$1").toLowerCase());if(!r.includes(t.toLowerCase()))throw new Error("Invalid targetName: "+t+". "+(0<r.length?"Valid values are: "+JSON.stringify(r):"targetType "+e.toLowerCase()+" does not require additional options."));let n=("get"+t+e).toLowerCase();return this[Object.keys(this).find(e=>e.toLowerCase()==n)]()},getAccessToken(){return new Promise((e,t)=>{if(0<Object.keys(chatgpt.openAIaccessToken).length&&0<=Date.parse(chatgpt.openAIaccessToken.expireDate)-Date.parse(new Date))return e(chatgpt.openAIaccessToken.token);let o=new XMLHttpRequest;o.open("GET",chatgpt.endpoints.openAI.session,!0),o.setRequestHeader("Content-Type","application/json"),o.onload=()=>200!==o.status?t("🤖 chatgpt.js >> Request failed. Cannot retrieve access token."):(console.info("Token expiration: "+new Date(JSON.parse(o.responseText).expires).toLocaleString().replace(","," at")),chatgpt.openAIaccessToken={token:JSON.parse(o.responseText).accessToken,expireDate:JSON.parse(o.responseText).expires},e(chatgpt.openAIaccessToken.token)),o.send()})},getAccountDetails(...s){var e,t=["email","id","image","name","picture"];for(e of s=arguments[0]?Array.isArray(arguments[0])?arguments[0]:Array.from(arguments):t)if(!t.includes(e))return console.error("Invalid detail arg '"+e+"' supplied. Valid details are:\n ["+t+"]");return new Promise((r,a)=>{let n=new XMLHttpRequest;n.open("GET",chatgpt.endpoints.openAI.session,!0),n.setRequestHeader("Content-Type","application/json"),n.onload=()=>{if(200!==n.status)return a("🤖 chatgpt.js >> Request failed. Cannot retrieve account details.");var e,t=JSON.parse(n.responseText).user,o={};for(e of s)o[e]=t[e];return r(o)},n.send()})},getChatBox(){return document.getElementById("prompt-textarea")},getChatData(d=1,r="all",h="all",p="all"){var e,t=["all","id","title","create_time","update_time","msg"],o=["all","both","user","chatgpt"];d=d?Number.isInteger(d)||/^\d+$/.test(d)?0===parseInt(d,10)?0:parseInt(d,10)-1:d:"active",r=["all",""].includes(r)?t.filter(e=>/^(?!all$|msg$).*/.test(e)):Array.isArray(r)?r:[r],h=h?o.includes(h)?h:"invalid":"all",p=Number.isInteger(p)||/^\d+$/.test(p)?0===parseInt(p,10)?0:parseInt(p,10)-1:["all","latest"].includes(p.toLowerCase())?p.toLowerCase():p?"invalid":"all";for(e of r)if(!t.includes(e))return console.error("Invalid detail arg '"+e+"' passed. Valid details are:\n ["+t+"]");if("invalid"==h)return console.error("Invalid sender arg passed. Valid senders are:\n ["+o+"]");if("invalid"==p)return console.error("Invalid msgToGet arg passed. Valid msg's to get are:\n [ 'all' | 'latest' | index of msg to get ]");let a=(e,c)=>{let l=/\w{8}-\w{4}-\w{4}-\w{4}-\w{12}/;return new Promise((t,s)=>{let i=new XMLHttpRequest;i.open("GET",chatgpt.endpoints.openAI.chats,!0),i.setRequestHeader("Content-Type","application/json"),i.setRequestHeader("Authorization","Bearer "+e),i.onload=()=>{if(200!==i.status)return s("🤖 chatgpt.js >> Request failed. Cannot retrieve chat details.");var o=JSON.parse(i.responseText).items;if(o.length<=0)return s("🤖 chatgpt.js >> Chat list is empty.");var r={};if(Number.isInteger(d)||"latest"==d||"active"==d&&!new RegExp("/"+l.source+"$").test(window.location.href)){if((d=Number.isInteger(d)?d:0)>o.length)return s("🤖 chatgpt.js >> Chat with index "+(d+1)+" is out of bounds. Only "+o.length+" chats exist!");for(var e of c)r[e]=o[d][e]}else{var a,n="active"==d||new RegExp("^"+l.source+"$").test(d)?"id":"title";"active"==d&&(d=l.exec(window.location.href)[0]);let e,t;for(e=0;e<o.length;e++)if(o[e][n]==d){t=!0;break}if(!t)return s("🤖 chatgpt.js >> No chat with "+n+" = "+d+" found.");for(a of c)r[a]=o[e][a]}return t(r)},i.send()})};return new Promise(o=>chatgpt.getAccessToken().then(e=>{return o(r.includes("msg")?(t=e,new Promise((d,g)=>{let u=new XMLHttpRequest;a(t,["id"]).then(e=>{u.open("GET",chatgpt.endpoints.openAI.chat+"/"+e.id,!0),u.setRequestHeader("Content-Type","application/json"),u.setRequestHeader("Authorization","Bearer "+t),u.onload=()=>{if(200!==u.status)return g("🤖 chatgpt.js >> Request failed. Cannot retrieve chat messages.");var e,t,o=JSON.parse(u.responseText).mapping,r=[],a=[],n=[];for(e in o)null!=o[e].message&&"user"==o[e].message.author.role&&r.push({id:o[e].id,msg:o[e].message});if(r.sort((e,t)=>e.msg.create_time-t.msg.create_time),parseInt(p,10)+1>r.length)return g("🤖 chatgpt.js >> Message/response with index "+(p+1)+" is out of bounds. Only "+r.length+" messages/responses exist!");for(t of r){let e=[];for(var s in o)null!=o[s].message&&"assistant"==o[s].message.author.role&&o[s].parent==t.id&&e.push(o[s].message);e.sort((e,t)=>e.create_time-t.create_time),e=1===(e=e.map(e=>{switch(e.content.content_type){case"code":return e.content.text;case"text":return e.content.parts[0];default:return}})).length?e[0]:e,a.push(e)}if("user"==h)for(var i in r)n.push(r[i].msg.content.parts[0]);else if("chatgpt"==h)for(var c of a)n.push("latest"==p?a[a.length-1]:c);else{let e=0;for(var l in r)n.push({user:r[l].msg.content.parts[0],chatgpt:"latest"==p?a[e][a[e].length-1]:a[e]}),e++}return d("all"==p?n:"latest"==p?n[n.length-1]:n[p])},u.send()})})):a(e,r));var t}))},getChatInput(){return chatgpt.getChatBox().firstChild.innerText},getContinueButton(){return document.querySelector('button.btn:has([d^="M4.47189"])')},getFooterDiv(){return chatgpt.footer.get()},getHeaderDiv(){return chatgpt.header.get()},getLastPrompt(){return chatgpt.getChatData("active","msg","user","latest")},getLastResponse(){return chatgpt.getChatData("active","msg","chatgpt","latest")},getNewChatButton(){return document.querySelector('button[data-testid*=new-chat-button],button:has([d^="M3.06957"]),button:has([d^="M15.6729"])')},getNewChatLink(){return document.querySelector('nav a[href="/"]')},getRegenerateButton(){return document.querySelector('button:has([d^="M3.06957"])')},getResponse(){return chatgpt.response.get(...arguments)},getResponseFromAPI(e,t){return chatgpt.response.getFromAPI(e,t)},getResponseFromDOM(e){return chatgpt.response.getFromDOM(e)},getScrollToBottomButton(){return document.querySelector('button:has([d^="M12 21C11.7348"])')},getSendButton(){return document.querySelector("[data-testid=send-button]")},getStopButton(){return document.querySelector("button[data-testid=stop-button]")},getUserLanguage(){return navigator.languages[0]||navigator.language||navigator.browserLanguage||navigator.systemLanguage||navigator.userLanguage||""},header:{get(){return document.querySelector("main .sticky")},hide(){chatgpt.header.get().style.display="none"},show(){chatgpt.header.get().style.display="flex"}},hideFooter(){chatgpt.footer.hide()},hideHeader(){chatgpt.header.hide()},history:{async isLoaded(t=null){var e=t?new Promise(e=>setTimeout(()=>e(!1),t)):null,o=new Promise(o=>{document.querySelector("nav")?o(!0):new MutationObserver((e,t)=>{document.querySelector("nav")&&(t.disconnect(),o(!0))}).observe(document.documentElement,{childList:!0,subtree:!0})});return e?Promise.race([o,e]):o}},instructions:{add(r,a){var e;return r?"string"!=typeof r?console.error("Instruction must be a string"):(e=["user","chatgpt"],a?"string"!=typeof a?console.error("Target must be a string"):(a=a.toLowerCase(),e.includes(a)?(r=`
34
34
 
35
35
  `+r,new Promise(o=>{chatgpt.getAccessToken().then(async e=>{var t=await this.fetchData();return"user"==a?t.about_user_message+=r:"chatgpt"==a&&(t.about_model_message+=r),await this.sendRequest("POST",e,t),o()})})):console.error(`Invalid target ${a}. Valid targets are [${e}]`)):console.error("Please provide a valid target!")):console.error("Please provide an instruction")},clear(r){var e=["user","chatgpt"];return r?"string"!=typeof r?console.error("Target must be a string"):(r=r.toLowerCase(),e.includes(r)?new Promise(o=>{chatgpt.getAccessToken().then(async e=>{var t=await this.fetchData();return"user"==r?t.about_user_message="":"chatgpt"==r&&(t.about_model_message=""),await this.sendRequest("POST",e,t),o()})}):console.error(`Invalid target ${r}. Valid targets are [${e}]`)):console.error("Please provide a valid target!")},fetchData(){return new Promise(t=>{chatgpt.getAccessToken().then(async e=>t(await this.sendRequest("GET",e)))})},sendRequest(a,e,n){for(let e=0;e<arguments.length-1;e++)if("string"!=typeof arguments[e])return console.error(`Argument ${e+1} must be a string`);var t=["POST","GET"];return(a=(a||"").trim().toUpperCase())&&t.includes(a)?e?n&&"object"!=typeof n?console.error(`Invalid body data type. Got ${typeof n}, expected object`):new Promise((t,o)=>{let r=new XMLHttpRequest;r.open(a,chatgpt.endpoints.openAI.instructions,!0),r.setRequestHeader("Accept-Language","en-US"),r.setRequestHeader("Authorization","Bearer "+e),"POST"==a&&r.setRequestHeader("Content-Type","application/json"),r.onload=()=>{var e=JSON.parse(r.responseText);return 422===r.status?o("🤖 chatgpt.js >> Character limit exceeded. Custom instructions can have a maximum length of 1500 characters."):403===r.status&&"content_policy"==e.detail.reason?o("🤖 chatgpt.js >> "+e.detail.description):200!==r.status?o("🤖 chatgpt.js >> Request failed. Cannot contact custom instructions endpoint."):(console.info("Custom instructions successfully contacted with method "+a),t(e||{}))},r.send(JSON.stringify(n)||"")}):console.error("Please provide a valid access token!"):console.error("Valid methods are "+t)},turnOff(){return new Promise(o=>{chatgpt.getAccessToken().then(async e=>{var t=await this.fetchData();return t.enabled=!1,await this.sendRequest("POST",e,t),o()})})},turnOn(){return new Promise(o=>{chatgpt.getAccessToken().then(async e=>{var t=await this.fetchData();return t.enabled=!0,await this.sendRequest("POST",e,t),o()})})},toggle(){return new Promise(t=>{this.fetchData().then(async e=>(await(e.enabled?this.turnOff():this.turnOn()),t()))})}},isDarkMode(){return document.documentElement.className.includes("dark")},isFullScreen(){return chatgpt.browser.isFullScreen()},async isIdle(t=null){let e={childList:!0,subtree:!0},r="div[data-message-author-role]";var o=t?new Promise(e=>setTimeout(()=>e(!1),t)):null,a=(async()=>(await new Promise(o=>{document.querySelector(r)?o():new MutationObserver((e,t)=>{document.querySelector(r)&&(t.disconnect(),o())}).observe(document.body,e)}),await new Promise(o=>{new MutationObserver((e,t)=>{chatgpt.getStopBtn()&&(t.disconnect(),o())}).observe(document.body,e)}),new Promise(o=>{new MutationObserver((e,t)=>{chatgpt.getStopBtn()||(t.disconnect(),o(!0))}).observe(document.body,e)})))();return o?Promise.race([a,o]):a},async isLoaded(t=null){var e=t?new Promise(e=>setTimeout(()=>e(!1),t)):null,o=new Promise(o=>{chatgpt.getNewChatBtn()?o(!0):new MutationObserver((e,t)=>{chatgpt.getNewChatBtn()&&(t.disconnect(),o(!0))}).observe(document.documentElement,{childList:!0,subtree:!0})});return e?Promise.race([o,e]):o},isLightMode(){return document.documentElement.classList.toString().includes("light")},isTyping(){return!!this.getStopButton()},logout(){window.location.href="https://chat.openai.com/auth/logout"},menu:{elements:[],addedEvent:!1,append(e,t={}){var o=["button","dropdown"];if(!e||"string"!=typeof e)return console.error("🤖 chatgpt.js >> Please supply a valid string element name!");if(e=e.toLowerCase(),!o.includes(e))return console.error(`🤖 chatgpt.js >> Invalid element! Valid elements are [${o}]`);let r=document.createElement("dropdown"==e?"select":"button"==e?"a":e);if(r.id=Math.floor(1e6*chatgpt.randomFloat())+Date.now(),"button"==e){r.textContent=t?.label&&"string"==typeof t.label?t.label:"chatgpt.js button";o=document.createElement("img");o.src=t?.icon&&"string"==typeof t.icon?t.icon:chatgpt.endpoints.assets+"/starters/chrome/extension/icons/icon128.png",o.width=18,r.insertBefore(o,r.firstChild),r.onclick=t?.onclick&&"function"==typeof t.onclick?t.onclick:function(){}}else if("dropdown"==e){if(t?.items&&Array.isArray(t.items)&&t.items.length||(t.items=[{text:"🤖 chatgpt.js option",value:"chatgpt.js option value"}]),!t.items.every(e=>"object"==typeof e))return console.error("'items' must be an array of objects!");r.style="background-color: #000; width: 100%; border: none;",t.items.forEach(e=>{var t=document.createElement("option");t.textContent=e?.text,t.value=e?.value,r.add(t)})}let a=()=>{var e,t=document.querySelectorAll("a[role=menuitem]");let o;for(e of t)if("Settings"==e.textContent){o=e.classList;break}let r=t[0].parentNode;chatgpt.menu.elements.forEach(e=>{if(e.setAttribute("class",o),!r.contains(e))try{r.insertBefore(e,r.firstChild)}catch(e){console.error(e)}})};this.elements.push(r);o=document.querySelector("nav button[id*=headless]");return this.addedEvent||(o?.addEventListener("click",()=>{setTimeout(a,25)}),this.addedEvent=!0),r.id},close(){try{document.querySelector("nav [id*=menu-button][aria-expanded=true]").click()}catch(e){console.error(e.message)}},open(){try{document.querySelector("nav [id*=menu-button][aria-expanded=false]").click()}catch(e){console.error(e.message)}}},minify(){chatgpt.code.minify()},notify(e,t,o,r){o=o?+o:1.75;let a=document.createElement("div");a.id=Math.floor(1e6*chatgpt.randomFloat())+Date.now(),a.classList.add("chatgpt-notif"),a.innerText=e,document.body.append(a);var e=document.createElement("div"),n=(e.title="Dismiss",e.classList.add("notif-close-btn","no-mobile-tap-outline"),document.createElementNS("http://www.w3.org/2000/svg","svg")),s=(n.setAttribute("height","8px"),n.setAttribute("viewBox","0 0 14 14"),n.setAttribute("fill","none"),n.style.height=n.style.width="8px",document.createElementNS("http://www.w3.org/2000/svg","path")),s=(s.setAttribute("fill-rule","evenodd"),s.setAttribute("clip-rule","evenodd"),s.setAttribute("fill","white"),s.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"),n.append(s),e.append(n),a.append(e),a.isTop=!t||!/low|bottom/i.test(t),a.isRight=!t||!/left/i.test(t),a.quadrant=(a.isTop?"top":"bottom")+(a.isRight?"Right":"Left"),1735767823541);let i=document.querySelector("#chatgpt-notif-style"),c=((!i||parseInt(i.getAttribute("last-updated"),10)<s)&&(i||((i=document.createElement("style")).id="chatgpt-notif-style",i.setAttribute("last-updated",s.toString()),document.head.append(i)),i.innerText='.chatgpt-notif {font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC","Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", sans-serif ;.no-mobile-tap-outline { outline: none ; -webkit-tap-highlight-color: transparent }background-color: black ; padding: 10px 13px 10px 18px ;border-radius: 11px ; border: 1px solid #f5f5f7 ;opacity: 0 ; position: fixed ; z-index: 9999 ; font-size: 1.8rem ; color: white ;user-select: none ; -webkit-user-select: none ; -moz-user-select: none ; -o-user-select: none ;-ms-user-select: none ;'+`transform: translateX(${a.isRight?"":"-"}35px) ;`+(r?`--shadow: -8px 13px 25px 0 ${/\b(?:shadow|on)\b/i.test(r)?"gray":r};
36
36
  box-shadow: var(--shadow) ; -webkit-box-shadow: var(--shadow) ; -moz-box-shadow: var(--shadow)`:"")+"}"+`.notif-close-btn {
package/docs/README.md CHANGED
@@ -49,8 +49,8 @@
49
49
  <img src="https://img.shields.io/github/stars/KudoAI/chatgpt.js?label=Stars&color=af68ff&logo=github&logoColor=white&labelColor=464646&style=for-the-badge"></a>
50
50
  <a href="https://github.com/KudoAI/chatgpt.js/blob/main/LICENSE.md">
51
51
  <img src="https://img.shields.io/badge/License-MIT-green.svg?logo=internetarchive&logoColor=white&labelColor=464646&style=for-the-badge"></a>
52
- <a href="https://github.com/KudoAI/chatgpt.js/tree/v3.6.1/dist/chatgpt.min.js">
53
- <img src="https://img.shields.io/github/size/KudoAI/chatgpt.js/dist/chatgpt.min.js?branch=v3.6.1&label=Minified%20Size&logo=databricks&logoColor=white&labelColor=464646&color=ff69b4&style=for-the-badge"></a>
52
+ <a href="https://github.com/KudoAI/chatgpt.js/tree/v3.6.2/dist/chatgpt.min.js">
53
+ <img src="https://img.shields.io/github/size/KudoAI/chatgpt.js/dist/chatgpt.min.js?branch=v3.6.2&label=Minified%20Size&logo=databricks&logoColor=white&labelColor=464646&color=ff69b4&style=for-the-badge"></a>
54
54
  <a href="https://www.codefactor.io/repository/github/kudoai/chatgpt.js">
55
55
  <img src="https://img.shields.io/codefactor/grade/github/kudoai/chatgpt.js?label=Code+Quality&logo=codefactor&logoColor=white&labelColor=464646&color=1acc6c&style=for-the-badge"></a>
56
56
  <a href="https://sonarcloud.io/component_measures?metric=new_vulnerabilities&id=kudoai_chatgpt.js">
@@ -94,7 +94,7 @@
94
94
 
95
95
  ```js
96
96
  (async () => {
97
- await import('https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@3.6.1/dist/chatgpt.min.js');
97
+ await import('https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@3.6.2/dist/chatgpt.min.js');
98
98
  // Your code here...
99
99
  })();
100
100
  ```
@@ -103,7 +103,7 @@
103
103
 
104
104
  ```js
105
105
  var xhr = new XMLHttpRequest();
106
- xhr.open('GET', 'https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@3.6.1/dist/chatgpt.min.js');
106
+ xhr.open('GET', 'https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@3.6.2/dist/chatgpt.min.js');
107
107
  xhr.onload = function () {
108
108
  if (xhr.status === 200) {
109
109
  var chatgptJS = document.createElement('script');
@@ -126,7 +126,7 @@ function yourCode() {
126
126
 
127
127
  ```js
128
128
  ...
129
- // @require https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@3.6.1/dist/chatgpt.min.js
129
+ // @require https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@3.6.2/dist/chatgpt.min.js
130
130
  // ==/UserScript==
131
131
 
132
132
  // Your code here...
@@ -196,7 +196,7 @@ chatgpt.get('reply', 'last');
196
196
 
197
197
  Each call equally fetches the last response. If you think it works, it probably will... so just type it!
198
198
 
199
- If it didn't, check out the extended [userguide](https://github.com/KudoAI/chatgpt.js/blob/v3.6.1/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!
199
+ If it didn't, check out the extended [userguide](https://github.com/KudoAI/chatgpt.js/blob/v3.6.2/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!
200
200
 
201
201
  <img height=8px width="100%" src="https://assets.chatgptjs.org/images/separators/gradient-aqua.png?v=e638eac">
202
202
 
@@ -434,7 +434,7 @@ This library exists thanks to code, translations, issues & ideas from the follow
434
434
  <div align="center">
435
435
 
436
436
  **[Releases](https://github.com/KudoAI/chatgpt.js/releases)** /
437
- [Userguide](https://github.com/KudoAI/chatgpt.js/blob/v3.6.1/docs/USERGUIDE.md) /
437
+ [Userguide](https://github.com/KudoAI/chatgpt.js/blob/v3.6.2/docs/USERGUIDE.md) /
438
438
  [Discuss](https://github.com/KudoAI/chatgpt.js/discussions) /
439
439
  [Back to top ↑](#top)
440
440
 
package/docs/USERGUIDE.md CHANGED
@@ -160,7 +160,7 @@
160
160
 
161
161
  ```js
162
162
  (async () => {
163
- await import('https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@3.6.1/dist/chatgpt.min.js');
163
+ await import('https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@3.6.2/dist/chatgpt.min.js');
164
164
  // Your code here...
165
165
  })();
166
166
  ```
@@ -169,7 +169,7 @@
169
169
 
170
170
  ```js
171
171
  var xhr = new XMLHttpRequest();
172
- xhr.open('GET', 'https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@3.6.1/dist/chatgpt.min.js');
172
+ xhr.open('GET', 'https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@3.6.2/dist/chatgpt.min.js');
173
173
  xhr.onload = function () {
174
174
  if (xhr.status === 200) {
175
175
  var chatgptJS = document.createElement('script');
@@ -191,7 +191,7 @@ function yourCode() {
191
191
 
192
192
  ```js
193
193
  ...
194
- // @require https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@3.6.1/dist/chatgpt.min.js
194
+ // @require https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@3.6.2/dist/chatgpt.min.js
195
195
  // ==/UserScript==
196
196
 
197
197
  // Your code here...
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kudoai/chatgpt.js",
3
- "version": "3.6.1",
3
+ "version": "3.6.2",
4
4
  "description": "Client-side JavaScript library for ChatGPT",
5
5
  "author": {
6
6
  "name": "KudoAI & contributors",
@@ -950,7 +950,12 @@ const chatgpt = {
950
950
  getLastResponse() { return chatgpt.getChatData('active', 'msg', 'chatgpt', 'latest'); },
951
951
 
952
952
  getNewChatButton() {
953
- return document.querySelector('button[data-testid*=new-chat-button], button:has([d^="M15.6729"])'); },
953
+ return document.querySelector(
954
+ 'button[data-testid*=new-chat-button],' // sidebar button (when logged in)
955
+ + 'button:has([d^="M3.06957"]),' // Cycle Arrows icon (Temp chat mode)
956
+ + 'button:has([d^="M15.6729"])' // Pencil icon (recorded chat mode)
957
+ )
958
+ },
954
959
 
955
960
  getNewChatLink() { return document.querySelector('nav a[href="/"]'); },
956
961
  getRegenerateButton() { return document.querySelector('button:has([d^="M3.06957"])'); },
@@ -3,7 +3,7 @@
3
3
  "name": "ChatGPT Extension",
4
4
  "short_name": "ChatGPT 🧩",
5
5
  "description": "A Chromium extension template to start using chatgpt.js like a boss!",
6
- "version": "2025.2.10",
6
+ "version": "2025.2.11",
7
7
  "author": "KudoAI",
8
8
  "homepage_url": "https://github.com/KudoAI/chatgpt.js-chrome-starter",
9
9
  "icons": {
@@ -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 2025.2.10
6
+ // @version 2025.2.11
7
7
  // @license MIT
8
8
  // @icon https://cdn.jsdelivr.net/gh/KudoAI/chatgpt.js@1fc50da/starters/greasemonkey/assets/images/icons/robot/icon48.png
9
9
  // @icon64 https://cdn.jsdelivr.net/gh/KudoAI/chatgpt.js@1fc50da/starters/greasemonkey/assets/images/icons/robot/icon64.png
10
10
  // @match *://chatgpt.com/*
11
- // @require https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@3.6.1/dist/chatgpt.min.js
11
+ // @require https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@3.6.2/dist/chatgpt.min.js
12
12
  // @grant GM_getValue
13
13
  // @grant GM_setValue
14
14
  // @noframes