@kudoai/chatgpt.js 2.6.8 → 2.6.10

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.
Files changed (120) hide show
  1. package/README.md +28 -33
  2. package/chatgpt.js +19 -99
  3. package/dist/chatgpt.min.js +9 -3
  4. package/docs/README.md +28 -33
  5. package/docs/USERGUIDE.md +6 -65
  6. package/package.json +13 -13
  7. package/starters/chrome/LICENSE.md +2 -2
  8. package/starters/chrome/docs/README.md +2 -2
  9. package/starters/chrome/docs/SECURITY.md +2 -2
  10. package/starters/chrome/extension/lib/chatgpt.js +19 -99
  11. package/starters/chrome/extension/manifest.json +1 -1
  12. package/starters/chrome/extension/popup/index.html +1 -1
  13. package/starters/chrome/extension/popup/popup.js +1 -1
  14. package/starters/docs/README.md +1 -1
  15. package/starters/greasemonkey/LICENSE.md +2 -2
  16. package/starters/greasemonkey/chatgpt.js-greasemonkey-starter.user.js +2 -2
  17. package/starters/greasemonkey/docs/SECURITY.md +2 -2
  18. package/docs/de/LICENSE.md +0 -29
  19. package/docs/de/README.md +0 -345
  20. package/docs/de/SECURITY.md +0 -25
  21. package/docs/es/LICENSE.md +0 -29
  22. package/docs/es/README.md +0 -345
  23. package/docs/es/SECURITY.md +0 -25
  24. package/docs/fr/LICENSE.md +0 -29
  25. package/docs/fr/README.md +0 -345
  26. package/docs/fr/SECURITY.md +0 -25
  27. package/docs/hi/LICENSE.md +0 -29
  28. package/docs/hi/README.md +0 -346
  29. package/docs/hi/SECURITY.md +0 -25
  30. package/docs/it/LICENSE.md +0 -27
  31. package/docs/it/README.md +0 -345
  32. package/docs/it/SECURITY.md +0 -25
  33. package/docs/ja/LICENSE.md +0 -29
  34. package/docs/ja/README.md +0 -345
  35. package/docs/ja/SECURITY.md +0 -25
  36. package/docs/ko/LICENSE.md +0 -32
  37. package/docs/ko/README.md +0 -350
  38. package/docs/ko/SECURITY.md +0 -25
  39. package/docs/ne/LICENSE.md +0 -35
  40. package/docs/ne/README.md +0 -346
  41. package/docs/ne/SECURITY.md +0 -25
  42. package/docs/nl/LICENSE.md +0 -29
  43. package/docs/nl/README.md +0 -345
  44. package/docs/nl/SECURITY.md +0 -25
  45. package/docs/pt/LICENSE.md +0 -29
  46. package/docs/pt/README.md +0 -345
  47. package/docs/pt/SECURITY.md +0 -25
  48. package/docs/vi/LICENSE.md +0 -29
  49. package/docs/vi/README.md +0 -345
  50. package/docs/vi/SECURITY.md +0 -25
  51. package/docs/zh-cn/LICENSE.md +0 -29
  52. package/docs/zh-cn/README.md +0 -344
  53. package/docs/zh-cn/SECURITY.md +0 -25
  54. package/docs/zh-tw/LICENSE.md +0 -29
  55. package/docs/zh-tw/README.md +0 -344
  56. package/docs/zh-tw/SECURITY.md +0 -25
  57. package/starters/chrome/docs/de/LICENSE.md +0 -31
  58. package/starters/chrome/docs/de/README.md +0 -93
  59. package/starters/chrome/docs/es/LICENSE.md +0 -31
  60. package/starters/chrome/docs/es/README.md +0 -93
  61. package/starters/chrome/docs/fr/LICENSE.md +0 -31
  62. package/starters/chrome/docs/fr/README.md +0 -93
  63. package/starters/chrome/docs/hi/LICENSE.md +0 -31
  64. package/starters/chrome/docs/hi/README.md +0 -93
  65. package/starters/chrome/docs/hi/SECURITY.md +0 -17
  66. package/starters/chrome/docs/it/LICENSE.md +0 -29
  67. package/starters/chrome/docs/it/README.md +0 -93
  68. package/starters/chrome/docs/ja/LICENSE.md +0 -31
  69. package/starters/chrome/docs/ja/README.md +0 -93
  70. package/starters/chrome/docs/ko/LICENSE.md +0 -34
  71. package/starters/chrome/docs/ko/README.md +0 -93
  72. package/starters/chrome/docs/nl/LICENSE.md +0 -31
  73. package/starters/chrome/docs/nl/README.md +0 -93
  74. package/starters/chrome/docs/pt/LICENSE.md +0 -31
  75. package/starters/chrome/docs/pt/README.md +0 -93
  76. package/starters/chrome/docs/vi/LICENSE.md +0 -31
  77. package/starters/chrome/docs/vi/README.md +0 -93
  78. package/starters/chrome/docs/zh-cn/LICENSE.md +0 -31
  79. package/starters/chrome/docs/zh-cn/README.md +0 -93
  80. package/starters/chrome/docs/zh-cn/SECURITY.md +0 -17
  81. package/starters/chrome/docs/zh-tw/LICENSE.md +0 -31
  82. package/starters/chrome/docs/zh-tw/README.md +0 -93
  83. package/starters/docs/de/LICENSE.md +0 -13
  84. package/starters/docs/de/README.md +0 -29
  85. package/starters/docs/es/LICENSE.md +0 -13
  86. package/starters/docs/es/README.md +0 -29
  87. package/starters/docs/fr/LICENSE.md +0 -13
  88. package/starters/docs/fr/README.md +0 -29
  89. package/starters/docs/hi/LICENSE.md +0 -13
  90. package/starters/docs/hi/README.md +0 -29
  91. package/starters/docs/it/LICENSE.md +0 -11
  92. package/starters/docs/it/README.md +0 -29
  93. package/starters/docs/ja/LICENSE.md +0 -13
  94. package/starters/docs/ja/README.md +0 -30
  95. package/starters/docs/ko/LICENSE.md +0 -16
  96. package/starters/docs/ko/README.md +0 -29
  97. package/starters/docs/nl/LICENSE.md +0 -13
  98. package/starters/docs/nl/README.md +0 -29
  99. package/starters/docs/pt/LICENSE.md +0 -13
  100. package/starters/docs/pt/README.md +0 -29
  101. package/starters/docs/vi/LICENSE.md +0 -13
  102. package/starters/docs/vi/README.md +0 -29
  103. package/starters/docs/zh-cn/LICENSE.md +0 -13
  104. package/starters/docs/zh-cn/README.md +0 -30
  105. package/starters/docs/zh-tw/LICENSE.md +0 -13
  106. package/starters/docs/zh-tw/README.md +0 -29
  107. package/starters/greasemonkey/docs/de/LICENSE.md +0 -31
  108. package/starters/greasemonkey/docs/es/LICENSE.md +0 -31
  109. package/starters/greasemonkey/docs/fr/LICENSE.md +0 -31
  110. package/starters/greasemonkey/docs/hi/LICENSE.md +0 -31
  111. package/starters/greasemonkey/docs/hi/SECURITY.md +0 -17
  112. package/starters/greasemonkey/docs/it/LICENSE.md +0 -29
  113. package/starters/greasemonkey/docs/ja/LICENSE.md +0 -31
  114. package/starters/greasemonkey/docs/ko/LICENSE.md +0 -34
  115. package/starters/greasemonkey/docs/nl/LICENSE.md +0 -31
  116. package/starters/greasemonkey/docs/pt/LICENSE.md +0 -31
  117. package/starters/greasemonkey/docs/vi/LICENSE.md +0 -31
  118. package/starters/greasemonkey/docs/zh-cn/LICENSE.md +0 -31
  119. package/starters/greasemonkey/docs/zh-cn/SECURITY.md +0 -17
  120. package/starters/greasemonkey/docs/zh-tw/LICENSE.md +0 -31
package/README.md CHANGED
@@ -4,8 +4,8 @@
4
4
  <h6>
5
5
  <a href="https://github.com/KudoAI/chatgpt.js/tree/main/docs">
6
6
  <picture>
7
- <source type="image/svg+xml" media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/KudoAI/chatgpt.js/main/media/images/icons/earth-americas-white-padded-icon17x15.svg">
8
- <img src="https://raw.githubusercontent.com/KudoAI/chatgpt.js/main/media/images/icons/earth-americas-padded-icon17x15.svg">
7
+ <source type="image/svg+xml" media="(prefers-color-scheme: dark)" srcset="https://media.chatgptjs.org/images/icons/earth-americas-white-padded-icon17x15.svg?714b6a1">
8
+ <img src="https://media.chatgptjs.org/images/icons/earth-americas-padded-icon17x15.svg?714b6a1">
9
9
  </picture>
10
10
  </a>
11
11
  English |
@@ -29,8 +29,8 @@
29
29
 
30
30
  <a href="https://chatgpt.js.org">
31
31
  <picture>
32
- <source type="image/png" media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/KudoAI/chatgpt.js/main/media/images/logos/chatgpt.js/with-reflection/darkmode.png">
33
- <img width=800 src="https://raw.githubusercontent.com/KudoAI/chatgpt.js/main/media/images/logos/chatgpt.js/with-reflection/lightmode.png">
32
+ <source type="image/png" media="(prefers-color-scheme: dark)" srcset="https://media.chatgptjs.org/images/logos/chatgpt.js/with-reflection/darkmode.png?bc68d0c">
33
+ <img width=800 src="https://media.chatgptjs.org/images/logos/chatgpt.js/with-reflection/lightmode.png?bc68d0c">
34
34
  </picture>
35
35
  </a>
36
36
 
@@ -45,16 +45,16 @@
45
45
  [![](https://img.shields.io/github/stars/KudoAI/chatgpt.js?label=Stars&color=af68ff&logo=github&logoColor=white&labelColor=464646&style=for-the-badge)](https://github.com/KudoAI/chatgpt.js/stargazers)
46
46
  [![](https://img.shields.io/badge/License-MIT-green.svg?logo=internetarchive&logoColor=white&labelColor=464646&style=for-the-badge)](https://github.com/KudoAI/chatgpt.js/blob/main/LICENSE.md)
47
47
  [![](https://img.shields.io/github/commit-activity/m/KudoAI/chatgpt.js?label=Commits&logo=github&logoColor=white&labelColor=464646&style=for-the-badge)](https://github.com/KudoAI/chatgpt.js/commits/main)
48
- ![](https://img.shields.io/github/size/KudoAI/chatgpt.js/dist/chatgpt.min.js?label=Minified%20Size&logo=databricks&logoColor=white&labelColor=464646&color=ff69b4&style=for-the-badge)
48
+ [![](https://img.shields.io/github/size/KudoAI/chatgpt.js/dist/chatgpt.min.js?branch=v2.6.10&label=Minified%20Size&logo=databricks&logoColor=white&labelColor=464646&color=ff69b4&style=for-the-badge)](https://github.com/KudoAI/chatgpt.js/tree/v2.6.10/dist/chatgpt.min.js)
49
49
  [![](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)](https://www.codefactor.io/repository/github/kudoai/chatgpt.js)
50
50
  [![](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fsonarcloud.io%2Fapi%2Fmeasures%2Fcomponent%3Fcomponent%3Dkudoai_chatgpt.js%26metricKeys%3Dvulnerabilities&query=%24.component.measures.0.value&style=for-the-badge&logo=sonarcloud&logoColor=white&labelColor=464646&label=Vulnerabilities&color=gold)](https://sonarcloud.io/component_measures?metric=new_vulnerabilities&id=kudoai_chatgpt.js)
51
51
  [![](https://img.shields.io/badge/Mentioned_in-Awesome-cca8c4?logo=awesomelists&logoColor=white&labelColor=464646&style=for-the-badge)](https://github.com/sindresorhus/awesome-chatgpt#javascript)
52
52
  [![](https://img.shields.io/badge/Featured_on-Product_Hunt-ff6154?logo=producthunt&logoColor=white&labelColor=464646&style=for-the-badge)](https://www.producthunt.com/posts/chatgpt-js)
53
-
53
+ ![](https://img.shields.io/badge/jsDelivr_Hits-1,500,000+-49c5d8.svg?logo=jsdelivr&logoColor=white&labelColor=464646&style=for-the-badge)
54
54
 
55
55
  </div>
56
56
 
57
- <img height=8px width="100%" src="https://raw.githubusercontent.com/KudoAI/chatgpt.js/main/docs/assets/images/aqua-separator.png">
57
+ <img height=8px width="100%" src="https://cdn.jsdelivr.net/gh/KudoAI/chatgpt.js@5e41346/docs/assets/images/aqua-separator.png">
58
58
 
59
59
  <div id="intro">
60
60
 
@@ -69,7 +69,7 @@
69
69
  - Easy-to-use
70
70
  - Lightweight (yet optimally performant)
71
71
 
72
- <img height=8px width="100%" src="https://raw.githubusercontent.com/KudoAI/chatgpt.js/main/docs/assets/images/aqua-separator.png">
72
+ <img height=8px width="100%" src="https://cdn.jsdelivr.net/gh/KudoAI/chatgpt.js@5e41346/docs/assets/images/aqua-separator.png">
73
73
 
74
74
  <div id="importing">
75
75
 
@@ -77,13 +77,13 @@
77
77
 
78
78
  </div>
79
79
 
80
- > **Note** _To always import the latest version (NOT recommended in production!) replace the versioned jsDelivr URL with: `https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js/chatgpt.min.js`_
80
+ > **Note** _To always import the latest version (not recommended in production!) replace the versioned jsDelivr URL with: `https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js/chatgpt.min.js`_
81
81
 
82
82
  ### ES6:
83
83
 
84
84
  ```js
85
85
  (async () => {
86
- await import('https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.8/dist/chatgpt.min.js');
86
+ await import('https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.10/dist/chatgpt.min.js');
87
87
  // Your code here...
88
88
  })();
89
89
  ```
@@ -92,7 +92,7 @@
92
92
 
93
93
  ```js
94
94
  var xhr = new XMLHttpRequest();
95
- xhr.open('GET', 'https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.8/dist/chatgpt.min.js');
95
+ xhr.open('GET', 'https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.10/dist/chatgpt.min.js');
96
96
  xhr.onload = function () {
97
97
  if (xhr.status === 200) {
98
98
  var chatgptJS = document.createElement('script');
@@ -108,13 +108,13 @@ function yourCode() {
108
108
  }
109
109
  ```
110
110
 
111
- ### <img style="margin: 0 2px -0.065rem 0" height=17 src="https://raw.githubusercontent.com/KudoAI/chatgpt.js/main/starters/media/images/icons/tampermonkey-icon28.png"><img style="margin: 0 2px -0.035rem 1px" height=17.5 src="https://raw.githubusercontent.com/KudoAI/chatgpt.js/main/starters/media/images/icons/violentmonkey-icon100.png"> Greasemonkey:
111
+ ### <img style="margin: 0 2px -0.065rem 0" height=17 src="https://cdn.jsdelivr.net/gh/KudoAI/chatgpt.js@e26f2cf/starters/media/images/icons/tampermonkey-icon28.png"><img style="margin: 0 2px -0.035rem 1px" height=17.5 src="https://cdn.jsdelivr.net/gh/KudoAI/chatgpt.js@0c37090/starters/media/images/icons/violentmonkey-icon100.png"> Greasemonkey:
112
112
 
113
113
  > **Note** _To use a starter template: [kudoai/chatgpt.js-greasemonkey-starter](https://github.com/KudoAI/chatgpt.js-greasemonkey-starter)_
114
114
 
115
115
  ```js
116
116
  ...
117
- // @require https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.8/dist/chatgpt.min.js
117
+ // @require https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.10/dist/chatgpt.min.js
118
118
  // ==/UserScript==
119
119
 
120
120
  // Your code here...
@@ -150,7 +150,7 @@ export { chatgpt }
150
150
  })();
151
151
  ```
152
152
 
153
- <img height=8px width="100%" src="https://raw.githubusercontent.com/KudoAI/chatgpt.js/main/docs/assets/images/aqua-separator.png">
153
+ <img height=8px width="100%" src="https://cdn.jsdelivr.net/gh/KudoAI/chatgpt.js@5e41346/docs/assets/images/aqua-separator.png">
154
154
 
155
155
  <div id="npm">
156
156
 
@@ -164,11 +164,11 @@ To download **chatgpt.js** for local customization, run the following command in
164
164
  npm install @kudoai/chatgpt.js
165
165
  ```
166
166
 
167
- After installation, navigate to `node_modules/@kudoai/chatgpt.js` to find the library source (minified version in `dist/`).
167
+ After installation, navigate to `node_modules/@kudoai/chatgpt.js` to find the library source.
168
168
 
169
169
  </div>
170
170
 
171
- <img height=8px width="100%" src="https://raw.githubusercontent.com/KudoAI/chatgpt.js/main/docs/assets/images/aqua-separator.png">
171
+ <img height=8px width="100%" src="https://cdn.jsdelivr.net/gh/KudoAI/chatgpt.js@5e41346/docs/assets/images/aqua-separator.png">
172
172
 
173
173
  <div id="usage">
174
174
 
@@ -191,7 +191,7 @@ Each call equally fetches the last response. If you think it works, it probably
191
191
 
192
192
  If it didn't, check out the extended [userguide](https://github.com/KudoAI/chatgpt.js/blob/main/docs/USERGUIDE.md), or simply submit an [issue](https://github.com/KudoAI/chatgpt.js/issues) or [PR](https://github.com/KudoAI/chatgpt.js/pulls) and it will be integrated, ezpz!
193
193
 
194
- <img height=8px width="100%" src="https://raw.githubusercontent.com/KudoAI/chatgpt.js/main/docs/assets/images/aqua-separator.png">
194
+ <img height=8px width="100%" src="https://cdn.jsdelivr.net/gh/KudoAI/chatgpt.js@5e41346/docs/assets/images/aqua-separator.png">
195
195
 
196
196
  <div id="showcase">
197
197
 
@@ -210,13 +210,6 @@ https://github.com/KudoAI/chatgpt.js/assets/10906554/f53c740f-d5e0-49b6-ae02-3b3
210
210
  [Readme](https://github.com/adamlui/autoclear-chatgpt-history#readme) /
211
211
  [Discuss](https://autoclearchatgpt.com/discuss)
212
212
 
213
- ### <img width=16 src="https://i.imgur.com/1yjmK3W.png"> [Automatic ChatGPT DAN](https://github.com/madkarmaa/automatic-chatgpt-dan)
214
-
215
- > Automatically send DAN prompts to ChatGPT.
216
- <br>[Install](https://github.com/madkarmaa/automatic-chatgpt-dan#%EF%B8%8F-installation) /
217
- [Readme](https://github.com/madkarmaa/automatic-chatgpt-dan#readme) /
218
- [Discuss](https://github.com/madkarmaa/automatic-chatgpt-dan/issues)
219
-
220
213
  ### <img src="https://media.bravegpt.com/images/icons/bravegpt/icon48.png" width=18> [BraveGPT](https://bravegpt.com) <a href="https://www.producthunt.com/posts/bravegpt?utm_source=badge-featured&utm_medium=badge&utm_souce=badge-bravegpt" target="_blank" rel="noopener"><img src="https://api.producthunt.com/widgets/embed-image/v1/featured.svg?post_id=385630&theme=light" style="width: 112px; height: 24px; margin:0 0 -4px 5px;" width="112" height="24" /></a>
221
214
 
222
215
  > Display ChatGPT answers in Brave Search sidebar (powered by GPT-4!)
@@ -270,7 +263,7 @@ https://github.com/KudoAI/chatgpt.js/assets/10906554/f53c740f-d5e0-49b6-ae02-3b3
270
263
  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>!
271
264
  </p>
272
265
 
273
- <img height=8px width="100%" src="https://raw.githubusercontent.com/KudoAI/chatgpt.js/main/docs/assets/images/aqua-separator.png">
266
+ <img height=8px width="100%" src="https://cdn.jsdelivr.net/gh/KudoAI/chatgpt.js@5e41346/docs/assets/images/aqua-separator.png">
274
267
 
275
268
  <div id="contributors">
276
269
 
@@ -303,16 +296,18 @@ This library exists thanks to code, translations, issues & ideas from the follow
303
296
  [![](https://images.weserv.nl/?url=https://avatars.githubusercontent.com/u/150537240?first-contrib=2023.11.15-regenerate-btn-changed-bug-email&h=51&w=51&mask=circle&maxage=7d "@philly88r")](https://github.com/philly88r)
304
297
  [![](https://images.weserv.nl/?url=https://avatars.githubusercontent.com/u/9730392?first-contrib=2023.12.18-get-response-from-dom-request&h=51&w=51&mask=circle&maxage=7d "@thomasgauthier")](https://github.com/thomasgauthier)
305
298
  [![](https://images.weserv.nl/?url=https://avatars.githubusercontent.com/u/42911524?first-contrib=2024.1.17-add-custom-gpt-support&h=51&w=51&mask=circle&maxage=7d "@pranav-bhatt")](https://github.com/pranav-bhatt)
306
- [![](https://images.weserv.nl/?url=https://avatars.githubusercontent.com/u/13976824?first-contrib=2021.01.31-aria-labels-unreliable-bug-report&h=50&w=50&mask=circle&maxage=7d "@hopana")](https://github.com/hopana)
299
+ [![](https://images.weserv.nl/?url=https://avatars.githubusercontent.com/u/13976824?first-contrib=2024.01.31-aria-labels-unreliable-bug-report&h=50&w=50&mask=circle&maxage=7d "@hopana")](https://github.com/hopana)
300
+ [![](https://images.weserv.nl/?url=https://avatars.githubusercontent.com/u/26219737?first-contrib=2024.2.2-data-key-message-bug-fix&h=50&w=50&mask=circle&maxage=7d "@emtry")](https://github.com/emtry)
301
+ [![](https://images.weserv.nl/?url=https://avatars.githubusercontent.com/u/44357327?first-contrib=2024.2.14-msg-fetching-for-localization-fails-report&h=51&w=51&mask=circle&maxage=7d "@thedayofcondor")](https://github.com/thedayofcondor)
307
302
  [![](https://images.weserv.nl/?url=https://avatars.githubusercontent.com/u/111466842?first-contrib=2024.2.15-add-en-gb-locale&h=51&w=51&mask=circle&maxage=7d "@Luwa-Tech")](https://github.com/Luwa-Tech)
308
303
  [![](https://images.weserv.nl/?url=https://avatars.githubusercontent.com/in/29110&h=51&w=51&mask=circle&maxage=7d "Dependabot")](https://github.com/dependabot)
309
304
  [![](https://images.weserv.nl/?url=https://i.imgur.com/tNyIPmG.jpg?h=51&w=51&mask=circle&maxage=7d "ChatGPT")](https://chat.openai.com)
310
- [![](https://images.weserv.nl/?url=https://raw.githubusercontent.com/KudoAI/chatgpt.js/main/media/images/icons/poe-icon128.svg?first-contrib=2023.07.27-getandshowreply-method&h=51&w=51&mask=circle&maxage=7d "Poe")](https://poe.com)
305
+ [![](https://images.weserv.nl/?url=https://cdn.jsdelivr.net/gh/KudoAI/chatgpt.js@e26f2cf/media/images/icons/poe-icon128.svg?first-contrib=2023.07.27-getandshowreply-method&h=51&w=51&mask=circle&maxage=7d "Poe")](https://poe.com)
311
306
  [![](https://images.weserv.nl/?url=https://avatars.githubusercontent.com/u/31427850?h=51&w=51&mask=circle&maxage=7d "@ImgBotApp")](https://github.com/ImgBotApp)
312
307
 
313
308
  </div><br>
314
309
 
315
- <img height=8px width="100%" src="https://raw.githubusercontent.com/KudoAI/chatgpt.js/main/docs/assets/images/aqua-separator.png">
310
+ <img height=8px width="100%" src="https://cdn.jsdelivr.net/gh/KudoAI/chatgpt.js@5e41346/docs/assets/images/aqua-separator.png">
316
311
 
317
312
  <div id="partners">
318
313
 
@@ -325,21 +320,21 @@ This library exists thanks to code, translations, issues & ideas from the follow
325
320
  <div id="partners-collage" align="center">
326
321
 
327
322
  <picture>
328
- <source type="image/png" media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/KudoAI/chatgpt.js/main/media/images/logos/partners/collage/white.png">
329
- <img width=888 src="https://raw.githubusercontent.com/KudoAI/chatgpt.js/main/media/images/logos/partners/collage/black.png">
323
+ <source type="image/png" media="(prefers-color-scheme: dark)" srcset="https://media.chatgptjs.org/images/logos/partners/collage/white.png?3109608">
324
+ <img width=888 src="https://media.chatgptjs.org/images/logos/partners/collage/black.png?3109608">
330
325
  </picture>
331
326
 
332
327
  </div>
333
328
 
334
329
  <br>
335
330
 
336
- <img height=8px width="100%" src="https://raw.githubusercontent.com/KudoAI/chatgpt.js/main/docs/assets/images/aqua-separator.png">
331
+ <img height=8px width="100%" src="https://cdn.jsdelivr.net/gh/KudoAI/chatgpt.js@5e41346/docs/assets/images/aqua-separator.png">
337
332
 
338
333
  <div align="center">
339
334
 
340
- **[Releases](https://www.npmjs.com/package/@kudoai/chatgpt.js?activeTab=versions)** /
335
+ **[Releases](https://github.com/KudoAI/chatgpt.js/releases)** /
341
336
  [Userguide](https://github.com/KudoAI/chatgpt.js/blob/main/docs/USERGUIDE.md) /
342
337
  [Discuss](https://github.com/KudoAI/chatgpt.js/discussions) /
343
- <a href="#">Back to top ↑</a>
338
+ <a href="#--------------------------------------------------------------------------------english---------简体中文---------繁體中文---------日本---------한국인---------हिंदी---------नेपाली---------deutsch---------español---------français---------italiano---------nederlands---------português---------việt----">Back to top ↑</a>
344
339
 
345
340
  </div>
package/chatgpt.js CHANGED
@@ -1,12 +1,13 @@
1
1
  // © 2023–2024 KudoAI & contributors under the MIT license.
2
2
  // Source: https://github.com/KudoAI/chatgpt.js
3
+ // User guide: https://chatgptjs.org/userguide
3
4
  // Latest minified release: https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js/chatgpt.min.js
4
5
 
5
6
  // Init endpoints
6
7
  const endpoints = {
7
- assets: 'https://raw.githubusercontent.com/KudoAI/chatgpt.js/main',
8
+ assets: 'https://cdn.jsdelivr.net/gh/KudoAI/chatgpt.js',
8
9
  openAI: {
9
- session: 'https://chat.openai.com/api/auth/session',
10
+ session: 'https://chatgpt.com/api/auth/session',
10
11
  chats: 'https://chat.openai.com/backend-api/conversations',
11
12
  chat: 'https://chat.openai.com/backend-api/conversation',
12
13
  share_create: 'https://chat.openai.com/backend-api/share/create',
@@ -17,50 +18,10 @@ const endpoints = {
17
18
 
18
19
  // Init feedback properties
19
20
  localStorage.alertQueue = JSON.stringify([]);
20
- localStorage.notifyProps = JSON.stringify({
21
- queue: { topRight: [], bottomRight: [], bottomLeft: [], topLeft: [] },
22
- lastNthAudio: 0 // to prevent immediate repetition of base sound
23
- });
24
-
25
- // Init environment flags & functions
26
- const isChromeUserScript = navigator.userAgent.includes('Chrome') && typeof unsafeWindow != 'undefined',
27
- isFFuserScript = navigator.userAgent.includes('Firefox') && typeof unsafeWindow != 'undefined',
28
- isFFtmScript = isFFuserScript && GM_info.scriptHandler == 'Tampermonkey';
29
-
30
- // Define messages
31
- let cjsMessages;
32
- if (!isChromeUserScript && !(isFFuserScript && !isFFtmScript)) { (async () => {
33
- const cjsMsgsLoaded = new Promise(resolve => {
34
- const userLanguage = navigator.languages[0] || navigator.language || navigator.browserLanguage ||
35
- navigator.systemLanguage || navigator.userLanguage || '',
36
- msgHostDir = endpoints.assets + '/data/_locales/',
37
- msgLocaleDir = ( userLanguage ? userLanguage.replace('-', '_') : 'en' ) + '/';
38
- let msgHref = msgHostDir + msgLocaleDir + 'messages.json', msgXHRtries = 0;
39
- (function loadMsgs() {
40
- const xhr = new XMLHttpRequest();
41
- xhr.open('GET', msgHref); xhr.send();
42
- xhr.onload = () => {
43
- try { // to return localized messages.json
44
- const messages = new Proxy(JSON.parse(xhr.responseText), {
45
- get(target, prop) { // remove need to ref nested keys
46
- if (typeof target[prop] == 'object' && target[prop] !== null && 'message' in target[prop]) {
47
- return target[prop].message;
48
- }}}); resolve(messages);
49
- } catch (err) {
50
- msgXHRtries++; if (msgXHRtries === 3) resolve({}); // try up to 3X (original/region-stripped/EN) only
51
- msgHref = userLanguage.includes('-') && msgXHRtries === 1 ? // if regional lang on 1st try...
52
- msgHref.replace(/([^_]*)_[^/]*(\/.*)/, '$1$2') // ...strip region before retrying
53
- : ( msgHostDir + 'en/messages.json' ); // else use default English messages
54
- loadMsgs();
55
- }
56
- };
57
- xhr.onerror = () => { resolve({}); };
58
- })();
59
- }); cjsMessages = await cjsMsgsLoaded;
60
- })();}
21
+ localStorage.notifyProps = JSON.stringify({ queue: { topRight: [], bottomRight: [], bottomLeft: [], topLeft: [] }});
61
22
 
62
23
  // Define chatgpt.methods
63
- const chatgpt = {
24
+ const chatgpt = { // eslint-disable-line no-redeclare
64
25
  openAIaccessToken: {},
65
26
 
66
27
  actAs: function(persona) {
@@ -236,7 +197,7 @@ const chatgpt = {
236
197
 
237
198
  // Create close button
238
199
  const closeBtn = document.createElement('div');
239
- closeBtn.title = cjsMessages?.tooltip_close || 'Close'; closeBtn.classList.add('modal-close-btn');
200
+ closeBtn.title = 'Close'; closeBtn.classList.add('modal-close-btn');
240
201
  const closeSVG = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
241
202
  closeSVG.setAttribute('height', '10px');
242
203
  closeSVG.setAttribute('viewBox', '0 0 14 14');
@@ -426,23 +387,17 @@ const chatgpt = {
426
387
 
427
388
  if (method == 'dom') {
428
389
  try { await chatgpt.getChatData(); } catch { return; } // check if chat history exists
429
- chatgpt.menu.open();
430
- setTimeout(() => {
431
- const menuItems = document.querySelectorAll('a[role="menuitem"]') || [];
432
- for (const menuItem of menuItems)
433
- if (/settings/i.test(menuItem.text)) { menuItem.click(); break; }
390
+ chatgpt.menu.open(); setTimeout(() => { // open settings
391
+ const settingsBtn = document.querySelector(
392
+ 'a[role="menuitem"] svg path[d*="M11.6439 3C10.9352"]').parentNode.parentNode;
393
+ if (settingsBtn) settingsBtn.click();
434
394
  setTimeout(() => { // clear chats
435
- const settingsBtns = document.querySelectorAll('[id*=radix] button');
436
- for (const settingsBtn of settingsBtns)
437
- if (/^clear/i.test(settingsBtn.textContent)) { settingsBtn.click(); break; }
395
+ const settingsBtns = document.querySelectorAll('[id*=radix] button'),
396
+ deleteBtn = settingsBtns[settingsBtns.length - 1];
397
+ if (deleteBtn) deleteBtn.click();
438
398
  setTimeout(() => { // confirm clear
439
- document.querySelector('[id*=radix] button').click();
440
- setTimeout(() => {
441
- exitMenu();
442
- try { document.querySelector('#prompt-textarea').focus(); } catch (err) {}
443
- }, 10);
399
+ document.querySelector('button[class*="danger"').click();
444
400
  }, 10); }, 333); }, 10);
445
- const exitMenu = () => { document.querySelector('div[id*=radix] button').click(); };
446
401
 
447
402
  } else { // API method
448
403
  // NOTE: DOM is not updated to reflect new empty chat list (until session refresh)
@@ -835,7 +790,7 @@ const chatgpt = {
835
790
 
836
791
  // Fill [userMessages]
837
792
  for (const key in data)
838
- if ('message' in data[key] && data[key].message.author.role == 'user')
793
+ if (data[key].message != null && data[key].message.author.role == 'user')
839
794
  userMessages.push({ id: data[key].id, msg: data[key].message });
840
795
  userMessages.sort((a, b) => a.msg.create_time - b.msg.create_time); // sort in chronological order
841
796
 
@@ -847,7 +802,7 @@ const chatgpt = {
847
802
  for (const userMessage of userMessages) {
848
803
  let sub = [];
849
804
  for (const key in data) {
850
- if ('message' in data[key] && data[key].message.author.role == 'assistant' && data[key].parent == userMessage.id) {
805
+ if (data[key].message != null && data[key].message.author.role == 'assistant' && data[key].parent == userMessage.id) {
851
806
  sub.push(data[key].message);
852
807
  }
853
808
  }
@@ -944,17 +899,6 @@ const chatgpt = {
944
899
  navigator.systemLanguage || navigator.userLanguage || ''; },
945
900
 
946
901
  history: {
947
- activate: function() { this.isOff() ? this.toggle() : console.info('Chat history is already enabled!'); },
948
- deactivate: function() { this.isOn() ? this.toggle() : console.info('Chat history is already disabled!'); },
949
-
950
- isOn: function() {
951
- const navDivs = document.querySelectorAll('nav div'),
952
- offDiv = [...navDivs].find(div => div.textContent.includes('Chat History is off')) || {};
953
- return offDiv.classList.toString().includes('invisible');
954
- },
955
-
956
- isOff: function() { return !this.isOn(); },
957
-
958
902
  isLoaded: function() {
959
903
  return new Promise(resolve => {
960
904
  const checkChatHistory = () => {
@@ -962,13 +906,7 @@ const chatgpt = {
962
906
  else setTimeout(checkChatHistory, 100);
963
907
  };
964
908
  checkChatHistory();
965
- });},
966
-
967
- toggle: function() {
968
- for (const navBtn of document.querySelectorAll('nav button')) {
969
- if (/chat history/i.test(navBtn.textContent)) {
970
- navBtn.click(); return;
971
- }}}
909
+ });}
972
910
  },
973
911
 
974
912
  instructions: {
@@ -1239,7 +1177,7 @@ const chatgpt = {
1239
1177
 
1240
1178
  // Create/append close button
1241
1179
  const closeBtn = document.createElement('div');
1242
- closeBtn.title = cjsMessages?.tooltip_dismiss || 'Dismiss'; closeBtn.classList.add('notif-close-btn');
1180
+ closeBtn.title = 'Dismiss'; closeBtn.classList.add('notif-close-btn');
1243
1181
  const closeSVG = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
1244
1182
  closeSVG.setAttribute('height', '8px');
1245
1183
  closeSVG.setAttribute('viewBox', '0 0 14 14');
@@ -1318,28 +1256,10 @@ const chatgpt = {
1318
1256
  const hideDelay = fadeDuration > notifDuration ? 0 // don't delay if fade exceeds notification duration
1319
1257
  : notifDuration - fadeDuration; // otherwise delay for difference
1320
1258
 
1321
- // Init/schedule audio feedback
1322
- let dismissAudio, dismissAudioTID; // be accessible to `dismissNotif()`
1323
- if (isFFtmScript) {
1324
- // Init base audio index
1325
- let nthAudio; do nthAudio = Math.floor(Math.random() * 3) + 1; // randomize between 1-3...
1326
- while (nthAudio === notifyProps.lastNthAudio); // ...until distinct from prev index (for variety)
1327
- notifyProps.lastNthAudio = nthAudio; localStorage.notifyProps = JSON.stringify(notifyProps);
1328
-
1329
- // Build audio element + src URL
1330
- dismissAudio = new Audio();
1331
- dismissAudio.src = endpoints.assets + '/media/audio/notifications/bubble-pop/'
1332
- + `${ nthAudio }-${ notificationDiv.isRight ? 'right' : 'left' }.mp3`;
1333
-
1334
- // Schedule playback
1335
- dismissAudioTID = setTimeout(() => dismissAudio.play().catch(() => {}), hideDelay * 1000);
1336
- }
1337
-
1338
1259
  // Add notification dismissal to timeout schedule + button clicks
1339
1260
  const dismissNotif = () => {
1340
1261
  notificationDiv.style.animation = `notif-zoom-fade-out ${ fadeDuration }s ease-out`;
1341
- if (isFFtmScript) dismissAudio?.play().catch(() => {});
1342
- clearTimeout(dismissFuncTID); clearTimeout(dismissAudioTID);
1262
+ clearTimeout(dismissFuncTID);
1343
1263
  };
1344
1264
  const dismissFuncTID = setTimeout(dismissNotif, hideDelay * 1000); // maintain visibility for `hideDelay` secs, then dismiss
1345
1265
  closeSVG.addEventListener('click', dismissNotif, { once: true }); // add to close button clicks