@kudoai/chatgpt.js 2.6.3 → 2.6.5
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 +341 -0
- package/chatgpt.js +6 -4
- package/dist/chatgpt.min.js +7 -0
- package/docs/README.md +341 -324
- package/docs/USERGUIDE.md +1812 -1814
- package/docs/de/README.md +341 -324
- package/docs/es/README.md +341 -324
- package/docs/fr/README.md +341 -324
- package/docs/hi/README.md +342 -325
- package/docs/it/README.md +341 -324
- package/docs/ja/README.md +341 -324
- package/docs/ko/README.md +346 -329
- package/docs/ne/README.md +342 -325
- package/docs/nl/README.md +341 -324
- package/docs/pt/README.md +341 -324
- package/docs/vi/README.md +341 -324
- package/docs/zh-cn/README.md +341 -324
- package/docs/zh-tw/README.md +340 -323
- package/package.json +50 -31
- package/starters/chrome/LICENSE.md +43 -0
- package/starters/chrome/docs/README.md +17 -1
- package/starters/chrome/docs/SECURITY.md +17 -0
- package/starters/chrome/docs/de/LICENSE.md +21 -3
- package/starters/chrome/docs/de/README.md +17 -1
- package/starters/chrome/docs/es/LICENSE.md +21 -3
- package/starters/chrome/docs/es/README.md +17 -1
- package/starters/chrome/docs/fr/LICENSE.md +21 -3
- package/starters/chrome/docs/fr/README.md +17 -1
- package/starters/chrome/docs/hi/LICENSE.md +21 -3
- package/starters/chrome/docs/hi/README.md +17 -2
- package/starters/chrome/docs/hi/SECURITY.md +17 -0
- package/starters/chrome/docs/it/LICENSE.md +21 -3
- package/starters/chrome/docs/it/README.md +17 -1
- package/starters/chrome/docs/ja/LICENSE.md +21 -3
- package/starters/chrome/docs/ja/README.md +17 -2
- package/starters/chrome/docs/ko/LICENSE.md +21 -3
- package/starters/chrome/docs/ko/README.md +17 -1
- package/starters/chrome/docs/nl/LICENSE.md +20 -3
- package/starters/chrome/docs/nl/README.md +17 -1
- package/starters/chrome/docs/pt/LICENSE.md +21 -3
- package/starters/chrome/docs/pt/README.md +17 -1
- package/starters/chrome/docs/vi/LICENSE.md +21 -3
- package/starters/chrome/docs/vi/README.md +17 -1
- package/starters/chrome/docs/zh-cn/LICENSE.md +21 -3
- package/starters/chrome/docs/zh-cn/README.md +17 -2
- package/starters/chrome/docs/zh-cn/SECURITY.md +17 -0
- package/starters/chrome/docs/zh-tw/LICENSE.md +21 -3
- package/starters/chrome/docs/zh-tw/README.md +17 -1
- package/starters/chrome/extension/content.js +1 -1
- package/starters/chrome/extension/lib/chatgpt.js +6 -4
- package/starters/chrome/extension/manifest.json +1 -1
- package/starters/greasemonkey/LICENSE.md +43 -0
- package/starters/greasemonkey/chatgpt.js-greasemonkey-starter.user.js +52 -52
- package/starters/greasemonkey/docs/SECURITY.md +17 -0
- package/starters/greasemonkey/docs/de/LICENSE.md +31 -0
- package/starters/greasemonkey/docs/es/LICENSE.md +31 -0
- package/starters/greasemonkey/docs/fr/LICENSE.md +31 -0
- package/starters/greasemonkey/docs/hi/LICENSE.md +31 -0
- package/starters/greasemonkey/docs/hi/SECURITY.md +17 -0
- package/starters/greasemonkey/docs/it/LICENSE.md +29 -0
- package/starters/greasemonkey/docs/ja/LICENSE.md +31 -0
- package/starters/greasemonkey/docs/ko/LICENSE.md +34 -0
- package/starters/greasemonkey/docs/nl/LICENSE.md +30 -0
- package/starters/greasemonkey/docs/pt/LICENSE.md +31 -0
- package/starters/greasemonkey/docs/vi/LICENSE.md +31 -0
- package/starters/greasemonkey/docs/zh-cn/LICENSE.md +31 -0
- package/starters/greasemonkey/docs/zh-cn/SECURITY.md +17 -0
- package/starters/greasemonkey/docs/zh-tw/LICENSE.md +31 -0
- package/dist/chatgpt-2.6.3.min.js +0 -1
- package/docs/.nojekyll +0 -0
- package/docs/CNAME +0 -1
- package/docs/_coverpage.md +0 -16
- package/docs/_utils/LICENSE.md +0 -21
- package/docs/_utils/minify.js +0 -50
- package/docs/assets/docsify/cursors/futuristic/pointer.cur +0 -0
- package/docs/assets/docsify/favicons/favicon16.png +0 -0
- package/docs/assets/docsify/favicons/favicon320.png +0 -0
- package/docs/assets/docsify/favicons/favicon48.png +0 -0
- package/docs/assets/docsify/favicons/favicon64.png +0 -0
- package/docs/assets/docsify/fonts/eurostile-extended-black/EurostileExtendedBlack.otf +0 -0
- package/docs/assets/docsify/fonts/eurostile-extended-black/EurostileExtendedBlack.ttf +0 -0
- package/docs/assets/docsify/fonts/eurostile-extended-black/EurostileExtendedBlack.woff +0 -0
- package/docs/assets/docsify/fonts/eurostile-extended-black/EurostileExtendedBlack.woff2 +0 -0
- package/docs/assets/docsify/fonts/ibm-plex-mono/OFL.txt +0 -93
- package/docs/assets/docsify/fonts/ibm-plex-mono/otf/IBMPlexMono-Bold.otf +0 -0
- package/docs/assets/docsify/fonts/ibm-plex-mono/otf/IBMPlexMono-BoldItalic.otf +0 -0
- package/docs/assets/docsify/fonts/ibm-plex-mono/otf/IBMPlexMono-ExtraLight.otf +0 -0
- package/docs/assets/docsify/fonts/ibm-plex-mono/otf/IBMPlexMono-ExtraLightItalic.otf +0 -0
- package/docs/assets/docsify/fonts/ibm-plex-mono/otf/IBMPlexMono-Italic.otf +0 -0
- package/docs/assets/docsify/fonts/ibm-plex-mono/otf/IBMPlexMono-Light.otf +0 -0
- package/docs/assets/docsify/fonts/ibm-plex-mono/otf/IBMPlexMono-LightItalic.otf +0 -0
- package/docs/assets/docsify/fonts/ibm-plex-mono/otf/IBMPlexMono-Medium.otf +0 -0
- package/docs/assets/docsify/fonts/ibm-plex-mono/otf/IBMPlexMono-MediumItalic.otf +0 -0
- package/docs/assets/docsify/fonts/ibm-plex-mono/otf/IBMPlexMono-Regular.otf +0 -0
- package/docs/assets/docsify/fonts/ibm-plex-mono/otf/IBMPlexMono-SemiBold.otf +0 -0
- package/docs/assets/docsify/fonts/ibm-plex-mono/otf/IBMPlexMono-SemiBoldItalic.otf +0 -0
- package/docs/assets/docsify/fonts/ibm-plex-mono/otf/IBMPlexMono-Thin.otf +0 -0
- package/docs/assets/docsify/fonts/ibm-plex-mono/otf/IBMPlexMono-ThinItalic.otf +0 -0
- package/docs/assets/docsify/fonts/ibm-plex-mono/ttf/IBMPlexMono-Bold.ttf +0 -0
- package/docs/assets/docsify/fonts/ibm-plex-mono/ttf/IBMPlexMono-BoldItalic.ttf +0 -0
- package/docs/assets/docsify/fonts/ibm-plex-mono/ttf/IBMPlexMono-ExtraLight.ttf +0 -0
- package/docs/assets/docsify/fonts/ibm-plex-mono/ttf/IBMPlexMono-ExtraLightItalic.ttf +0 -0
- package/docs/assets/docsify/fonts/ibm-plex-mono/ttf/IBMPlexMono-Italic.ttf +0 -0
- package/docs/assets/docsify/fonts/ibm-plex-mono/ttf/IBMPlexMono-Light.ttf +0 -0
- package/docs/assets/docsify/fonts/ibm-plex-mono/ttf/IBMPlexMono-LightItalic.ttf +0 -0
- package/docs/assets/docsify/fonts/ibm-plex-mono/ttf/IBMPlexMono-Medium.ttf +0 -0
- package/docs/assets/docsify/fonts/ibm-plex-mono/ttf/IBMPlexMono-MediumItalic.ttf +0 -0
- package/docs/assets/docsify/fonts/ibm-plex-mono/ttf/IBMPlexMono-Regular.ttf +0 -0
- package/docs/assets/docsify/fonts/ibm-plex-mono/ttf/IBMPlexMono-SemiBold.ttf +0 -0
- package/docs/assets/docsify/fonts/ibm-plex-mono/ttf/IBMPlexMono-SemiBoldItalic.ttf +0 -0
- package/docs/assets/docsify/fonts/ibm-plex-mono/ttf/IBMPlexMono-Thin.ttf +0 -0
- package/docs/assets/docsify/fonts/ibm-plex-mono/ttf/IBMPlexMono-ThinItalic.ttf +0 -0
- package/docs/assets/docsify/fonts/ibm-plex-mono/woff/IBMPlexMono-Bold.woff +0 -0
- package/docs/assets/docsify/fonts/ibm-plex-mono/woff/IBMPlexMono-BoldItalic.woff +0 -0
- package/docs/assets/docsify/fonts/ibm-plex-mono/woff/IBMPlexMono-ExtraLight.woff +0 -0
- package/docs/assets/docsify/fonts/ibm-plex-mono/woff/IBMPlexMono-ExtraLightItalic.woff +0 -0
- package/docs/assets/docsify/fonts/ibm-plex-mono/woff/IBMPlexMono-Italic.woff +0 -0
- package/docs/assets/docsify/fonts/ibm-plex-mono/woff/IBMPlexMono-Light.woff +0 -0
- package/docs/assets/docsify/fonts/ibm-plex-mono/woff/IBMPlexMono-LightItalic.woff +0 -0
- package/docs/assets/docsify/fonts/ibm-plex-mono/woff/IBMPlexMono-Medium.woff +0 -0
- package/docs/assets/docsify/fonts/ibm-plex-mono/woff/IBMPlexMono-MediumItalic.woff +0 -0
- package/docs/assets/docsify/fonts/ibm-plex-mono/woff/IBMPlexMono-Regular.woff +0 -0
- package/docs/assets/docsify/fonts/ibm-plex-mono/woff/IBMPlexMono-SemiBold.woff +0 -0
- package/docs/assets/docsify/fonts/ibm-plex-mono/woff/IBMPlexMono-SemiBoldItalic.woff +0 -0
- package/docs/assets/docsify/fonts/ibm-plex-mono/woff/IBMPlexMono-Thin.woff +0 -0
- package/docs/assets/docsify/fonts/ibm-plex-mono/woff/IBMPlexMono-ThinItalic.woff +0 -0
- package/docs/assets/docsify/fonts/ibm-plex-mono/woff2/IBMPlexMono-Bold.woff2 +0 -0
- package/docs/assets/docsify/fonts/ibm-plex-mono/woff2/IBMPlexMono-BoldItalic.woff2 +0 -0
- package/docs/assets/docsify/fonts/ibm-plex-mono/woff2/IBMPlexMono-ExtraLight.woff2 +0 -0
- package/docs/assets/docsify/fonts/ibm-plex-mono/woff2/IBMPlexMono-ExtraLightItalic.woff2 +0 -0
- package/docs/assets/docsify/fonts/ibm-plex-mono/woff2/IBMPlexMono-Italic.woff2 +0 -0
- package/docs/assets/docsify/fonts/ibm-plex-mono/woff2/IBMPlexMono-Light.woff2 +0 -0
- package/docs/assets/docsify/fonts/ibm-plex-mono/woff2/IBMPlexMono-LightItatlic.woff2 +0 -0
- package/docs/assets/docsify/fonts/ibm-plex-mono/woff2/IBMPlexMono-Medium.woff2 +0 -0
- package/docs/assets/docsify/fonts/ibm-plex-mono/woff2/IBMPlexMono-MediumItalic.woff2 +0 -0
- package/docs/assets/docsify/fonts/ibm-plex-mono/woff2/IBMPlexMono-Regular.woff2 +0 -0
- package/docs/assets/docsify/fonts/ibm-plex-mono/woff2/IBMPlexMono-SemiBold.woff2 +0 -0
- package/docs/assets/docsify/fonts/ibm-plex-mono/woff2/IBMPlexMono-SemiBoldItalic.woff2 +0 -0
- package/docs/assets/docsify/fonts/ibm-plex-mono/woff2/IBMPlexMono-Thin.woff2 +0 -0
- package/docs/assets/docsify/fonts/ibm-plex-mono/woff2/IBMPlexMono-ThinItalic.woff2 +0 -0
- package/docs/assets/docsify/fonts/major-mono-display/MajorMonoDisplay-Regular.otf +0 -0
- package/docs/assets/docsify/fonts/major-mono-display/MajorMonoDisplay-Regular.ttf +0 -0
- package/docs/assets/docsify/fonts/major-mono-display/MajorMonoDisplay-Regular.woff +0 -0
- package/docs/assets/docsify/fonts/major-mono-display/MajorMonoDisplay-Regular.woff2 +0 -0
- package/docs/assets/docsify/fonts/major-mono-display/OFL.txt +0 -93
- package/docs/assets/docsify/fonts/polysans-neutral/PolySansNeutral.eot +0 -0
- package/docs/assets/docsify/fonts/polysans-neutral/PolySansNeutral.ttf +0 -0
- package/docs/assets/docsify/fonts/polysans-neutral/PolySansNeutral.woff +0 -0
- package/docs/assets/docsify/fonts/polysans-neutral/PolySansNeutral.woff2 +0 -0
- package/docs/assets/docsify/html/footer.html +0 -23
- package/docs/assets/docsify/js/min/back-to-top-button.min.js +0 -1
- package/docs/assets/docsify/js/min/copy-code-button.min.js +0 -1
- package/docs/assets/docsify/js/min/onload-hacks.min.js +0 -3
- package/docs/assets/docsify/js/min/starry-background.min.js +0 -1
- package/docs/assets/docsify/js/src/back-to-top-button.js +0 -64
- package/docs/assets/docsify/js/src/copy-code-button.js +0 -91
- package/docs/assets/docsify/js/src/onload-hacks.js +0 -613
- package/docs/assets/docsify/js/src/starry-background.js +0 -111
- package/docs/assets/docsify/styles/css/style.min.css +0 -1
- package/docs/assets/docsify/styles/css/style.min.css.map +0 -1
- package/docs/assets/docsify/styles/scss/style.scss +0 -510
- package/docs/assets/separators/aqua.png +0 -0
- package/docs/de/_coverpage.md +0 -12
- package/docs/es/_coverpage.md +0 -12
- package/docs/fr/_coverpage.md +0 -12
- package/docs/hi/_coverpage.md +0 -12
- package/docs/index.html +0 -91
- package/docs/it/_coverpage.md +0 -12
- package/docs/ja/_coverpage.md +0 -12
- package/docs/ko/_coverpage.md +0 -12
- package/docs/ne/_coverpage.md +0 -12
- package/docs/nl/_coverpage.md +0 -12
- package/docs/pt/_coverpage.md +0 -12
- package/docs/vi/_coverpage.md +0 -12
- package/docs/zh-cn/_coverpage.md +0 -12
- package/docs/zh-tw/_coverpage.md +0 -12
- package/starters/chrome/LICENSE +0 -21
- package/starters/greasemonkey/LICENSE +0 -21
package/docs/USERGUIDE.md
CHANGED
|
@@ -1,1814 +1,1812 @@
|
|
|
1
|
-
<div align="center">
|
|
2
|
-
|
|
3
|
-
<picture>
|
|
4
|
-
<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">
|
|
5
|
-
<img width=700 src="https://raw.githubusercontent.com/kudoai/chatgpt.js/main/media/images/logos/chatgpt.js/with-reflection/lightmode.png">
|
|
6
|
-
</picture>
|
|
7
|
-
|
|
8
|
-
**chatgpt.js** is a powerful JavaScript library that allows for super easy interaction w/ the ChatGPT DOM.
|
|
9
|
-
|
|
10
|
-
</div>
|
|
11
|
-
|
|
12
|
-
## Table of contents
|
|
13
|
-
|
|
14
|
-
- [Importing the library](#importing-the-library)
|
|
15
|
-
- [ES6](#es6)
|
|
16
|
-
- [ES5](#es5)
|
|
17
|
-
- [Greasemonkey](#greasemonkey)
|
|
18
|
-
- [Chrome](#chrome)
|
|
19
|
-
- [Library methods](#library-methods)
|
|
20
|
-
- [General](#general)
|
|
21
|
-
- [detectLanguage `async`](#detectlanguage-async)
|
|
22
|
-
- [executeCode `async`](#executecode-async)
|
|
23
|
-
- [generateRandomIP](#generaterandomip)
|
|
24
|
-
- [get](#get)
|
|
25
|
-
- [getUserLanguage](#getuserlanguage)
|
|
26
|
-
- [isChromium](#ischromium)
|
|
27
|
-
- [isFirefox](#isfirefox)
|
|
28
|
-
- [isFullScreen](#isfullscreen)
|
|
29
|
-
- [isLoaded `async`](#isloaded-async)
|
|
30
|
-
- [isMobileDevice](#ismobiledevice)
|
|
31
|
-
- [printAllFunctions](#printallfunctions)
|
|
32
|
-
- [randomFloat](#randomfloat)
|
|
33
|
-
- [renderHTML](#renderhtml)
|
|
34
|
-
- [sentiment `async`](#sentiment-async)
|
|
35
|
-
- [suggest `async`](#suggest-async)
|
|
36
|
-
- [summarize `async`](#summarize-async)
|
|
37
|
-
- [translate `async`](#translate-async)
|
|
38
|
-
- [uuidv4](#uuidv4)
|
|
39
|
-
- [Page theme](#page-theme)
|
|
40
|
-
- [activateDarkMode](#activatedarkmode)
|
|
41
|
-
- [activateLightMode](#activatelightmode)
|
|
42
|
-
- [isDarkMode](#isdarkmode)
|
|
43
|
-
- [isLightMode](#islightmode)
|
|
44
|
-
- [toggleScheme](#togglescheme)
|
|
45
|
-
- [In-site notifications](#in-site-notifications)
|
|
46
|
-
- [alert](#alert)
|
|
47
|
-
- [notify](#notify)
|
|
48
|
-
- [User session](#user-session)
|
|
49
|
-
- [getAccessToken `async`](#getaccesstoken-async)
|
|
50
|
-
- [getAccountDetails `async`](#getaccountdetails-async)
|
|
51
|
-
- [logout](#logout)
|
|
52
|
-
- [Chats](#chats)
|
|
53
|
-
- [askAndGetReply `async`](#askandgetreply-async)
|
|
54
|
-
- [clearChats `async`](#clearchats-async)
|
|
55
|
-
- [exportChat `async`](#exportchat-async)
|
|
56
|
-
- [getChatData `async`](#getchatdata-async)
|
|
57
|
-
- [getChatInput](#getchatinput)
|
|
58
|
-
- [getLastPrompt `async`](#getlastprompt-async)
|
|
59
|
-
- [getLastResponse `async`](#getlastresponse-async)
|
|
60
|
-
- [getResponse](#getresponse)
|
|
61
|
-
- [getResponseFromAPI `async`](#getresponsefromapi-async)
|
|
62
|
-
- [getResponseFromDOM](#getresponsefromdom)
|
|
63
|
-
- [isIdle `async`](#isidle-async)
|
|
64
|
-
- [regenerate](#regenerate)
|
|
65
|
-
- [resend `async`](#resend-async)
|
|
66
|
-
- [scrollToBottom](#scrolltobottom)
|
|
67
|
-
- [send](#send)
|
|
68
|
-
- [sendInNewChat](#sendinnewchat)
|
|
69
|
-
- [shareChat `async`](#sharechat-async)
|
|
70
|
-
- [speak](#speak)
|
|
71
|
-
- [startNewChat](#startnewchat)
|
|
72
|
-
- [stop](#stop)
|
|
73
|
-
- [DOM related](#dom-related)
|
|
74
|
-
- [getChatBox](#getchatbox)
|
|
75
|
-
- [getContinueGeneratingButton](#getcontinuegeneratingbutton)
|
|
76
|
-
- [getNewChatLink](#getnewchatlink)
|
|
77
|
-
- [getRegenerateButton](#getregeneratebutton)
|
|
78
|
-
- [getSendButton](#getsendbutton)
|
|
79
|
-
- [getStopGeneratingButton](#getstopgeneratingbutton)
|
|
80
|
-
- [Library APIs](#library-apis)
|
|
81
|
-
- [autoRefresh `api`](#autorefresh-api)
|
|
82
|
-
- [activate](#activate)
|
|
83
|
-
- [deactivate](#deactivate)
|
|
84
|
-
- [nowTimeStamp](#nowtimestamp)
|
|
85
|
-
- [browser `api`](#browser-api)
|
|
86
|
-
- [isLightMode](#islightmode-1)
|
|
87
|
-
- [isDarkMode](#isdarkmode-1)
|
|
88
|
-
- [isChromium](#ischromium-1)
|
|
89
|
-
- [isFirefox](#isfirefox-1)
|
|
90
|
-
- [isFullScreen](#isfullscreen-1)
|
|
91
|
-
- [isMobile](#ismobile)
|
|
92
|
-
- [code `api`](#code-api)
|
|
93
|
-
- [minify `async`](#minify-async)
|
|
94
|
-
- [execute `async`](#execute-async)
|
|
95
|
-
- [extract](#extract)
|
|
96
|
-
- [obfuscate `async`](#obfuscate-async)
|
|
97
|
-
- [refactor `async`](#refactor-async)
|
|
98
|
-
- [review `async`](#review-async)
|
|
99
|
-
- [unminify `async`](#unminify-async)
|
|
100
|
-
- [write `async`](#write-async)
|
|
101
|
-
- [history `api`](#history-api)
|
|
102
|
-
- [isOn](#ison)
|
|
103
|
-
- [isOff](#isoff)
|
|
104
|
-
- [activate](#activate-1)
|
|
105
|
-
- [deactivate](#deactivate-1)
|
|
106
|
-
- [isLoaded](#isloaded-async-1)
|
|
107
|
-
- [toggle](#toggle)
|
|
108
|
-
- [instructions `api`](#instructions-api)
|
|
109
|
-
- [add `async`](#add-async)
|
|
110
|
-
- [clear `async`](#clear-async)
|
|
111
|
-
- [turnOff `async`](#turnoff-async)
|
|
112
|
-
- [turnOn `async`](#turnon-async)
|
|
113
|
-
- [toggle `async`](#toggle-async)
|
|
114
|
-
- [menu `api`](#menu-api)
|
|
115
|
-
- [open](#open)
|
|
116
|
-
- [close](#close)
|
|
117
|
-
- [response `api`](#response-api)
|
|
118
|
-
- [get](#get-1)
|
|
119
|
-
- [getFromAPI `async`](#getfromapi-async)
|
|
120
|
-
- [getFromDOM](#getfromdom)
|
|
121
|
-
- [getLast `async`](#getlast-async)
|
|
122
|
-
- [regenerate](#regenerate-1)
|
|
123
|
-
- [stopGenerating](#stopgenerating)
|
|
124
|
-
- [settings `api`](#settings-api)
|
|
125
|
-
- [scheme `api subset`](#scheme-api-subset)
|
|
126
|
-
- [isDark](#isdark)
|
|
127
|
-
- [isLight](#islight)
|
|
128
|
-
- [set](#set)
|
|
129
|
-
- [toggle](#toggle-1)
|
|
130
|
-
- [sidebar `api`](#sidebar-api)
|
|
131
|
-
- [append](#append)
|
|
132
|
-
- [isOn](#ison-1)
|
|
133
|
-
- [isOff](#isoff-1)
|
|
134
|
-
- [hide](#hide)
|
|
135
|
-
- [show](#show)
|
|
136
|
-
- [toggle](#toggle-2)
|
|
137
|
-
|
|
138
|
-
# Importing the library
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
xhr
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
document.
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
```js
|
|
176
|
-
...
|
|
177
|
-
// @require https://cdn.jsdelivr.net/
|
|
178
|
-
// ==/UserScript==
|
|
179
|
-
|
|
180
|
-
// Your code here...
|
|
181
|
-
```
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
(
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
(
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
response = chatgpt.
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
(
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
```
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
`
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
the project.
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
`
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
(
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
(
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
`
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
(
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
```
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
```
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
```
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
```
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
```
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
`
|
|
560
|
-
|
|
561
|
-
`
|
|
562
|
-
|
|
563
|
-
`
|
|
564
|
-
|
|
565
|
-
`
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
function
|
|
573
|
-
|
|
574
|
-
function
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
`
|
|
589
|
-
|
|
590
|
-
`
|
|
591
|
-
|
|
592
|
-
`
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
```
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
(
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
`
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
(
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
```
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
(
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
`
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
(
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
`
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
`
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
`
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
await chatgpt.getChatData();
|
|
726
|
-
// or
|
|
727
|
-
await chatgpt.getChatData('latest'
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
"
|
|
737
|
-
"
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
```
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
await chatgpt.getChatData('latest', 'msg');
|
|
762
|
-
// or
|
|
763
|
-
await chatgpt.getChatData('latest', 'msg', 'all');
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
await chatgpt.getChatData('latest', 'msg');
|
|
792
|
-
// or
|
|
793
|
-
await chatgpt.getChatData('latest', 'msg', 'chatgpt');
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
[
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
```
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
```
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
(
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
(
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
If it's a
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
`
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
(
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
fifthResp = chatgpt.getResponseFromDOM(
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
```
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
(
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
```
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
`
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
```
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
`
|
|
1011
|
-
|
|
1012
|
-
`
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
(
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
`
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
- `
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
(
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
```
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
```
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
```
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
```
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
```
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
```
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
(
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
chatgpt.
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
console.
|
|
1321
|
-
}
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
`
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
(
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
return
|
|
1366
|
-
}
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
const
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
`
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
(
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
```
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
```
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
(
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
```
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
`
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
(
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
(
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
(
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
(
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
(
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
```
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
```
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
If it's a
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
```
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
```
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
`
|
|
1717
|
-
|
|
1718
|
-
`
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
```
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
```
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
```
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
[Discuss](https://github.com/kudoai/chatgpt.js/discussions) /
|
|
1814
|
-
<a href="#">Back to top ↑</a>
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
<picture>
|
|
4
|
+
<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">
|
|
5
|
+
<img width=700 src="https://raw.githubusercontent.com/kudoai/chatgpt.js/main/media/images/logos/chatgpt.js/with-reflection/lightmode.png">
|
|
6
|
+
</picture>
|
|
7
|
+
|
|
8
|
+
**chatgpt.js** is a powerful JavaScript library that allows for super easy interaction w/ the ChatGPT DOM.
|
|
9
|
+
|
|
10
|
+
</div>
|
|
11
|
+
|
|
12
|
+
## Table of contents
|
|
13
|
+
|
|
14
|
+
- [Importing the library](#importing-the-library)
|
|
15
|
+
- [ES6](#es6)
|
|
16
|
+
- [ES5](#es5)
|
|
17
|
+
- [Greasemonkey](#greasemonkey)
|
|
18
|
+
- [Chrome](#chrome)
|
|
19
|
+
- [Library methods](#library-methods)
|
|
20
|
+
- [General](#general)
|
|
21
|
+
- [detectLanguage `async`](#detectlanguage-async)
|
|
22
|
+
- [executeCode `async`](#executecode-async)
|
|
23
|
+
- [generateRandomIP](#generaterandomip)
|
|
24
|
+
- [get](#get)
|
|
25
|
+
- [getUserLanguage](#getuserlanguage)
|
|
26
|
+
- [isChromium](#ischromium)
|
|
27
|
+
- [isFirefox](#isfirefox)
|
|
28
|
+
- [isFullScreen](#isfullscreen)
|
|
29
|
+
- [isLoaded `async`](#isloaded-async)
|
|
30
|
+
- [isMobileDevice](#ismobiledevice)
|
|
31
|
+
- [printAllFunctions](#printallfunctions)
|
|
32
|
+
- [randomFloat](#randomfloat)
|
|
33
|
+
- [renderHTML](#renderhtml)
|
|
34
|
+
- [sentiment `async`](#sentiment-async)
|
|
35
|
+
- [suggest `async`](#suggest-async)
|
|
36
|
+
- [summarize `async`](#summarize-async)
|
|
37
|
+
- [translate `async`](#translate-async)
|
|
38
|
+
- [uuidv4](#uuidv4)
|
|
39
|
+
- [Page theme](#page-theme)
|
|
40
|
+
- [activateDarkMode](#activatedarkmode)
|
|
41
|
+
- [activateLightMode](#activatelightmode)
|
|
42
|
+
- [isDarkMode](#isdarkmode)
|
|
43
|
+
- [isLightMode](#islightmode)
|
|
44
|
+
- [toggleScheme](#togglescheme)
|
|
45
|
+
- [In-site notifications](#in-site-notifications)
|
|
46
|
+
- [alert](#alert)
|
|
47
|
+
- [notify](#notify)
|
|
48
|
+
- [User session](#user-session)
|
|
49
|
+
- [getAccessToken `async`](#getaccesstoken-async)
|
|
50
|
+
- [getAccountDetails `async`](#getaccountdetails-async)
|
|
51
|
+
- [logout](#logout)
|
|
52
|
+
- [Chats](#chats)
|
|
53
|
+
- [askAndGetReply `async`](#askandgetreply-async)
|
|
54
|
+
- [clearChats `async`](#clearchats-async)
|
|
55
|
+
- [exportChat `async`](#exportchat-async)
|
|
56
|
+
- [getChatData `async`](#getchatdata-async)
|
|
57
|
+
- [getChatInput](#getchatinput)
|
|
58
|
+
- [getLastPrompt `async`](#getlastprompt-async)
|
|
59
|
+
- [getLastResponse `async`](#getlastresponse-async)
|
|
60
|
+
- [getResponse](#getresponse)
|
|
61
|
+
- [getResponseFromAPI `async`](#getresponsefromapi-async)
|
|
62
|
+
- [getResponseFromDOM](#getresponsefromdom)
|
|
63
|
+
- [isIdle `async`](#isidle-async)
|
|
64
|
+
- [regenerate](#regenerate)
|
|
65
|
+
- [resend `async`](#resend-async)
|
|
66
|
+
- [scrollToBottom](#scrolltobottom)
|
|
67
|
+
- [send](#send)
|
|
68
|
+
- [sendInNewChat](#sendinnewchat)
|
|
69
|
+
- [shareChat `async`](#sharechat-async)
|
|
70
|
+
- [speak](#speak)
|
|
71
|
+
- [startNewChat](#startnewchat)
|
|
72
|
+
- [stop](#stop)
|
|
73
|
+
- [DOM related](#dom-related)
|
|
74
|
+
- [getChatBox](#getchatbox)
|
|
75
|
+
- [getContinueGeneratingButton](#getcontinuegeneratingbutton)
|
|
76
|
+
- [getNewChatLink](#getnewchatlink)
|
|
77
|
+
- [getRegenerateButton](#getregeneratebutton)
|
|
78
|
+
- [getSendButton](#getsendbutton)
|
|
79
|
+
- [getStopGeneratingButton](#getstopgeneratingbutton)
|
|
80
|
+
- [Library APIs](#library-apis)
|
|
81
|
+
- [autoRefresh `api`](#autorefresh-api)
|
|
82
|
+
- [activate](#activate)
|
|
83
|
+
- [deactivate](#deactivate)
|
|
84
|
+
- [nowTimeStamp](#nowtimestamp)
|
|
85
|
+
- [browser `api`](#browser-api)
|
|
86
|
+
- [isLightMode](#islightmode-1)
|
|
87
|
+
- [isDarkMode](#isdarkmode-1)
|
|
88
|
+
- [isChromium](#ischromium-1)
|
|
89
|
+
- [isFirefox](#isfirefox-1)
|
|
90
|
+
- [isFullScreen](#isfullscreen-1)
|
|
91
|
+
- [isMobile](#ismobile)
|
|
92
|
+
- [code `api`](#code-api)
|
|
93
|
+
- [minify `async`](#minify-async)
|
|
94
|
+
- [execute `async`](#execute-async)
|
|
95
|
+
- [extract](#extract)
|
|
96
|
+
- [obfuscate `async`](#obfuscate-async)
|
|
97
|
+
- [refactor `async`](#refactor-async)
|
|
98
|
+
- [review `async`](#review-async)
|
|
99
|
+
- [unminify `async`](#unminify-async)
|
|
100
|
+
- [write `async`](#write-async)
|
|
101
|
+
- [history `api`](#history-api)
|
|
102
|
+
- [isOn](#ison)
|
|
103
|
+
- [isOff](#isoff)
|
|
104
|
+
- [activate](#activate-1)
|
|
105
|
+
- [deactivate](#deactivate-1)
|
|
106
|
+
- [isLoaded](#isloaded-async-1)
|
|
107
|
+
- [toggle](#toggle)
|
|
108
|
+
- [instructions `api`](#instructions-api)
|
|
109
|
+
- [add `async`](#add-async)
|
|
110
|
+
- [clear `async`](#clear-async)
|
|
111
|
+
- [turnOff `async`](#turnoff-async)
|
|
112
|
+
- [turnOn `async`](#turnon-async)
|
|
113
|
+
- [toggle `async`](#toggle-async)
|
|
114
|
+
- [menu `api`](#menu-api)
|
|
115
|
+
- [open](#open)
|
|
116
|
+
- [close](#close)
|
|
117
|
+
- [response `api`](#response-api)
|
|
118
|
+
- [get](#get-1)
|
|
119
|
+
- [getFromAPI `async`](#getfromapi-async)
|
|
120
|
+
- [getFromDOM](#getfromdom)
|
|
121
|
+
- [getLast `async`](#getlast-async)
|
|
122
|
+
- [regenerate](#regenerate-1)
|
|
123
|
+
- [stopGenerating](#stopgenerating)
|
|
124
|
+
- [settings `api`](#settings-api)
|
|
125
|
+
- [scheme `api subset`](#scheme-api-subset)
|
|
126
|
+
- [isDark](#isdark)
|
|
127
|
+
- [isLight](#islight)
|
|
128
|
+
- [set](#set)
|
|
129
|
+
- [toggle](#toggle-1)
|
|
130
|
+
- [sidebar `api`](#sidebar-api)
|
|
131
|
+
- [append](#append)
|
|
132
|
+
- [isOn](#ison-1)
|
|
133
|
+
- [isOff](#isoff-1)
|
|
134
|
+
- [hide](#hide)
|
|
135
|
+
- [show](#show)
|
|
136
|
+
- [toggle](#toggle-2)
|
|
137
|
+
|
|
138
|
+
# Importing the library
|
|
139
|
+
|
|
140
|
+
> **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`_
|
|
141
|
+
|
|
142
|
+
## ES6
|
|
143
|
+
|
|
144
|
+
```js
|
|
145
|
+
(async () => {
|
|
146
|
+
await import('https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.5/dist/chatgpt.min.js');
|
|
147
|
+
// Your code here...
|
|
148
|
+
})();
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
## ES5
|
|
152
|
+
|
|
153
|
+
```js
|
|
154
|
+
var xhr = new XMLHttpRequest();
|
|
155
|
+
xhr.open('GET', 'https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.5/dist/chatgpt.min.js');
|
|
156
|
+
xhr.onload = function () {
|
|
157
|
+
if (xhr.status === 200) {
|
|
158
|
+
var chatgptJS = document.createElement('script');
|
|
159
|
+
chatgptJS.textContent = xhr.responseText;
|
|
160
|
+
document.head.append(chatgptJS);
|
|
161
|
+
yourCode(); // runs your code
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
xhr.send();
|
|
165
|
+
|
|
166
|
+
function yourCode() {
|
|
167
|
+
// Your code here...
|
|
168
|
+
}
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
## Greasemonkey
|
|
172
|
+
|
|
173
|
+
> **Note** _To use a starter template: [kudoai/chatgpt.js-greasemonkey-starter](https://github.com/kudoai/chatgpt.js-greasemonkey-starter)_
|
|
174
|
+
|
|
175
|
+
```js
|
|
176
|
+
...
|
|
177
|
+
// @require https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.5/dist/chatgpt.min.js
|
|
178
|
+
// ==/UserScript==
|
|
179
|
+
|
|
180
|
+
// Your code here...
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
## Chrome
|
|
184
|
+
|
|
185
|
+
> **Note** _To use a starter template: [kudoai/chatgpt.js-chrome-starter](https://github.com/kudoai/chatgpt.js-chrome-starter)_
|
|
186
|
+
|
|
187
|
+
1. Save https://raw.githubusercontent.com/kudoai/chatgpt.js/main/chatgpt.js to a subdirectory (`lib` in this example)
|
|
188
|
+
|
|
189
|
+
2. Add ES6 export statement to end of `lib/chatgpt.js`
|
|
190
|
+
```js
|
|
191
|
+
...
|
|
192
|
+
export { chatgpt }
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
3. In project's (V3) `manifest.json`, add `lib/chatgpt.js` as a web accessible resource
|
|
196
|
+
```json
|
|
197
|
+
"web_accessible_resources": [{
|
|
198
|
+
"matches": ["<all_urls>"],
|
|
199
|
+
"resources": ["lib/chatgpt.js"]
|
|
200
|
+
}],
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
4. In scripts that need `chatgpt.js` (foreground/background alike), import it like so:
|
|
204
|
+
```js
|
|
205
|
+
(async () => {
|
|
206
|
+
const { chatgpt } = await import(chrome.runtime.getURL('lib/chatgpt.js'));
|
|
207
|
+
// Your code here...
|
|
208
|
+
})();
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
# Library methods
|
|
212
|
+
|
|
213
|
+
Unless noted otherwise, methods are **synchronous**: they wait for the operation to finish, instead of returning immediately. If you need to know the result of calling **asynchronous** methods, use the returned promise or pass a callback function into the method.
|
|
214
|
+
|
|
215
|
+
## General
|
|
216
|
+
|
|
217
|
+
### detectLanguage `async`
|
|
218
|
+
|
|
219
|
+
Asks ChatGPT to detect the language of given text.
|
|
220
|
+
|
|
221
|
+
**Parameters**:
|
|
222
|
+
|
|
223
|
+
`text`: A string being the text to detect the language of.
|
|
224
|
+
|
|
225
|
+
Example code:
|
|
226
|
+
|
|
227
|
+
```js
|
|
228
|
+
(async () => {
|
|
229
|
+
const language = await chatgpt.detectLanguage('我是一個大男孩');
|
|
230
|
+
console.log(language);
|
|
231
|
+
/* Logs:
|
|
232
|
+
Chinese (Traditional) */
|
|
233
|
+
})();
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
### executeCode `async`
|
|
237
|
+
|
|
238
|
+
Asks ChatGPT to execute the given code.
|
|
239
|
+
|
|
240
|
+
**Parameters**:
|
|
241
|
+
|
|
242
|
+
`code`: A string being the code to execute.
|
|
243
|
+
|
|
244
|
+
Example code:
|
|
245
|
+
|
|
246
|
+
```js
|
|
247
|
+
(async () => {
|
|
248
|
+
console.log(await chatgpt.executeCode('return 6 + 5')); // logs '11'
|
|
249
|
+
})();
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
### generateRandomIP
|
|
253
|
+
|
|
254
|
+
Returns a random IP address as a string.
|
|
255
|
+
|
|
256
|
+
Example code:
|
|
257
|
+
|
|
258
|
+
```js
|
|
259
|
+
const randomIP = chatgpt.generateRandomIP();
|
|
260
|
+
console.log(randomIP); // Example output: '161.192.110.125'
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
### get
|
|
264
|
+
|
|
265
|
+
Example code:
|
|
266
|
+
|
|
267
|
+
```js
|
|
268
|
+
var response;
|
|
269
|
+
|
|
270
|
+
response = chatgpt.get('reply', 'last');
|
|
271
|
+
// Equivalent of
|
|
272
|
+
response = chatgpt.getLastResponse();
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
### getUserLanguage
|
|
276
|
+
|
|
277
|
+
Returns the user language as a string.
|
|
278
|
+
|
|
279
|
+
Example code:
|
|
280
|
+
|
|
281
|
+
```js
|
|
282
|
+
const userLanguage = chatgpt.getUserLanguage();
|
|
283
|
+
console.log(userLanguage); // Example output: 'en-US'
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
### isChromium
|
|
287
|
+
|
|
288
|
+
Returns a boolean value. `true` if the browser is Chromium and `false` otherwise.
|
|
289
|
+
|
|
290
|
+
Example code:
|
|
291
|
+
|
|
292
|
+
```js
|
|
293
|
+
if (chatgpt.isChromium()) {
|
|
294
|
+
// Do something
|
|
295
|
+
}
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
### isFirefox
|
|
299
|
+
|
|
300
|
+
Returns a boolean value. `true` if the browser is Firefox and `false` otherwise.
|
|
301
|
+
|
|
302
|
+
Example code:
|
|
303
|
+
|
|
304
|
+
```js
|
|
305
|
+
if (chatgpt.isFirefox()) {
|
|
306
|
+
// Do something
|
|
307
|
+
}
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
### isFullScreen
|
|
311
|
+
|
|
312
|
+
Returns a boolean value. `true` if the website is fullscreen and `false` otherwise.
|
|
313
|
+
|
|
314
|
+
Example code:
|
|
315
|
+
|
|
316
|
+
```js
|
|
317
|
+
if (chatgpt.isFullScreen()) {
|
|
318
|
+
// Do something
|
|
319
|
+
}
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
### isLoaded `async`
|
|
323
|
+
|
|
324
|
+
Resolves a promise when ChatGPT has finished loading.
|
|
325
|
+
|
|
326
|
+
Example code:
|
|
327
|
+
|
|
328
|
+
```js
|
|
329
|
+
(async () => {
|
|
330
|
+
await chatgpt.isLoaded();
|
|
331
|
+
console.log('ChatGPT has finished loading.');
|
|
332
|
+
})();
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
### isMobileDevice
|
|
336
|
+
|
|
337
|
+
Returns a boolean value. `true` if the user device is mobile and `false` otherwise.
|
|
338
|
+
|
|
339
|
+
Example code:
|
|
340
|
+
|
|
341
|
+
```js
|
|
342
|
+
if (chatgpt.isMobileDevice()) {
|
|
343
|
+
// Do something
|
|
344
|
+
}
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
### printAllFunctions
|
|
348
|
+
|
|
349
|
+
Prints all the library functions to the console.
|
|
350
|
+
|
|
351
|
+
Example code:
|
|
352
|
+
|
|
353
|
+
```js
|
|
354
|
+
chatgpt.printAllFunctions();
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
### randomFloat
|
|
358
|
+
|
|
359
|
+
Returns a random, cryptographically secure float number between 0 (inclusive) and 1 (exclusive).
|
|
360
|
+
|
|
361
|
+
Example code:
|
|
362
|
+
|
|
363
|
+
```js
|
|
364
|
+
const randomNumber = chatgpt.randomFloat();
|
|
365
|
+
console.log(randomNumber); // Example output: 0.9472113021060851
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
### renderHTML
|
|
369
|
+
|
|
370
|
+
Cleans and renders given HTML code.
|
|
371
|
+
|
|
372
|
+
**Parameters**:
|
|
373
|
+
|
|
374
|
+
`node`: A string representing the HTML to be rendered.
|
|
375
|
+
|
|
376
|
+
Example code:
|
|
377
|
+
|
|
378
|
+
```js
|
|
379
|
+
document.body.append(
|
|
380
|
+
chatgpt.renderHTML('<div>Hello World!</div>');
|
|
381
|
+
);
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
### sentiment `async`
|
|
385
|
+
|
|
386
|
+
Asks ChatGPT to analyze sentiment from a given text.
|
|
387
|
+
|
|
388
|
+
**Parameters**:
|
|
389
|
+
|
|
390
|
+
`text`: A string being the text to be analyzed.
|
|
391
|
+
|
|
392
|
+
`entity` (optional): A string being the entity to analyze sentiment towards.
|
|
393
|
+
|
|
394
|
+
Example code:
|
|
395
|
+
|
|
396
|
+
```js
|
|
397
|
+
(async () => {
|
|
398
|
+
const text = 'Are you an #OSS supporter? Do you love JavaScript? Then why not contribute to the future of #AI app development? https://chatgpt.js.org (a #100Builders project) is seeking collabs for exactly this! @withBackdrop';
|
|
399
|
+
const sentiment = await chatgpt.sentiment(text, '100 Builders');
|
|
400
|
+
console.log(sentiment);
|
|
401
|
+
|
|
402
|
+
/* Example output:
|
|
403
|
+
The sentiment of the text towards the entity "100 Builders" is strongly positive. The text encourages
|
|
404
|
+
individuals who support open-source software (OSS) and have an affinity for JavaScript to get involved with
|
|
405
|
+
the project. Phrases like "contribute to the future," "seeking collabs," and the inclusion of the hashtag
|
|
406
|
+
#100Builders project indicate a positive and enthusiastic tone, promoting engagement and collaboration
|
|
407
|
+
with the project. */
|
|
408
|
+
})();
|
|
409
|
+
```
|
|
410
|
+
|
|
411
|
+
### suggest `async`
|
|
412
|
+
|
|
413
|
+
Asks ChatGPT to suggest ideas.
|
|
414
|
+
|
|
415
|
+
**Parameters**:
|
|
416
|
+
|
|
417
|
+
`ideaType`: A string being the type of idea to suggest.
|
|
418
|
+
|
|
419
|
+
`details` (optional): A string being details to fine-tune the suggestion.
|
|
420
|
+
|
|
421
|
+
Example code:
|
|
422
|
+
|
|
423
|
+
```js
|
|
424
|
+
(async () => {
|
|
425
|
+
const suggestions = await chatgpt.suggest('names', 'baby boy');
|
|
426
|
+
console.log(suggestions);
|
|
427
|
+
|
|
428
|
+
/* Example output:
|
|
429
|
+
1. Liam
|
|
430
|
+
2. Noah
|
|
431
|
+
3. Ethan
|
|
432
|
+
4. Oliver
|
|
433
|
+
5. Jackson
|
|
434
|
+
6. Aiden
|
|
435
|
+
7. Lucas
|
|
436
|
+
8. Benjamin
|
|
437
|
+
9. Henry
|
|
438
|
+
10. Leo
|
|
439
|
+
11. Samuel
|
|
440
|
+
12. Caleb
|
|
441
|
+
13. Owen
|
|
442
|
+
14. Daniel
|
|
443
|
+
15. Elijah
|
|
444
|
+
16. Matthew
|
|
445
|
+
17. Alexander
|
|
446
|
+
18. James
|
|
447
|
+
19. Nathan
|
|
448
|
+
20. Gabriel */
|
|
449
|
+
})();
|
|
450
|
+
```
|
|
451
|
+
|
|
452
|
+
### summarize `async`
|
|
453
|
+
|
|
454
|
+
Asks ChatGPT to summarize given text.
|
|
455
|
+
|
|
456
|
+
**Parameters**:
|
|
457
|
+
|
|
458
|
+
`text`: A string being the text to be summarized.
|
|
459
|
+
|
|
460
|
+
Example code:
|
|
461
|
+
|
|
462
|
+
```js
|
|
463
|
+
(async () => {
|
|
464
|
+
const summary = await chatgpt.summarize('A very long text...');
|
|
465
|
+
console.log(summary); // Example output: 'A very short text...'
|
|
466
|
+
})();
|
|
467
|
+
```
|
|
468
|
+
|
|
469
|
+
### translate `async`
|
|
470
|
+
|
|
471
|
+
Asks ChatGPT to translate given text to a given language.
|
|
472
|
+
|
|
473
|
+
**Parameters**:
|
|
474
|
+
|
|
475
|
+
`text`: A string being the text to translate.
|
|
476
|
+
|
|
477
|
+
`outputLang`: A string representing the output language of the translation.
|
|
478
|
+
|
|
479
|
+
Example code:
|
|
480
|
+
|
|
481
|
+
```js
|
|
482
|
+
(async () => {
|
|
483
|
+
const translation = await chatgpt.translate('Hello, how are you?', 'spanish');
|
|
484
|
+
console.log(translation); // Logs: 'Hola, ¿cómo estás?'
|
|
485
|
+
})();
|
|
486
|
+
```
|
|
487
|
+
|
|
488
|
+
### uuidv4
|
|
489
|
+
|
|
490
|
+
Example code:
|
|
491
|
+
|
|
492
|
+
```js
|
|
493
|
+
const randomID = chatgpt.uuidv4();
|
|
494
|
+
console.log(randomID); // Example output: '239067d1-bcb8-4fd7-91eb-9ab94619b7b3'
|
|
495
|
+
```
|
|
496
|
+
|
|
497
|
+
## Page theme
|
|
498
|
+
|
|
499
|
+
### activateDarkMode
|
|
500
|
+
|
|
501
|
+
Changes the website theme to dark mode.
|
|
502
|
+
|
|
503
|
+
Example code:
|
|
504
|
+
|
|
505
|
+
```js
|
|
506
|
+
chatgpt.activateDarkMode();
|
|
507
|
+
```
|
|
508
|
+
|
|
509
|
+
### activateLightMode
|
|
510
|
+
|
|
511
|
+
Changes the website theme to light mode.
|
|
512
|
+
|
|
513
|
+
Example code:
|
|
514
|
+
|
|
515
|
+
```js
|
|
516
|
+
chatgpt.activateLightMode();
|
|
517
|
+
```
|
|
518
|
+
|
|
519
|
+
### isDarkMode
|
|
520
|
+
|
|
521
|
+
Returns a boolean value. `true` if the theme is dark mode, `false` otherwise.
|
|
522
|
+
|
|
523
|
+
Example code:
|
|
524
|
+
|
|
525
|
+
```js
|
|
526
|
+
console.log(chatgpt.settings.scheme.isDark()); // logs `true` or `false`
|
|
527
|
+
```
|
|
528
|
+
|
|
529
|
+
### isLightMode
|
|
530
|
+
|
|
531
|
+
Returns a boolean value. `true` if the theme is light mode, `false` otherwise.
|
|
532
|
+
|
|
533
|
+
Example code:
|
|
534
|
+
|
|
535
|
+
```js
|
|
536
|
+
console.log(chatgpt.settings.scheme.isDark()); // logs `true` or `false`
|
|
537
|
+
```
|
|
538
|
+
|
|
539
|
+
### toggleScheme
|
|
540
|
+
|
|
541
|
+
Toggles the theme between light and dark mode.
|
|
542
|
+
|
|
543
|
+
Example code:
|
|
544
|
+
|
|
545
|
+
```js
|
|
546
|
+
chatgpt.toggleScheme();
|
|
547
|
+
```
|
|
548
|
+
|
|
549
|
+
## In-site notifications
|
|
550
|
+
|
|
551
|
+
### alert
|
|
552
|
+
|
|
553
|
+
Creates a static alert box which displays a message. Only a user interaction can close it. Returns the HTML `id` property of the alert box as a string.
|
|
554
|
+
|
|
555
|
+
**Parameters**:
|
|
556
|
+
|
|
557
|
+
`title` (optional): A string which is the title of the alert.
|
|
558
|
+
|
|
559
|
+
`msg` (optional): A string which is the message to be displayed.
|
|
560
|
+
|
|
561
|
+
`btns` (optional): An array of functions which will be rendered as clickable buttons.
|
|
562
|
+
|
|
563
|
+
`checkbox` (optional): A function which will be rendered as a checkbox.
|
|
564
|
+
|
|
565
|
+
`width` (optional): An integer representing the width of the alert box in `px`.
|
|
566
|
+
|
|
567
|
+
Example code:
|
|
568
|
+
|
|
569
|
+
```js
|
|
570
|
+
function doSomething() { /* Your code */ }
|
|
571
|
+
|
|
572
|
+
function doSomethingElse() { /* Your code */ }
|
|
573
|
+
|
|
574
|
+
function sayHello() { console.log('Hello!'); }
|
|
575
|
+
|
|
576
|
+
const alertID = chatgpt.alert('Hello, world!', 'The sky is blue.', [doSomething, doSomethingElse], sayHello, 200);
|
|
577
|
+
console.log(alertID); // Example output: '1693237957878'
|
|
578
|
+
```
|
|
579
|
+
|
|
580
|
+
### notify
|
|
581
|
+
|
|
582
|
+
Displays a temporary notification at a specified position in the website.
|
|
583
|
+
|
|
584
|
+
**Parameters**:
|
|
585
|
+
|
|
586
|
+
`msg`: A string which is the message to be displayed.
|
|
587
|
+
|
|
588
|
+
`position` (optional): A string specifying the position of the notification.
|
|
589
|
+
|
|
590
|
+
`notifDuration` (optional): A float specifying the duration of the notification before it fades out.
|
|
591
|
+
|
|
592
|
+
`shadow` (optional): A string specifying if the `box-shadow` CSS property should be used.
|
|
593
|
+
|
|
594
|
+
Example code:
|
|
595
|
+
|
|
596
|
+
```js
|
|
597
|
+
chatgpt.notify('Hello, world!', 'top left', 3, 'on');
|
|
598
|
+
```
|
|
599
|
+
|
|
600
|
+
## User session
|
|
601
|
+
|
|
602
|
+
### getAccessToken `async`
|
|
603
|
+
|
|
604
|
+
Returns an account access token as a string.
|
|
605
|
+
|
|
606
|
+
```js
|
|
607
|
+
(async () => {
|
|
608
|
+
const token = await chatgpt.getAccessToken();
|
|
609
|
+
console.log(token); // Example output: 'abcdef[...]'
|
|
610
|
+
})();
|
|
611
|
+
```
|
|
612
|
+
|
|
613
|
+
### getAccountDetails `async`
|
|
614
|
+
|
|
615
|
+
Returns a given account detail as a string.
|
|
616
|
+
|
|
617
|
+
**Parameters**:
|
|
618
|
+
|
|
619
|
+
`detail`: A string representing the account detail(s) that will be returned.
|
|
620
|
+
|
|
621
|
+
Can be the following: `email`, `id`, `image`, `name`, `picture`. If a single detail is passed, it will be returned as a string, if multiple are passed instead, the function will return an object with the requested details. If no details are passed, the function will return an object with all the available details.
|
|
622
|
+
|
|
623
|
+
```js
|
|
624
|
+
(async () => {
|
|
625
|
+
const accountName = await chatgpt.getAccountDetails('name');
|
|
626
|
+
console.log(accountName); // Example output: 'chatgpt.js'
|
|
627
|
+
|
|
628
|
+
const accountData = await chatgpt.getAccountDetails('name', 'email');
|
|
629
|
+
console.log(accountData);
|
|
630
|
+
/* Example output:
|
|
631
|
+
{
|
|
632
|
+
name: 'chatgpt.js',
|
|
633
|
+
email: 'showcase@chatgptjs.org'
|
|
634
|
+
}
|
|
635
|
+
*/
|
|
636
|
+
})();
|
|
637
|
+
```
|
|
638
|
+
|
|
639
|
+
### logout
|
|
640
|
+
|
|
641
|
+
Logs out the user from the website.
|
|
642
|
+
|
|
643
|
+
Example code:
|
|
644
|
+
|
|
645
|
+
```js
|
|
646
|
+
chatgpt.logout();
|
|
647
|
+
```
|
|
648
|
+
|
|
649
|
+
## Chats
|
|
650
|
+
|
|
651
|
+
### askAndGetReply `async`
|
|
652
|
+
|
|
653
|
+
Sends a given message to ChatGPT and returns the response as a string.
|
|
654
|
+
|
|
655
|
+
Example code:
|
|
656
|
+
|
|
657
|
+
```js
|
|
658
|
+
(async () => {
|
|
659
|
+
const response = await chatgpt.askAndGetReply('Hello, ChatGPT');
|
|
660
|
+
console.log(response); // Example output: 'Hello user, I'm ChatGPT!'
|
|
661
|
+
})();
|
|
662
|
+
```
|
|
663
|
+
|
|
664
|
+
### clearChats `async`
|
|
665
|
+
|
|
666
|
+
`method` (optional): The string `'api'` or `'dom'` representing the method to use.
|
|
667
|
+
|
|
668
|
+
> **Note** _The API method does not update DOM chat list (until session refresh)_
|
|
669
|
+
|
|
670
|
+
### exportChat `async`
|
|
671
|
+
|
|
672
|
+
Exports a given chat as a file.
|
|
673
|
+
|
|
674
|
+
**Parameters**:
|
|
675
|
+
|
|
676
|
+
`chatToGet` (optional): A string representing the chat to get the data from.
|
|
677
|
+
|
|
678
|
+
Can be the following: `active`, the current chat, `latest`, the latest chat in the list, else the `index`, `title` or `id` of the chat to get. Default is `active` if in a chat, else `latest`.
|
|
679
|
+
|
|
680
|
+
`format` (optional): A string representing the format of the export file.
|
|
681
|
+
|
|
682
|
+
Can be the following: `html`, `md`, `pdf` or `text`. Defaults to `html`.
|
|
683
|
+
|
|
684
|
+
Example code:
|
|
685
|
+
|
|
686
|
+
```js
|
|
687
|
+
(async () => {
|
|
688
|
+
await chatgpt.exportChat('latest', 'html'); // Downloads a '.html' file
|
|
689
|
+
})();
|
|
690
|
+
```
|
|
691
|
+
|
|
692
|
+
### getChatData `async`
|
|
693
|
+
|
|
694
|
+
Returns the requested chat data as a string (if single detail requested) or object of key-value pairs (if multiple details requested).
|
|
695
|
+
|
|
696
|
+
**Parameters**:
|
|
697
|
+
|
|
698
|
+
`chatToGet` (optional): A string representing the chat to get the data from.
|
|
699
|
+
|
|
700
|
+
Can be the following: `active`, the current chat, `latest`, the latest chat in the list, else the `index`, `title` or `id` of the chat to get. Default is `active` if in a chat, else `latest`.
|
|
701
|
+
|
|
702
|
+
`detailsToGet` (optional): A string or array of strings representing the chat data to retrieve.
|
|
703
|
+
|
|
704
|
+
Can be the following: `all` to get all details, `id`, `title`, `create_time`, `update_time` or `msg`. To get a single detail, just use a string, to get multiple use an array of strings instead. Default is `all`.
|
|
705
|
+
|
|
706
|
+
_**If `msg` is the requested detail, the following parameters can be used**_:
|
|
707
|
+
|
|
708
|
+
`sender` (optional): A string representing the chat member to get the message(s) from.
|
|
709
|
+
|
|
710
|
+
Can be the following: `user` to get the user message(s), `chatgpt` to get ChatGPT's response(s), `all`/`both` to get both of them. Default is `all`.
|
|
711
|
+
|
|
712
|
+
`msgToGet` (optional): A string/number representing the chat message to retrieve.
|
|
713
|
+
|
|
714
|
+
Can be the following: `all` to get all the messages in the chat, `latest` to get the latest message/response, or the `index` of the message. Default is `all`.
|
|
715
|
+
|
|
716
|
+
> **Note** _If any **user** messages were edited, they are added to the index as newly sent messages_
|
|
717
|
+
|
|
718
|
+
Example code **for all return types**:
|
|
719
|
+
|
|
720
|
+
_**All details from specified chat**_
|
|
721
|
+
|
|
722
|
+
```js
|
|
723
|
+
await chatgpt.getChatData();
|
|
724
|
+
// or
|
|
725
|
+
await chatgpt.getChatData('latest'); // can also be 'active', 'title of the chat' or 'id of the chat'
|
|
726
|
+
// or
|
|
727
|
+
await chatgpt.getChatData('latest', 'all');
|
|
728
|
+
```
|
|
729
|
+
|
|
730
|
+
_Returns a JSON object_
|
|
731
|
+
|
|
732
|
+
```json
|
|
733
|
+
{
|
|
734
|
+
"create_time": "2023-07-19T13:24:05.618539+00:00",
|
|
735
|
+
"id": "e193a219-2311-4232-95f5-8e3a0e466652",
|
|
736
|
+
"title": "Lemons: Citrus Fruit Overview.",
|
|
737
|
+
"update_time": "2023-07-19T13:24:18+00:00"
|
|
738
|
+
}
|
|
739
|
+
```
|
|
740
|
+
|
|
741
|
+
_**Specific detail(s) from specified chat**_
|
|
742
|
+
|
|
743
|
+
```js
|
|
744
|
+
await chatgpt.getChatData('latest', ['id', 'title']);
|
|
745
|
+
```
|
|
746
|
+
|
|
747
|
+
_Returns a JSON object_
|
|
748
|
+
|
|
749
|
+
```json
|
|
750
|
+
{
|
|
751
|
+
"id": "e193a219-2311-4232-95f5-8e3a0e466652",
|
|
752
|
+
"title": "Lemons: Citrus Fruit Overview."
|
|
753
|
+
}
|
|
754
|
+
```
|
|
755
|
+
|
|
756
|
+
_**All messages from both participants in a specified chat**_
|
|
757
|
+
|
|
758
|
+
```js
|
|
759
|
+
await chatgpt.getChatData('latest', 'msg');
|
|
760
|
+
// or
|
|
761
|
+
await chatgpt.getChatData('latest', 'msg', 'all'); // all/both
|
|
762
|
+
// or
|
|
763
|
+
await chatgpt.getChatData('latest', 'msg', 'all', 'all');
|
|
764
|
+
```
|
|
765
|
+
|
|
766
|
+
_Returns an array of JSON objects_
|
|
767
|
+
|
|
768
|
+
In case of a response being regenerated, the `chatgpt` object key will be converted to an array containing all the responses.
|
|
769
|
+
|
|
770
|
+
```json
|
|
771
|
+
[
|
|
772
|
+
{
|
|
773
|
+
"user": "what are lemons",
|
|
774
|
+
"chatgpt": "Lemons are a type of citrus fruit that belongs..."
|
|
775
|
+
},
|
|
776
|
+
{
|
|
777
|
+
"user": "be more specific",
|
|
778
|
+
"chatgpt": [
|
|
779
|
+
"Certainly! Here are some more specific...",
|
|
780
|
+
"Certainly! Here are some specific..." // regenerated responses!
|
|
781
|
+
]
|
|
782
|
+
}
|
|
783
|
+
]
|
|
784
|
+
```
|
|
785
|
+
|
|
786
|
+
_**All messages from a specific participant in a specified chat**_
|
|
787
|
+
|
|
788
|
+
```js
|
|
789
|
+
await chatgpt.getChatData('latest', 'msg');
|
|
790
|
+
// or
|
|
791
|
+
await chatgpt.getChatData('latest', 'msg', 'chatgpt'); // user/chatgpt
|
|
792
|
+
// or
|
|
793
|
+
await chatgpt.getChatData('latest', 'msg', 'chatgpt', 'all');
|
|
794
|
+
```
|
|
795
|
+
|
|
796
|
+
_Returns an array of strings/arrays_
|
|
797
|
+
|
|
798
|
+
In case of a response being regenerated and the requested participant being `chatgpt`, it'll be converted to an array containing all the responses.
|
|
799
|
+
|
|
800
|
+
```json
|
|
801
|
+
[
|
|
802
|
+
"Lemons are a type of citrus fruit that belongs...",
|
|
803
|
+
[
|
|
804
|
+
"Certainly! Here are some more specific details...",
|
|
805
|
+
"Certainly! Here are some specific..."
|
|
806
|
+
]
|
|
807
|
+
]
|
|
808
|
+
```
|
|
809
|
+
|
|
810
|
+
_**One/latest message from both participants in a specified chat**_
|
|
811
|
+
|
|
812
|
+
```js
|
|
813
|
+
await chatgpt.getChatData('latest', 'msg', 'all', 2); // can also be 'latest' message
|
|
814
|
+
```
|
|
815
|
+
|
|
816
|
+
_Returns a JSON object_
|
|
817
|
+
|
|
818
|
+
In case of a response being regenerated, the `chatgpt` object key will be converted to an array containing all the responses.
|
|
819
|
+
|
|
820
|
+
```json
|
|
821
|
+
{
|
|
822
|
+
"user": "be more specific",
|
|
823
|
+
"chatgpt": [
|
|
824
|
+
"Certainly! Here are some more specific...",
|
|
825
|
+
"Certainly! Here are some specific..."
|
|
826
|
+
]
|
|
827
|
+
}
|
|
828
|
+
```
|
|
829
|
+
|
|
830
|
+
_**One/latest message from a specific participant in a specified chat**_
|
|
831
|
+
|
|
832
|
+
```js
|
|
833
|
+
await chatgpt.getChatData('latest', 'msg', 'chatgpt', 2);
|
|
834
|
+
```
|
|
835
|
+
|
|
836
|
+
_Returns a string or an array of strings_
|
|
837
|
+
|
|
838
|
+
In case of a response being regenerated, the `chatgpt` object key will be converted to an array containing all the responses.
|
|
839
|
+
|
|
840
|
+
```json
|
|
841
|
+
"Certainly! Here are some more specific..."
|
|
842
|
+
// or
|
|
843
|
+
[
|
|
844
|
+
"Certainly! Here are some more specific...",
|
|
845
|
+
"Certainly! Here are some specific..."
|
|
846
|
+
]
|
|
847
|
+
```
|
|
848
|
+
|
|
849
|
+
### getChatInput
|
|
850
|
+
|
|
851
|
+
Returns the value of the chat input field as a string.
|
|
852
|
+
|
|
853
|
+
Example code:
|
|
854
|
+
|
|
855
|
+
```js
|
|
856
|
+
const chatInput = chatgpt.getChatInput();
|
|
857
|
+
console.log(chatInput); // Example output: 'Hello from chatgpt.js!'
|
|
858
|
+
```
|
|
859
|
+
|
|
860
|
+
### getLastPrompt `async`
|
|
861
|
+
|
|
862
|
+
Returns the last message sent by the user as a string.
|
|
863
|
+
|
|
864
|
+
```js
|
|
865
|
+
(async () => {
|
|
866
|
+
const message = await chatgpt.getLastPrompt();
|
|
867
|
+
console.log(message); // Example output: 'Hello from chatgpt.js!'
|
|
868
|
+
})();
|
|
869
|
+
```
|
|
870
|
+
|
|
871
|
+
### getLastResponse `async`
|
|
872
|
+
|
|
873
|
+
Returns the last ChatGPT response as a string.
|
|
874
|
+
|
|
875
|
+
```js
|
|
876
|
+
(async () => {
|
|
877
|
+
const response = await chatgpt.getLastResponse();
|
|
878
|
+
console.log(response); // Example output: 'I am ChatGPT!'
|
|
879
|
+
})();
|
|
880
|
+
```
|
|
881
|
+
|
|
882
|
+
### getResponse
|
|
883
|
+
|
|
884
|
+
If it's a previously created chat, read [chatgpt.getResponseFromDOM](#getresponsefromdom)
|
|
885
|
+
|
|
886
|
+
If it's a new chat, read [chatgpt.getResponseFromAPI](#getresponsefromapi-async)
|
|
887
|
+
|
|
888
|
+
### getResponseFromAPI `async`
|
|
889
|
+
|
|
890
|
+
Returns the Nth response ChatGPT has written in a Nth chat as a string.
|
|
891
|
+
|
|
892
|
+
**Parameters**:
|
|
893
|
+
|
|
894
|
+
`chatToGet` (optional): A number representing the index of the chat to get the response from. Defaults to `latest`.
|
|
895
|
+
|
|
896
|
+
`responseToGet` (optional): A number representing the index of the response to get. Defaults to `latest`.
|
|
897
|
+
|
|
898
|
+
Example code:
|
|
899
|
+
|
|
900
|
+
```js
|
|
901
|
+
(async () => {
|
|
902
|
+
const response = chatgpt.getResponseFromAPI();
|
|
903
|
+
console.log(response); // Example output: 'Hello from ChatGPT!'
|
|
904
|
+
})();
|
|
905
|
+
```
|
|
906
|
+
|
|
907
|
+
### getResponseFromDOM
|
|
908
|
+
|
|
909
|
+
Returns the Nth response ChatGPT has written as a string.
|
|
910
|
+
|
|
911
|
+
**Parameters**:
|
|
912
|
+
|
|
913
|
+
`pos`: A string or integer representing the position of the wanted response.
|
|
914
|
+
|
|
915
|
+
Example code:
|
|
916
|
+
|
|
917
|
+
```js
|
|
918
|
+
var fifthResp;
|
|
919
|
+
|
|
920
|
+
fifthResp = chatgpt.getResponseFromDOM(5); // Returns the 5th response
|
|
921
|
+
fifthResp = chatgpt.getResponseFromDOM('fifth'); // Also returns the 5th response
|
|
922
|
+
fifthResp = chatgpt.getResponseFromDOM('five'); // Returns the 5th response too
|
|
923
|
+
|
|
924
|
+
console.log(fifthResp); // Example output: 'Hello from ChatGPT!'
|
|
925
|
+
```
|
|
926
|
+
|
|
927
|
+
### isIdle `async`
|
|
928
|
+
|
|
929
|
+
Returns a boolean value. `true` if ChatGPT has finished generating a response, `false` otherwise.
|
|
930
|
+
|
|
931
|
+
Example code:
|
|
932
|
+
|
|
933
|
+
```js
|
|
934
|
+
(async () => {
|
|
935
|
+
if (await chatgpt.isIdle()) {
|
|
936
|
+
// Do something
|
|
937
|
+
}
|
|
938
|
+
})();
|
|
939
|
+
```
|
|
940
|
+
|
|
941
|
+
### regenerate
|
|
942
|
+
|
|
943
|
+
Regenerates ChatGPT's response.
|
|
944
|
+
|
|
945
|
+
Example code:
|
|
946
|
+
|
|
947
|
+
```js
|
|
948
|
+
chatgpt.regenerate();
|
|
949
|
+
```
|
|
950
|
+
|
|
951
|
+
### resend `async`
|
|
952
|
+
|
|
953
|
+
Re-sends the last user message.
|
|
954
|
+
|
|
955
|
+
```js
|
|
956
|
+
(async () => {
|
|
957
|
+
await chatgpt.resend();
|
|
958
|
+
})();
|
|
959
|
+
```
|
|
960
|
+
|
|
961
|
+
### scrollToBottom
|
|
962
|
+
|
|
963
|
+
Scrolls to the bottom of the chat.
|
|
964
|
+
|
|
965
|
+
Example code:
|
|
966
|
+
|
|
967
|
+
```js
|
|
968
|
+
chatgpt.scrollToBottom();
|
|
969
|
+
```
|
|
970
|
+
|
|
971
|
+
### send
|
|
972
|
+
|
|
973
|
+
Sends a message into the chat.
|
|
974
|
+
|
|
975
|
+
**Parameters**:
|
|
976
|
+
|
|
977
|
+
`msg`: A string representing the message to send.
|
|
978
|
+
|
|
979
|
+
`method` (optional): A string representing the method to send the message with, can only be `click`. Usually needed for mobile devices compatibility.
|
|
980
|
+
|
|
981
|
+
Example code:
|
|
982
|
+
|
|
983
|
+
```js
|
|
984
|
+
// Clicks the send button instead of triggering the 'Enter' key press.
|
|
985
|
+
chatgpt.send('Hello, world!', 'click');
|
|
986
|
+
```
|
|
987
|
+
|
|
988
|
+
### sendInNewChat
|
|
989
|
+
|
|
990
|
+
Creates a new chat and sends a message.
|
|
991
|
+
|
|
992
|
+
**Parameters**:
|
|
993
|
+
|
|
994
|
+
`msg`: A string representing the message to send.
|
|
995
|
+
|
|
996
|
+
Example code:
|
|
997
|
+
|
|
998
|
+
```js
|
|
999
|
+
chatgpt.sendInNewChat('Hello, world!');
|
|
1000
|
+
```
|
|
1001
|
+
|
|
1002
|
+
### shareChat `async`
|
|
1003
|
+
|
|
1004
|
+
Makes the selected chat available to others. Returns the URL of the chat as a string.
|
|
1005
|
+
|
|
1006
|
+
**Parameters**:
|
|
1007
|
+
|
|
1008
|
+
`chatToGet` (optional): A number or string representing the `index`, `title` or `id` of the chat to share.
|
|
1009
|
+
|
|
1010
|
+
`method` (optional): A string representing the method to share the chat with. Defaults to `clipboard`.
|
|
1011
|
+
|
|
1012
|
+
Can be the following: `copy` or `clipboard` to copy the chat URL to clipboard, `alert`, `notify` or `notification` to create an [alert message](#alert) with the details about the shared chat in the website.
|
|
1013
|
+
|
|
1014
|
+
```js
|
|
1015
|
+
(async () => {
|
|
1016
|
+
await chatgpt.shareChat(1, 'copy'); // copy/clipboard
|
|
1017
|
+
})();
|
|
1018
|
+
```
|
|
1019
|
+
|
|
1020
|
+
### speak
|
|
1021
|
+
|
|
1022
|
+
Text To Speech (TTS) conversion of a given message.
|
|
1023
|
+
|
|
1024
|
+
**Parameters**:
|
|
1025
|
+
|
|
1026
|
+
`msg`: A string representing the message to TTS.
|
|
1027
|
+
|
|
1028
|
+
`options` (optional): An object containing the options for the vocal synthesizer.
|
|
1029
|
+
|
|
1030
|
+
Available options:
|
|
1031
|
+
|
|
1032
|
+
- `voice`: A number representing the index of voices available on the user device.
|
|
1033
|
+
- `pitch`: A float representing the pitch of the speech. From `0` to `2`.
|
|
1034
|
+
- `speed`: A float representing the speed of the speech. From `0.1` to `10`.
|
|
1035
|
+
|
|
1036
|
+
Example code:
|
|
1037
|
+
|
|
1038
|
+
```js
|
|
1039
|
+
(async () => {
|
|
1040
|
+
chatgpt.speak(await chatgpt.getLastResponse(), { voice: 1, pitch: 2, speed: 3 });
|
|
1041
|
+
})();
|
|
1042
|
+
```
|
|
1043
|
+
|
|
1044
|
+
### startNewChat
|
|
1045
|
+
|
|
1046
|
+
Creates a new chat.
|
|
1047
|
+
|
|
1048
|
+
Example code:
|
|
1049
|
+
|
|
1050
|
+
```js
|
|
1051
|
+
chatgpt.startNewChat();
|
|
1052
|
+
```
|
|
1053
|
+
|
|
1054
|
+
### stop
|
|
1055
|
+
|
|
1056
|
+
Stops the generation of ChatGPT's response.
|
|
1057
|
+
|
|
1058
|
+
Example code:
|
|
1059
|
+
|
|
1060
|
+
```js
|
|
1061
|
+
chatgpt.stop();
|
|
1062
|
+
```
|
|
1063
|
+
|
|
1064
|
+
## DOM related
|
|
1065
|
+
|
|
1066
|
+
### getChatBox
|
|
1067
|
+
|
|
1068
|
+
Returns the chat input as an HTML element.
|
|
1069
|
+
|
|
1070
|
+
Example code:
|
|
1071
|
+
|
|
1072
|
+
```js
|
|
1073
|
+
const chatbox = chatgpt.getChatBox();
|
|
1074
|
+
console.log(chatbox.value); // Example output: 'Hello from chatgpt.js!'
|
|
1075
|
+
```
|
|
1076
|
+
|
|
1077
|
+
### getContinueGeneratingButton
|
|
1078
|
+
|
|
1079
|
+
Returns the 'Continue generating' button as an HTML element.
|
|
1080
|
+
|
|
1081
|
+
Example code:
|
|
1082
|
+
|
|
1083
|
+
```js
|
|
1084
|
+
const continueButton = chatgpt.getContinueGeneratingButton();
|
|
1085
|
+
continueButton.click();
|
|
1086
|
+
```
|
|
1087
|
+
|
|
1088
|
+
### getNewChatLink
|
|
1089
|
+
|
|
1090
|
+
Returns the button which creates a new chat as an HTML element.
|
|
1091
|
+
|
|
1092
|
+
Example code:
|
|
1093
|
+
|
|
1094
|
+
```js
|
|
1095
|
+
const newChatLink = chatgpt.getNewChatLink();
|
|
1096
|
+
newChatLink.click();
|
|
1097
|
+
```
|
|
1098
|
+
|
|
1099
|
+
### getRegenerateButton
|
|
1100
|
+
|
|
1101
|
+
Returns the button which regenerates ChatGPT's response as an HTML element.
|
|
1102
|
+
|
|
1103
|
+
Example code:
|
|
1104
|
+
|
|
1105
|
+
```js
|
|
1106
|
+
const regenButton = chatgpt.getRegenerateButton();
|
|
1107
|
+
regenButton.click();
|
|
1108
|
+
```
|
|
1109
|
+
|
|
1110
|
+
### getSendButton
|
|
1111
|
+
|
|
1112
|
+
Returns the button which sends the message as an HTML element.
|
|
1113
|
+
|
|
1114
|
+
Example code:
|
|
1115
|
+
|
|
1116
|
+
```js
|
|
1117
|
+
const sendButton = chatgpt.getSendButton();
|
|
1118
|
+
sendButton.click();
|
|
1119
|
+
```
|
|
1120
|
+
|
|
1121
|
+
### getStopGeneratingButton
|
|
1122
|
+
|
|
1123
|
+
Returns the button which stops the generation of ChatGPT's response as an HTML element.
|
|
1124
|
+
|
|
1125
|
+
Example code:
|
|
1126
|
+
|
|
1127
|
+
```js
|
|
1128
|
+
const stopButton = chatgpt.getStopGeneratingButton();
|
|
1129
|
+
stopButton.click();
|
|
1130
|
+
```
|
|
1131
|
+
|
|
1132
|
+
# Library APIs
|
|
1133
|
+
|
|
1134
|
+
## autoRefresh `api`
|
|
1135
|
+
|
|
1136
|
+
API related to keeping the user's session alive and fresh.
|
|
1137
|
+
|
|
1138
|
+
#### activate
|
|
1139
|
+
|
|
1140
|
+
Activates the auto-refresh functionality.
|
|
1141
|
+
|
|
1142
|
+
**Parameters**:
|
|
1143
|
+
|
|
1144
|
+
`interval` (optional): A number representing the interval in seconds between sessions refreshes. Defaults to `30`.
|
|
1145
|
+
|
|
1146
|
+
Example code:
|
|
1147
|
+
|
|
1148
|
+
```js
|
|
1149
|
+
chatgpt.autoRefresh.activate();
|
|
1150
|
+
```
|
|
1151
|
+
|
|
1152
|
+
#### deactivate
|
|
1153
|
+
|
|
1154
|
+
Deactivates the auto-refresh functionality.
|
|
1155
|
+
|
|
1156
|
+
Example code:
|
|
1157
|
+
|
|
1158
|
+
```js
|
|
1159
|
+
chatgpt.autoRefresh.deactivate();
|
|
1160
|
+
```
|
|
1161
|
+
|
|
1162
|
+
#### nowTimeStamp
|
|
1163
|
+
|
|
1164
|
+
Returns the current timestamp as a string (12-hour format).
|
|
1165
|
+
|
|
1166
|
+
Example code:
|
|
1167
|
+
|
|
1168
|
+
```js
|
|
1169
|
+
const timeStamp = chatgpt.autoRefresh.nowTimeStamp();
|
|
1170
|
+
console.log(timeStamp); // Example output: '1:56:25 PM'
|
|
1171
|
+
```
|
|
1172
|
+
|
|
1173
|
+
## browser `api`
|
|
1174
|
+
|
|
1175
|
+
### isLightMode
|
|
1176
|
+
|
|
1177
|
+
Returns a boolean value. `true` if system/browser scheme preference is set to light, `false` otherwise.
|
|
1178
|
+
|
|
1179
|
+
Example code:
|
|
1180
|
+
|
|
1181
|
+
```js
|
|
1182
|
+
console.log(chatgpt.browser.isLightMode()); // logs `true` or `false`
|
|
1183
|
+
```
|
|
1184
|
+
|
|
1185
|
+
### isDarkMode
|
|
1186
|
+
|
|
1187
|
+
Returns a boolean value. `true` if system/browser scheme preference is set to dark, `false` otherwise.
|
|
1188
|
+
|
|
1189
|
+
Example code:
|
|
1190
|
+
|
|
1191
|
+
```js
|
|
1192
|
+
console.log(chatgpt.browser.isDarkMode()); // logs `true` or `false`
|
|
1193
|
+
```
|
|
1194
|
+
|
|
1195
|
+
### isChromium
|
|
1196
|
+
|
|
1197
|
+
Returns a boolean value. `true` if the browser is Chromium and `false` otherwise.
|
|
1198
|
+
|
|
1199
|
+
Example code:
|
|
1200
|
+
|
|
1201
|
+
```js
|
|
1202
|
+
if (chatgpt.browser.isChromium()) {
|
|
1203
|
+
// Do something
|
|
1204
|
+
}
|
|
1205
|
+
```
|
|
1206
|
+
|
|
1207
|
+
### isFirefox
|
|
1208
|
+
|
|
1209
|
+
Returns a boolean value. `true` if the browser is Firefox and `false` otherwise.
|
|
1210
|
+
|
|
1211
|
+
Example code:
|
|
1212
|
+
|
|
1213
|
+
```js
|
|
1214
|
+
if (chatgpt.browser.isFirefox()) {
|
|
1215
|
+
// Do something
|
|
1216
|
+
}
|
|
1217
|
+
```
|
|
1218
|
+
|
|
1219
|
+
### isFullScreen
|
|
1220
|
+
|
|
1221
|
+
Returns a boolean value. `true` if the browser is fullscreen and `false` otherwise.
|
|
1222
|
+
|
|
1223
|
+
Example code:
|
|
1224
|
+
|
|
1225
|
+
```js
|
|
1226
|
+
if (chatgpt.browser.isFullScreen()) {
|
|
1227
|
+
// Do something
|
|
1228
|
+
}
|
|
1229
|
+
```
|
|
1230
|
+
|
|
1231
|
+
### isMobile
|
|
1232
|
+
|
|
1233
|
+
Returns a boolean value. `true` if the browser is mobile and `false` otherwise.
|
|
1234
|
+
|
|
1235
|
+
Example code:
|
|
1236
|
+
|
|
1237
|
+
```js
|
|
1238
|
+
if (chatgpt.browser.isMobile()) {
|
|
1239
|
+
// Do something
|
|
1240
|
+
}
|
|
1241
|
+
```
|
|
1242
|
+
|
|
1243
|
+
## code `api`
|
|
1244
|
+
|
|
1245
|
+
### minify `async`
|
|
1246
|
+
|
|
1247
|
+
Asks ChatGPT to minify the given code.
|
|
1248
|
+
|
|
1249
|
+
**Parameters**:
|
|
1250
|
+
|
|
1251
|
+
`code`: A string being the code to be minified.
|
|
1252
|
+
|
|
1253
|
+
Example code:
|
|
1254
|
+
|
|
1255
|
+
```js
|
|
1256
|
+
(async () => {
|
|
1257
|
+
const minifiedCode = await chatgpt.code.minify(`
|
|
1258
|
+
function autosizeBox() {
|
|
1259
|
+
const newLength = replyBox.value.length
|
|
1260
|
+
if (newLength < prevLength) { // if deleting txt
|
|
1261
|
+
replyBox.style.height = 'auto' // ...auto-fit height
|
|
1262
|
+
if (parseInt(getComputedStyle(replyBox).height) < 55) { // if down to one line
|
|
1263
|
+
replyBox.style.height = '2.15rem' } // ...reset to original height
|
|
1264
|
+
}
|
|
1265
|
+
replyBox.style.height = replyBox.scrollHeight + 'px'
|
|
1266
|
+
prevLength = newLength
|
|
1267
|
+
}`);
|
|
1268
|
+
console.log(minifiedCode);
|
|
1269
|
+
|
|
1270
|
+
/* Logs:
|
|
1271
|
+
'function autosizeBox(){const n=replyBox.value.length;if(n<prevLength){replyBox.style.height='auto';if(parseInt(getComputedStyle(replyBox).height)<55){replyBox.style.height='2.15rem'}}replyBox.style.height=replyBox.scrollHeight+'px';prevLength=n}' */
|
|
1272
|
+
})();
|
|
1273
|
+
```
|
|
1274
|
+
|
|
1275
|
+
### execute `async`
|
|
1276
|
+
|
|
1277
|
+
Asks ChatGPT to execute the given code.
|
|
1278
|
+
|
|
1279
|
+
**Parameters**:
|
|
1280
|
+
|
|
1281
|
+
`code`: A string being the code to execute.
|
|
1282
|
+
|
|
1283
|
+
Example code:
|
|
1284
|
+
|
|
1285
|
+
```js
|
|
1286
|
+
(async () => {
|
|
1287
|
+
console.log(await chatgpt.code.execute('return 6 + 5')); // logs '11'
|
|
1288
|
+
})();
|
|
1289
|
+
```
|
|
1290
|
+
|
|
1291
|
+
### extract
|
|
1292
|
+
|
|
1293
|
+
Extracts pure code from response.
|
|
1294
|
+
|
|
1295
|
+
**Parameters**:
|
|
1296
|
+
|
|
1297
|
+
`msg`: A string being the response to extract code from.
|
|
1298
|
+
|
|
1299
|
+
Example code:
|
|
1300
|
+
|
|
1301
|
+
```js
|
|
1302
|
+
(async () => {
|
|
1303
|
+
chatgpt.send('What is a short script to delete files?');
|
|
1304
|
+
await chatgpt.isIdle();
|
|
1305
|
+
const response = await chatgpt.getChatData('active', 'msg', 'chatgpt', 'latest'),
|
|
1306
|
+
scriptCode = chatgpt.code.extract(response);
|
|
1307
|
+
console.log(scriptCode);
|
|
1308
|
+
|
|
1309
|
+
/* Logs:
|
|
1310
|
+
const fs = require('fs');
|
|
1311
|
+
|
|
1312
|
+
// Specify the path of the file(s) you want to delete
|
|
1313
|
+
const filePath = 'path/to/your/file.txt';
|
|
1314
|
+
|
|
1315
|
+
// Delete the file
|
|
1316
|
+
fs.unlink(filePath, (err) => {
|
|
1317
|
+
if (err) {
|
|
1318
|
+
console.error('Error deleting file:', err);
|
|
1319
|
+
} else {
|
|
1320
|
+
console.log('File deleted successfully');
|
|
1321
|
+
}
|
|
1322
|
+
}); */
|
|
1323
|
+
})();
|
|
1324
|
+
```
|
|
1325
|
+
|
|
1326
|
+
### obfuscate `async`
|
|
1327
|
+
|
|
1328
|
+
Asks ChatGPT to obfuscate the given code.
|
|
1329
|
+
|
|
1330
|
+
**Parameters**:
|
|
1331
|
+
|
|
1332
|
+
`code`: A string being the code to obfuscate.
|
|
1333
|
+
|
|
1334
|
+
Example code:
|
|
1335
|
+
|
|
1336
|
+
```js
|
|
1337
|
+
(async () => {
|
|
1338
|
+
const code = `window[elem].addEventListener('mouseover', toggleTooltip)`
|
|
1339
|
+
const obfuscatedCode = await chatgpt.code.obfuscate(code);
|
|
1340
|
+
console.log(obfuscatedCode);
|
|
1341
|
+
|
|
1342
|
+
/* Logs:
|
|
1343
|
+
'(window[elem])[btoa('YWxlcnRWaWV3')](btoa('bW91c2VyYm94ZXJOYW1l'), btoa('dG9nZ2VkT3V0d2FsbA==')); */
|
|
1344
|
+
})();
|
|
1345
|
+
```
|
|
1346
|
+
|
|
1347
|
+
### refactor `async`
|
|
1348
|
+
|
|
1349
|
+
Asks ChatGPT to refactor the given code.
|
|
1350
|
+
|
|
1351
|
+
**Parameters**:
|
|
1352
|
+
|
|
1353
|
+
`code`: A string being the code to refactor.
|
|
1354
|
+
|
|
1355
|
+
`objective` (optional): A string reprenting the objective of the refactoring. Defaults to `brevity`.
|
|
1356
|
+
|
|
1357
|
+
Example code:
|
|
1358
|
+
|
|
1359
|
+
```js
|
|
1360
|
+
(async () => {
|
|
1361
|
+
const code = `
|
|
1362
|
+
if (6 > 5) {
|
|
1363
|
+
return true;
|
|
1364
|
+
} else {
|
|
1365
|
+
return false;
|
|
1366
|
+
}`;
|
|
1367
|
+
const refactoredCode = await chatgpt.code.refactor(code, 'brevity');
|
|
1368
|
+
console.log(refactoredCode);
|
|
1369
|
+
|
|
1370
|
+
/* Logs:
|
|
1371
|
+
return 6 > 5; */
|
|
1372
|
+
})();
|
|
1373
|
+
```
|
|
1374
|
+
|
|
1375
|
+
### review `async`
|
|
1376
|
+
|
|
1377
|
+
Asks ChatGPT to review given code.
|
|
1378
|
+
|
|
1379
|
+
**Parameters**:
|
|
1380
|
+
|
|
1381
|
+
`code`: A string being the code to review.
|
|
1382
|
+
|
|
1383
|
+
Example code:
|
|
1384
|
+
|
|
1385
|
+
```js
|
|
1386
|
+
(async () => {
|
|
1387
|
+
console.log(await chatgpt.code.review('btoa("Hello World")'));
|
|
1388
|
+
|
|
1389
|
+
/* Example output:
|
|
1390
|
+
The code appears to be correct. It uses the `btoa` function to encode the string "Hello World" in base64. */
|
|
1391
|
+
})();
|
|
1392
|
+
```
|
|
1393
|
+
|
|
1394
|
+
### unminify `async`
|
|
1395
|
+
|
|
1396
|
+
Asks ChatGPT to unminify the given code.
|
|
1397
|
+
|
|
1398
|
+
**Parameters**:
|
|
1399
|
+
|
|
1400
|
+
`code`: A string being the code to unminify.
|
|
1401
|
+
|
|
1402
|
+
Example code:
|
|
1403
|
+
|
|
1404
|
+
```js
|
|
1405
|
+
(async () => {
|
|
1406
|
+
const code = `function autosizeBox(){const n=replyBox.value.length;if(n<prevLength){replyBox.style.height='auto';if(parseInt(getComputedStyle(replyBox).height)<55){replyBox.style.height='2.15rem'}}replyBox.style.height=replyBox.scrollHeight+'px';prevLength=n}`;
|
|
1407
|
+
|
|
1408
|
+
const minifiedCode = await chatgpt.code.unminify(code);
|
|
1409
|
+
console.log(minifiedCode);
|
|
1410
|
+
|
|
1411
|
+
/* Logs:
|
|
1412
|
+
function autosizeBox() {
|
|
1413
|
+
const newLength = replyBox.value.length
|
|
1414
|
+
if (newLength < prevLength) { // if deleting txt
|
|
1415
|
+
replyBox.style.height = 'auto' // ...auto-fit height
|
|
1416
|
+
if (parseInt(getComputedStyle(replyBox).height) < 55) { // if down to one line
|
|
1417
|
+
replyBox.style.height = '2.15rem' } // ...reset to original height
|
|
1418
|
+
}
|
|
1419
|
+
replyBox.style.height = replyBox.scrollHeight + 'px'
|
|
1420
|
+
prevLength = newLength
|
|
1421
|
+
}` */
|
|
1422
|
+
})();
|
|
1423
|
+
```
|
|
1424
|
+
|
|
1425
|
+
### write `async`
|
|
1426
|
+
|
|
1427
|
+
Asks ChatGPT to write code given a prompt.
|
|
1428
|
+
|
|
1429
|
+
**Parameters**:
|
|
1430
|
+
|
|
1431
|
+
`prompt`: A string describing the code to generate.
|
|
1432
|
+
|
|
1433
|
+
`outputLang`: A string representing the code language to generate the prompt with.
|
|
1434
|
+
|
|
1435
|
+
Example code:
|
|
1436
|
+
|
|
1437
|
+
```js
|
|
1438
|
+
(async () => {
|
|
1439
|
+
const code = await chatgpt.code.write('Repeat a task every 10 seconds', 'javascript');
|
|
1440
|
+
console.log(code);
|
|
1441
|
+
|
|
1442
|
+
/* Logs:
|
|
1443
|
+
setInterval(function() {
|
|
1444
|
+
// Your task code here
|
|
1445
|
+
}, 10000); */
|
|
1446
|
+
})();
|
|
1447
|
+
```
|
|
1448
|
+
|
|
1449
|
+
## history `api`
|
|
1450
|
+
|
|
1451
|
+
API related to the chat history.
|
|
1452
|
+
|
|
1453
|
+
### isOn
|
|
1454
|
+
|
|
1455
|
+
Returns a boolean value. `true` if the chat history is enabled, `false` otherwise.
|
|
1456
|
+
|
|
1457
|
+
Example code:
|
|
1458
|
+
|
|
1459
|
+
```js
|
|
1460
|
+
if (chatgpt.history.isOn()) {
|
|
1461
|
+
// Do something
|
|
1462
|
+
}
|
|
1463
|
+
```
|
|
1464
|
+
|
|
1465
|
+
### isOff
|
|
1466
|
+
|
|
1467
|
+
Returns a boolean value. `true` if the chat history is disabled, `false` otherwise.
|
|
1468
|
+
|
|
1469
|
+
Example code:
|
|
1470
|
+
|
|
1471
|
+
```js
|
|
1472
|
+
if (chatgpt.history.isOff()) {
|
|
1473
|
+
// Do something
|
|
1474
|
+
}
|
|
1475
|
+
```
|
|
1476
|
+
|
|
1477
|
+
### activate
|
|
1478
|
+
|
|
1479
|
+
Activates the chat history.
|
|
1480
|
+
|
|
1481
|
+
Example code:
|
|
1482
|
+
|
|
1483
|
+
```js
|
|
1484
|
+
chatgpt.history.activate();
|
|
1485
|
+
```
|
|
1486
|
+
|
|
1487
|
+
### deactivate
|
|
1488
|
+
|
|
1489
|
+
Deactivates the chat history.
|
|
1490
|
+
|
|
1491
|
+
Example code:
|
|
1492
|
+
|
|
1493
|
+
```js
|
|
1494
|
+
chatgpt.history.deactivate();
|
|
1495
|
+
```
|
|
1496
|
+
|
|
1497
|
+
### isLoaded `async`
|
|
1498
|
+
|
|
1499
|
+
Resolves a promise when chat history has finished loading.
|
|
1500
|
+
|
|
1501
|
+
Example code:
|
|
1502
|
+
|
|
1503
|
+
```js
|
|
1504
|
+
(async () => {
|
|
1505
|
+
await chatgpt.history.isLoaded();
|
|
1506
|
+
console.log('ChatGPT history has finished loading.');
|
|
1507
|
+
})();
|
|
1508
|
+
```
|
|
1509
|
+
|
|
1510
|
+
### toggle
|
|
1511
|
+
|
|
1512
|
+
Toggles the chat history.
|
|
1513
|
+
|
|
1514
|
+
Example code:
|
|
1515
|
+
|
|
1516
|
+
```js
|
|
1517
|
+
chatgpt.history.toggle();
|
|
1518
|
+
```
|
|
1519
|
+
|
|
1520
|
+
## instructions `api`
|
|
1521
|
+
|
|
1522
|
+
### add `async`
|
|
1523
|
+
|
|
1524
|
+
Adds a custom instruction for either the user or ChatGPT.
|
|
1525
|
+
|
|
1526
|
+
**Parameters**:
|
|
1527
|
+
|
|
1528
|
+
`instruction`: A string being the instruction to be added.
|
|
1529
|
+
|
|
1530
|
+
`target`: A string representing the target of the instruction. Can be either `user` or `chatgpt`.
|
|
1531
|
+
|
|
1532
|
+
Example code:
|
|
1533
|
+
|
|
1534
|
+
```js
|
|
1535
|
+
(async () => {
|
|
1536
|
+
await chatgpt.instructions.add('Detailed and well-explained answers', 'chatgpt');
|
|
1537
|
+
})();
|
|
1538
|
+
```
|
|
1539
|
+
|
|
1540
|
+
### clear `async`
|
|
1541
|
+
|
|
1542
|
+
Clears the custom instructions of either the user or ChatGPT.
|
|
1543
|
+
|
|
1544
|
+
**Parameters**:
|
|
1545
|
+
|
|
1546
|
+
`target`: A string representing the target of the instruction. Can be either `user` or `chatgpt`.
|
|
1547
|
+
|
|
1548
|
+
Example code:
|
|
1549
|
+
|
|
1550
|
+
```js
|
|
1551
|
+
(async () => {
|
|
1552
|
+
await chatgpt.instructions.clear('user');
|
|
1553
|
+
})();
|
|
1554
|
+
```
|
|
1555
|
+
|
|
1556
|
+
### turnOff `async`
|
|
1557
|
+
|
|
1558
|
+
Turns off custom instructions.
|
|
1559
|
+
|
|
1560
|
+
Example code:
|
|
1561
|
+
|
|
1562
|
+
```js
|
|
1563
|
+
(async () => {
|
|
1564
|
+
await chatgpt.instructions.turnOff();
|
|
1565
|
+
})();
|
|
1566
|
+
```
|
|
1567
|
+
|
|
1568
|
+
### turnOn `async`
|
|
1569
|
+
|
|
1570
|
+
Turns on custom instructions.
|
|
1571
|
+
|
|
1572
|
+
Example code:
|
|
1573
|
+
|
|
1574
|
+
```js
|
|
1575
|
+
(async () => {
|
|
1576
|
+
await chatgpt.instructions.turnOn();
|
|
1577
|
+
})();
|
|
1578
|
+
```
|
|
1579
|
+
|
|
1580
|
+
### toggle `async`
|
|
1581
|
+
|
|
1582
|
+
Toggles on/off custom instructions.
|
|
1583
|
+
|
|
1584
|
+
Example code:
|
|
1585
|
+
|
|
1586
|
+
```js
|
|
1587
|
+
(async () => {
|
|
1588
|
+
await chatgpt.instructions.toggle();
|
|
1589
|
+
})();
|
|
1590
|
+
```
|
|
1591
|
+
|
|
1592
|
+
## menu `api`
|
|
1593
|
+
|
|
1594
|
+
The small menu that shows up when clicking on the account button.
|
|
1595
|
+
|
|
1596
|
+
### open
|
|
1597
|
+
|
|
1598
|
+
Opens the menu.
|
|
1599
|
+
|
|
1600
|
+
Example code:
|
|
1601
|
+
|
|
1602
|
+
```js
|
|
1603
|
+
chatgpt.menu.open();
|
|
1604
|
+
```
|
|
1605
|
+
|
|
1606
|
+
### close
|
|
1607
|
+
|
|
1608
|
+
Closes the menu.
|
|
1609
|
+
|
|
1610
|
+
Example code:
|
|
1611
|
+
|
|
1612
|
+
```js
|
|
1613
|
+
chatgpt.menu.close();
|
|
1614
|
+
```
|
|
1615
|
+
|
|
1616
|
+
## response `api`
|
|
1617
|
+
|
|
1618
|
+
API related to ChatGPT's responses.
|
|
1619
|
+
|
|
1620
|
+
### get
|
|
1621
|
+
|
|
1622
|
+
If it's a previously created chat, read [chatgpt.getResponseFromDOM](#getresponsefromdom)
|
|
1623
|
+
|
|
1624
|
+
If it's a new chat, read [chatgpt.getResponseFromAPI](#getresponsefromapi-async)
|
|
1625
|
+
|
|
1626
|
+
### getFromAPI `async`
|
|
1627
|
+
|
|
1628
|
+
Read [chatgpt.getResponseFromAPI](#getresponsefromapi-async)
|
|
1629
|
+
|
|
1630
|
+
### getFromDOM
|
|
1631
|
+
|
|
1632
|
+
Read [chatgpt.getResponseFromDOM](#getresponsefromdom)
|
|
1633
|
+
|
|
1634
|
+
### getLast `async`
|
|
1635
|
+
|
|
1636
|
+
Read [chatgpt.getLastResponse](#getlastresponse-async)
|
|
1637
|
+
|
|
1638
|
+
### regenerate
|
|
1639
|
+
|
|
1640
|
+
Read [chatgpt.regenerate](#regenerate)
|
|
1641
|
+
|
|
1642
|
+
### stopGenerating
|
|
1643
|
+
|
|
1644
|
+
Read [chatgpt.stop](#stop)
|
|
1645
|
+
|
|
1646
|
+
## settings `api`
|
|
1647
|
+
|
|
1648
|
+
API for interfacing with ChatGPT user settings.
|
|
1649
|
+
|
|
1650
|
+
### scheme `api subset`
|
|
1651
|
+
|
|
1652
|
+
#### isDark
|
|
1653
|
+
|
|
1654
|
+
Returns a boolean value. `true` if the theme is dark mode, `false` otherwise.
|
|
1655
|
+
|
|
1656
|
+
Example code:
|
|
1657
|
+
|
|
1658
|
+
```js
|
|
1659
|
+
console.log(chatgpt.settings.scheme.isDark()); // logs `true` or `false`
|
|
1660
|
+
````
|
|
1661
|
+
|
|
1662
|
+
#### isLight
|
|
1663
|
+
|
|
1664
|
+
Returns a boolean value. `true` if the theme is light mode, `false` otherwise.
|
|
1665
|
+
|
|
1666
|
+
Example code:
|
|
1667
|
+
|
|
1668
|
+
```js
|
|
1669
|
+
console.log(chatgpt.settings.scheme.isLight()); // logs `true` or `false`
|
|
1670
|
+
````
|
|
1671
|
+
|
|
1672
|
+
#### set
|
|
1673
|
+
|
|
1674
|
+
Sets the theme to `light`, `dark` or `system`.
|
|
1675
|
+
|
|
1676
|
+
**Paremeters**:
|
|
1677
|
+
|
|
1678
|
+
`value`: A string being the value to set the theme to.
|
|
1679
|
+
|
|
1680
|
+
Example code:
|
|
1681
|
+
|
|
1682
|
+
```js
|
|
1683
|
+
chatgpt.settings.scheme.set('dark');
|
|
1684
|
+
```
|
|
1685
|
+
|
|
1686
|
+
#### toggle
|
|
1687
|
+
|
|
1688
|
+
Toggles the theme between light and dark mode.
|
|
1689
|
+
|
|
1690
|
+
Example code:
|
|
1691
|
+
|
|
1692
|
+
```js
|
|
1693
|
+
chatgpt.settings.scheme.toggle();
|
|
1694
|
+
```
|
|
1695
|
+
|
|
1696
|
+
## sidebar `api`
|
|
1697
|
+
|
|
1698
|
+
API related to the sidebar's behavior.
|
|
1699
|
+
|
|
1700
|
+
### append
|
|
1701
|
+
|
|
1702
|
+
Appends a new element to the sidebar. Returns the `id` property of the element.
|
|
1703
|
+
|
|
1704
|
+
**Parameters**:
|
|
1705
|
+
|
|
1706
|
+
`element`: A string being the name of the element to append.
|
|
1707
|
+
|
|
1708
|
+
Currently supported elements are [`button`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button) and [`dropdown`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/select).
|
|
1709
|
+
|
|
1710
|
+
`attrs`: An object which contains the attributes of the element to append.
|
|
1711
|
+
|
|
1712
|
+
_**Attributes for `button`**_
|
|
1713
|
+
|
|
1714
|
+
`label`: A string being the label (displayed text) of the button. Defaults to `chatgpt.js button`.
|
|
1715
|
+
|
|
1716
|
+
`icon`: A string being either a url to an image or a base64 encoded string of the image data. Defaults to [this icon](https://raw.githubusercontent.com/KudoAI/chatgpt.js/main/starters/chrome/extension/icons/icon128.png).
|
|
1717
|
+
|
|
1718
|
+
`onclick`: A function which is called when the button is clicked. Defaults to `function() {}`.
|
|
1719
|
+
|
|
1720
|
+
_**Attributes for `dropdown`**_
|
|
1721
|
+
|
|
1722
|
+
`items`: An array of objects where the `text` key is the displayed text of the option, and the `value` key is the value of the option.
|
|
1723
|
+
|
|
1724
|
+
Example item object:
|
|
1725
|
+
|
|
1726
|
+
```js
|
|
1727
|
+
{
|
|
1728
|
+
text: 'The text to display in the option',
|
|
1729
|
+
value: 'The value of the option'
|
|
1730
|
+
}
|
|
1731
|
+
```
|
|
1732
|
+
|
|
1733
|
+
Example code:
|
|
1734
|
+
|
|
1735
|
+
```js
|
|
1736
|
+
const buttonId = chatgpt.sidebar.append('button', {
|
|
1737
|
+
label: 'I am a button!',
|
|
1738
|
+
icon: 'https://chat.openai.com/favicon-32x32.png',
|
|
1739
|
+
onclick: function() {
|
|
1740
|
+
console.log('Clicked!');
|
|
1741
|
+
}
|
|
1742
|
+
});
|
|
1743
|
+
console.log(buttonId); // Example output: 1693295258727
|
|
1744
|
+
|
|
1745
|
+
const dropdownId = chatgpt.sidebar.append('dropdown', {
|
|
1746
|
+
items: [
|
|
1747
|
+
{ text: 'Hello world', value: 'helloworld' },
|
|
1748
|
+
{ text: 'Hello there', value: 'hellothere' }
|
|
1749
|
+
]
|
|
1750
|
+
});
|
|
1751
|
+
console.log(dropdownId); // Example output: 1693294795240
|
|
1752
|
+
```
|
|
1753
|
+
|
|
1754
|
+
### isOn
|
|
1755
|
+
|
|
1756
|
+
Returns a boolean value. `true` if the sidebar is open, `false` otherwise.
|
|
1757
|
+
|
|
1758
|
+
Example code:
|
|
1759
|
+
|
|
1760
|
+
```js
|
|
1761
|
+
if (chatgpt.sidebar.isOn()) {
|
|
1762
|
+
// Do something
|
|
1763
|
+
}
|
|
1764
|
+
```
|
|
1765
|
+
|
|
1766
|
+
### isOff
|
|
1767
|
+
|
|
1768
|
+
Returns a boolean value. `true` if the sidebar is closed, `false` otherwise.
|
|
1769
|
+
|
|
1770
|
+
Example code:
|
|
1771
|
+
|
|
1772
|
+
```js
|
|
1773
|
+
if (chatgpt.sidebar.isOff()) {
|
|
1774
|
+
// Do something
|
|
1775
|
+
}
|
|
1776
|
+
```
|
|
1777
|
+
|
|
1778
|
+
### hide
|
|
1779
|
+
|
|
1780
|
+
Hides the sidebar.
|
|
1781
|
+
|
|
1782
|
+
Example code:
|
|
1783
|
+
|
|
1784
|
+
```js
|
|
1785
|
+
chatgpt.sidebar.hide();
|
|
1786
|
+
```
|
|
1787
|
+
|
|
1788
|
+
### show
|
|
1789
|
+
|
|
1790
|
+
Shows the sidebar.
|
|
1791
|
+
|
|
1792
|
+
Example code:
|
|
1793
|
+
|
|
1794
|
+
```js
|
|
1795
|
+
chatgpt.sidebar.show();
|
|
1796
|
+
```
|
|
1797
|
+
|
|
1798
|
+
### toggle
|
|
1799
|
+
|
|
1800
|
+
Toggles the visibility of the sidebar.
|
|
1801
|
+
|
|
1802
|
+
Example code:
|
|
1803
|
+
|
|
1804
|
+
```js
|
|
1805
|
+
chatgpt.sidebar.toggle();
|
|
1806
|
+
```
|
|
1807
|
+
|
|
1808
|
+
<br>
|
|
1809
|
+
<br>
|
|
1810
|
+
|
|
1811
|
+
[Discuss](https://github.com/kudoai/chatgpt.js/discussions) /
|
|
1812
|
+
<a href="#">Back to top ↑</a>
|