-
Notifications
You must be signed in to change notification settings - Fork 170
Expand file tree
/
Copy pathchatgpt.d.ts
More file actions
324 lines (275 loc) · 7.18 KB
/
Copy pathchatgpt.d.ts
File metadata and controls
324 lines (275 loc) · 7.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
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
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
/**
* TypeScript definitions for chatgpt.js v4.15.1
* Based on: https://github.com/KudoAI/chatgpt.js
*/
declare interface ChatGPT {
colors: {
orange: string
green: string
reset: string
}
endpoints: {
aipersonas: string
assets: string
google: {
chat: string
}
openai: {
session: string
chats: string
chat: string
share_create: string
share: string
instructions: string
}
openrouter: {
chat: string
}
}
selectors: {
btns: Record<string, string>
chatDivs: Record<string, string>
chatHistory: string
errors: Record<string, string>
footer: string
header: string
links: Record<string, string>
sidebar: string
ssgManifest: string
}
actAs(
persona: string,
options?: {
personasURL?: string
verbose?: boolean
}
): Promise<string> | void
activateDarkMode(): void
activateLightMode(): void
// Core methods
alert(
title?: string,
msg?: string,
btns?: Array<(...args: any[]) => void> | ((...args: any[]) => void),
checkbox?: (...args: any[]) => void,
width?: number
): string
askAndGetReply(query: string): Promise<string>
autoRefresh: {
activate(interval?: number): void
deactivate(): void
nowTimeStamp(): string
toggle: {
beacons(): void
refreshFrame(): void
}
isActive?: number | null
beaconID?: number | null
}
browser: {
isLightMode(): boolean
isDarkMode(): boolean
isChromium(): boolean
isChrome(): boolean
isEdge(): boolean
isBrave(): boolean
isFirefox(): boolean
isFullScreen(): boolean
isMobile(): boolean
}
clearChats(): Promise<void>
code: {
debug(code: string): Promise<string>
execute(code: string): Promise<string>
extract(msg?: string): string
isIdle(timeout?: number | null): Promise<boolean>
minify(code: string): Promise<string>
obfuscate(code: string): Promise<string>
refactor(code: string, objective?: string): Promise<string>
review(code: string): Promise<string>
unminify(code: string): Promise<string>
write(prompt: string, outputLang: string): Promise<string>
}
continue(): void
detectLanguage(text: string): Promise<string>
dictate(): void
getRelated(query: string, options?: { qty?: number; verbose?: boolean }): Promise<string[]>
execute(code: string): Promise<string>
exportChat(
chatToGet?: string | number,
format?: 'html' | 'md' | 'pdf' | 'text'
): Promise<void>
extractCode(msg?: string): string
focusChatbar(): void
footer: {
get(): HTMLElement | null
hide(): void
show(): void
}
getAccessToken(): Promise<string>
getAccountDetails(
...details: Array<'email' | 'id' | 'image' | 'name' | 'picture'>
): Promise<Record<string, any>>
getChatBox(): HTMLTextAreaElement | null
getChatData(
chatToGet?: string | number,
detailsToGet?: string | string[],
sender?: 'all' | 'both' | 'user' | 'chatgpt',
msgToGet?: string | number
): Promise<any>
getChatInput(): string
getContinueButton(): HTMLButtonElement | null
getDictateButton(): HTMLButtonElement | null
getErrorMsg(): string | undefined
getFooterDiv(): HTMLElement | null
getHeaderDiv(): HTMLElement | null
getLastPrompt(): Promise<string>
getLastResponse(): Promise<string>
getLoginButton(): HTMLButtonElement | null
getNewChatButton(): HTMLButtonElement | null
getNewChatLink(): HTMLAnchorElement | null
getRegenerateButton(): HTMLButtonElement | null
getResponse(...args: any[]): any
getResponseFromAPI(
chatToGet?: string | number,
responseToGet?: string | number
): Promise<string>
getResponseFromDOM(pos?: string | number): string
getScrollToBottomButton(): HTMLButtonElement | null
getSendButton(): HTMLButtonElement | null
getStopButton(): HTMLButtonElement | null
getUserLanguage(): string
getVoiceButton(): HTMLButtonElement | null
header: {
get(): HTMLElement | null
hide(): void
show(): void
}
// UI controls
hideFooter(): void
hideHeader(): void
history: {
deleteChat(chatToDelete?: string | number): Promise<boolean>
isLoaded(timeout?: number | null): Promise<boolean>
}
instructions: {
add(instruction: string, target: 'user' | 'chatgpt'): Promise<void>
clear(target: 'user' | 'chatgpt'): Promise<void>
fetchData(): Promise<any>
sendRequest(
method: 'GET' | 'POST',
token: string,
body?: object
): Promise<any>
turnOff(): Promise<void>
turnOn(): Promise<void>
toggle(): Promise<void>
}
isDarkMode(): boolean
isFullScreen(): boolean
isIdle(timeout?: number | null): Promise<boolean>
isLoaded(timeout?: number | null): Promise<boolean>
isLightMode(): boolean
isTempChat(): boolean
isTyping(): boolean
login(): void
logout(): void
menu: {
elems: HTMLElement[]
close(): void
open(): void
}
minify(code?: string): Promise<string>
notify(
msg: string,
position?: string,
notifDuration?: number,
shadow?: boolean | string
): HTMLElement
obfuscate(code?: string): Promise<string>
printAllFunctions(): void
randomFloat(): number
refactor(code?: string, objective?: string): Promise<string>
regenerate(): void
renderHTML(node: HTMLElement): HTMLElement
resend(): Promise<void>
response: {
continue(): void
get(...args: any[]): any
getFromAPI(
chatToGet?: string | number,
responseToGet?: string | number
): Promise<string>
getFromDOM(pos?: string | number): string
getLast(): Promise<string>
regenerate(): void
stopGenerating(): void
}
reviewCode(code?: string): Promise<string>
scrollToBottom(): void
send(msg: string, method?: string): void
sendInNewChat(msg: string): void
setProvider(
provider?: string,
options?: {
key?: string
}
): void
settings: {
scheme: {
isDark(): boolean
isLight(): boolean
set(value: 'dark' | 'light' | 'system'): void
toggle(): void
}
}
sentiment(text: string, entity?: string): Promise<string>
setScheme(value: 'dark' | 'light' | 'system'): void
shareChat(
chatToGet?: string | number,
method?: 'alert' | 'notify' | 'notification' | 'clipboard' | 'copy'
): Promise<string>
showFooter(): void
showHeader(): void
sidebar: {
exists(): boolean
hide(): void
show(): void
isOff(): boolean
isOn(): boolean
isLoaded(timeout?: number): Promise<boolean>
toggle(): void
}
startNewChat(): void
stop(): void
suggest(ideaType: string, details?: string): Promise<string>
speak(
msg: string,
options?: {
voice?: number
pitch?: number
speed?: number
onend?: () => void
}
): void
summarize(text: string): Promise<string>
toggleScheme(): void
translate(text: string, outputLang: string): Promise<string>
unminify(code?: string): Promise<string>
uuidv4(): string
writeCode(prompt?: string, outputLang?: string): Promise<string>
}
declare const chatgpt: ChatGPT
declare global {
interface Window {
chatgpt: ChatGPT
}
}
declare module '@kudoai/chatgpt.js' {
export = chatgpt
}
declare module 'chatgpt.js' {
export = chatgpt
}
export = chatgpt
export as namespace chatgpt