chore: update ts docs

pull/164/head
Travis Fischer 2022-12-18 00:18:10 -06:00
rodzic d87ae67129
commit 71c4e5a501
6 zmienionych plików z 127 dodań i 97 usunięć

Wyświetl plik

@ -49,7 +49,7 @@ An error if it fails.
#### Defined in
[src/abstract-chatgpt-api.ts:69](https://github.com/transitive-bullshit/chatgpt-api/blob/88efa64/src/abstract-chatgpt-api.ts#L69)
[src/abstract-chatgpt-api.ts:69](https://github.com/transitive-bullshit/chatgpt-api/blob/d87ae67/src/abstract-chatgpt-api.ts#L69)
___
@ -66,7 +66,7 @@ otherwise.
#### Defined in
[src/abstract-chatgpt-api.ts:39](https://github.com/transitive-bullshit/chatgpt-api/blob/88efa64/src/abstract-chatgpt-api.ts#L39)
[src/abstract-chatgpt-api.ts:39](https://github.com/transitive-bullshit/chatgpt-api/blob/d87ae67/src/abstract-chatgpt-api.ts#L39)
___
@ -87,7 +87,7 @@ An error if the session failed to initialize properly.
#### Defined in
[src/abstract-chatgpt-api.ts:10](https://github.com/transitive-bullshit/chatgpt-api/blob/88efa64/src/abstract-chatgpt-api.ts#L10)
[src/abstract-chatgpt-api.ts:10](https://github.com/transitive-bullshit/chatgpt-api/blob/d87ae67/src/abstract-chatgpt-api.ts#L10)
___
@ -111,7 +111,7 @@ Access credentials for the new session.
#### Defined in
[src/abstract-chatgpt-api.ts:49](https://github.com/transitive-bullshit/chatgpt-api/blob/88efa64/src/abstract-chatgpt-api.ts#L49)
[src/abstract-chatgpt-api.ts:49](https://github.com/transitive-bullshit/chatgpt-api/blob/d87ae67/src/abstract-chatgpt-api.ts#L49)
___
@ -135,7 +135,7 @@ Access credentials for the new session.
#### Defined in
[src/abstract-chatgpt-api.ts:59](https://github.com/transitive-bullshit/chatgpt-api/blob/88efa64/src/abstract-chatgpt-api.ts#L59)
[src/abstract-chatgpt-api.ts:59](https://github.com/transitive-bullshit/chatgpt-api/blob/d87ae67/src/abstract-chatgpt-api.ts#L59)
___
@ -164,4 +164,4 @@ the `response` text.
#### Defined in
[src/abstract-chatgpt-api.ts:30](https://github.com/transitive-bullshit/chatgpt-api/blob/88efa64/src/abstract-chatgpt-api.ts#L30)
[src/abstract-chatgpt-api.ts:30](https://github.com/transitive-bullshit/chatgpt-api/blob/d87ae67/src/abstract-chatgpt-api.ts#L30)

Wyświetl plik

@ -64,7 +64,7 @@ to obtain your `clearanceToken`.
#### Defined in
[src/chatgpt-api.ts:45](https://github.com/transitive-bullshit/chatgpt-api/blob/88efa64/src/chatgpt-api.ts#L45)
[src/chatgpt-api.ts:45](https://github.com/transitive-bullshit/chatgpt-api/blob/d87ae67/src/chatgpt-api.ts#L45)
## Accessors
@ -80,7 +80,7 @@ Gets the current Cloudflare clearance token (`cf_clearance` cookie value).
#### Defined in
[src/chatgpt-api.ts:143](https://github.com/transitive-bullshit/chatgpt-api/blob/88efa64/src/chatgpt-api.ts#L143)
[src/chatgpt-api.ts:143](https://github.com/transitive-bullshit/chatgpt-api/blob/d87ae67/src/chatgpt-api.ts#L143)
___
@ -96,7 +96,7 @@ Gets the current session token.
#### Defined in
[src/chatgpt-api.ts:138](https://github.com/transitive-bullshit/chatgpt-api/blob/88efa64/src/chatgpt-api.ts#L138)
[src/chatgpt-api.ts:138](https://github.com/transitive-bullshit/chatgpt-api/blob/d87ae67/src/chatgpt-api.ts#L138)
___
@ -112,7 +112,7 @@ Gets the currently signed-in user, if authenticated, `null` otherwise.
#### Defined in
[src/chatgpt-api.ts:133](https://github.com/transitive-bullshit/chatgpt-api/blob/88efa64/src/chatgpt-api.ts#L133)
[src/chatgpt-api.ts:133](https://github.com/transitive-bullshit/chatgpt-api/blob/d87ae67/src/chatgpt-api.ts#L133)
___
@ -128,7 +128,7 @@ Gets the current user agent.
#### Defined in
[src/chatgpt-api.ts:148](https://github.com/transitive-bullshit/chatgpt-api/blob/88efa64/src/chatgpt-api.ts#L148)
[src/chatgpt-api.ts:148](https://github.com/transitive-bullshit/chatgpt-api/blob/d87ae67/src/chatgpt-api.ts#L148)
## Methods
@ -152,7 +152,7 @@ An error if it fails.
#### Defined in
[src/chatgpt-api.ts:470](https://github.com/transitive-bullshit/chatgpt-api/blob/88efa64/src/chatgpt-api.ts#L470)
[src/chatgpt-api.ts:470](https://github.com/transitive-bullshit/chatgpt-api/blob/d87ae67/src/chatgpt-api.ts#L470)
___
@ -173,7 +173,7 @@ the token fails.
#### Defined in
[src/chatgpt-api.ts:367](https://github.com/transitive-bullshit/chatgpt-api/blob/88efa64/src/chatgpt-api.ts#L367)
[src/chatgpt-api.ts:367](https://github.com/transitive-bullshit/chatgpt-api/blob/d87ae67/src/chatgpt-api.ts#L367)
___
@ -194,7 +194,7 @@ is valid.
#### Defined in
[src/chatgpt-api.ts:156](https://github.com/transitive-bullshit/chatgpt-api/blob/88efa64/src/chatgpt-api.ts#L156)
[src/chatgpt-api.ts:156](https://github.com/transitive-bullshit/chatgpt-api/blob/d87ae67/src/chatgpt-api.ts#L156)
___
@ -224,7 +224,7 @@ A valid access token
#### Defined in
[src/chatgpt-api.ts:386](https://github.com/transitive-bullshit/chatgpt-api/blob/88efa64/src/chatgpt-api.ts#L386)
[src/chatgpt-api.ts:386](https://github.com/transitive-bullshit/chatgpt-api/blob/d87ae67/src/chatgpt-api.ts#L386)
___
@ -252,7 +252,7 @@ Access credentials for the new session.
#### Defined in
[src/abstract-chatgpt-api.ts:59](https://github.com/transitive-bullshit/chatgpt-api/blob/88efa64/src/abstract-chatgpt-api.ts#L59)
[src/abstract-chatgpt-api.ts:59](https://github.com/transitive-bullshit/chatgpt-api/blob/d87ae67/src/abstract-chatgpt-api.ts#L59)
___
@ -287,7 +287,7 @@ The response from ChatGPT
#### Defined in
[src/chatgpt-api.ts:180](https://github.com/transitive-bullshit/chatgpt-api/blob/88efa64/src/chatgpt-api.ts#L180)
[src/chatgpt-api.ts:180](https://github.com/transitive-bullshit/chatgpt-api/blob/d87ae67/src/chatgpt-api.ts#L180)
___
@ -307,4 +307,4 @@ ___
#### Defined in
[src/chatgpt-api.ts:324](https://github.com/transitive-bullshit/chatgpt-api/blob/88efa64/src/chatgpt-api.ts#L324)
[src/chatgpt-api.ts:324](https://github.com/transitive-bullshit/chatgpt-api/blob/d87ae67/src/chatgpt-api.ts#L324)

Wyświetl plik

@ -58,7 +58,7 @@ Creates a new client for automating the ChatGPT webapp.
#### Defined in
[src/chatgpt-api-browser.ts:36](https://github.com/transitive-bullshit/chatgpt-api/blob/88efa64/src/chatgpt-api-browser.ts#L36)
[src/chatgpt-api-browser.ts:36](https://github.com/transitive-bullshit/chatgpt-api/blob/d87ae67/src/chatgpt-api-browser.ts#L36)
## Accessors
@ -72,7 +72,7 @@ Creates a new client for automating the ChatGPT webapp.
#### Defined in
[src/chatgpt-api-browser.ts:524](https://github.com/transitive-bullshit/chatgpt-api/blob/88efa64/src/chatgpt-api-browser.ts#L524)
[src/chatgpt-api-browser.ts:524](https://github.com/transitive-bullshit/chatgpt-api/blob/d87ae67/src/chatgpt-api-browser.ts#L524)
## Methods
@ -92,7 +92,7 @@ Creates a new client for automating the ChatGPT webapp.
#### Defined in
[src/chatgpt-api-browser.ts:173](https://github.com/transitive-bullshit/chatgpt-api/blob/88efa64/src/chatgpt-api-browser.ts#L173)
[src/chatgpt-api-browser.ts:173](https://github.com/transitive-bullshit/chatgpt-api/blob/d87ae67/src/chatgpt-api-browser.ts#L173)
___
@ -112,7 +112,7 @@ ___
#### Defined in
[src/chatgpt-api-browser.ts:210](https://github.com/transitive-bullshit/chatgpt-api/blob/88efa64/src/chatgpt-api-browser.ts#L210)
[src/chatgpt-api-browser.ts:210](https://github.com/transitive-bullshit/chatgpt-api/blob/d87ae67/src/chatgpt-api-browser.ts#L210)
___
@ -136,7 +136,7 @@ An error if it fails.
#### Defined in
[src/chatgpt-api-browser.ts:512](https://github.com/transitive-bullshit/chatgpt-api/blob/88efa64/src/chatgpt-api-browser.ts#L512)
[src/chatgpt-api-browser.ts:512](https://github.com/transitive-bullshit/chatgpt-api/blob/d87ae67/src/chatgpt-api-browser.ts#L512)
___
@ -157,7 +157,7 @@ otherwise.
#### Defined in
[src/chatgpt-api-browser.ts:302](https://github.com/transitive-bullshit/chatgpt-api/blob/88efa64/src/chatgpt-api-browser.ts#L302)
[src/chatgpt-api-browser.ts:302](https://github.com/transitive-bullshit/chatgpt-api/blob/d87ae67/src/chatgpt-api-browser.ts#L302)
___
@ -182,7 +182,7 @@ An error if the session failed to initialize properly.
#### Defined in
[src/chatgpt-api-browser.ts:94](https://github.com/transitive-bullshit/chatgpt-api/blob/88efa64/src/chatgpt-api-browser.ts#L94)
[src/chatgpt-api-browser.ts:94](https://github.com/transitive-bullshit/chatgpt-api/blob/d87ae67/src/chatgpt-api-browser.ts#L94)
___
@ -202,7 +202,7 @@ Attempts to handle 403 errors by refreshing the page.
#### Defined in
[src/chatgpt-api-browser.ts:282](https://github.com/transitive-bullshit/chatgpt-api/blob/88efa64/src/chatgpt-api-browser.ts#L282)
[src/chatgpt-api-browser.ts:282](https://github.com/transitive-bullshit/chatgpt-api/blob/d87ae67/src/chatgpt-api-browser.ts#L282)
___
@ -222,7 +222,7 @@ Attempts to handle 401 errors by re-authenticating.
#### Defined in
[src/chatgpt-api-browser.ts:263](https://github.com/transitive-bullshit/chatgpt-api/blob/88efa64/src/chatgpt-api-browser.ts#L263)
[src/chatgpt-api-browser.ts:263](https://github.com/transitive-bullshit/chatgpt-api/blob/d87ae67/src/chatgpt-api-browser.ts#L263)
___
@ -236,7 +236,7 @@ ___
#### Defined in
[src/chatgpt-api-browser.ts:504](https://github.com/transitive-bullshit/chatgpt-api/blob/88efa64/src/chatgpt-api-browser.ts#L504)
[src/chatgpt-api-browser.ts:504](https://github.com/transitive-bullshit/chatgpt-api/blob/d87ae67/src/chatgpt-api-browser.ts#L504)
___
@ -269,4 +269,4 @@ the `response` text.
#### Defined in
[src/chatgpt-api-browser.ts:379](https://github.com/transitive-bullshit/chatgpt-api/blob/88efa64/src/chatgpt-api-browser.ts#L379)
[src/chatgpt-api-browser.ts:379](https://github.com/transitive-bullshit/chatgpt-api/blob/d87ae67/src/chatgpt-api-browser.ts#L379)

Wyświetl plik

@ -66,7 +66,7 @@ node_modules/.pnpm/typescript@4.9.3/node_modules/typescript/lib/lib.es2022.error
#### Defined in
[src/types.ts:297](https://github.com/transitive-bullshit/chatgpt-api/blob/88efa64/src/types.ts#L297)
[src/types.ts:297](https://github.com/transitive-bullshit/chatgpt-api/blob/d87ae67/src/types.ts#L297)
___
@ -76,7 +76,7 @@ ___
#### Defined in
[src/types.ts:296](https://github.com/transitive-bullshit/chatgpt-api/blob/88efa64/src/types.ts#L296)
[src/types.ts:296](https://github.com/transitive-bullshit/chatgpt-api/blob/d87ae67/src/types.ts#L296)
___
@ -86,7 +86,7 @@ ___
#### Defined in
[src/types.ts:294](https://github.com/transitive-bullshit/chatgpt-api/blob/88efa64/src/types.ts#L294)
[src/types.ts:294](https://github.com/transitive-bullshit/chatgpt-api/blob/d87ae67/src/types.ts#L294)
___
@ -96,4 +96,4 @@ ___
#### Defined in
[src/types.ts:295](https://github.com/transitive-bullshit/chatgpt-api/blob/88efa64/src/types.ts#L295)
[src/types.ts:295](https://github.com/transitive-bullshit/chatgpt-api/blob/d87ae67/src/types.ts#L295)

Wyświetl plik

@ -59,7 +59,7 @@
#### Defined in
[src/types.ts:109](https://github.com/transitive-bullshit/chatgpt-api/blob/88efa64/src/types.ts#L109)
[src/types.ts:109](https://github.com/transitive-bullshit/chatgpt-api/blob/d87ae67/src/types.ts#L109)
___
@ -80,7 +80,7 @@ ___
#### Defined in
[src/types.ts:300](https://github.com/transitive-bullshit/chatgpt-api/blob/88efa64/src/types.ts#L300)
[src/types.ts:300](https://github.com/transitive-bullshit/chatgpt-api/blob/d87ae67/src/types.ts#L300)
___
@ -98,7 +98,7 @@ ___
#### Defined in
[src/types.ts:306](https://github.com/transitive-bullshit/chatgpt-api/blob/88efa64/src/types.ts#L306)
[src/types.ts:306](https://github.com/transitive-bullshit/chatgpt-api/blob/d87ae67/src/types.ts#L306)
___
@ -108,7 +108,7 @@ ___
#### Defined in
[src/types.ts:1](https://github.com/transitive-bullshit/chatgpt-api/blob/88efa64/src/types.ts#L1)
[src/types.ts:1](https://github.com/transitive-bullshit/chatgpt-api/blob/d87ae67/src/types.ts#L1)
___
@ -130,7 +130,7 @@ https://chat.openapi.com/backend-api/conversation
#### Defined in
[src/types.ts:134](https://github.com/transitive-bullshit/chatgpt-api/blob/88efa64/src/types.ts#L134)
[src/types.ts:134](https://github.com/transitive-bullshit/chatgpt-api/blob/d87ae67/src/types.ts#L134)
___
@ -148,7 +148,7 @@ ___
#### Defined in
[src/types.ts:251](https://github.com/transitive-bullshit/chatgpt-api/blob/88efa64/src/types.ts#L251)
[src/types.ts:251](https://github.com/transitive-bullshit/chatgpt-api/blob/d87ae67/src/types.ts#L251)
___
@ -173,7 +173,7 @@ ___
#### Defined in
[src/types.ts:257](https://github.com/transitive-bullshit/chatgpt-api/blob/88efa64/src/types.ts#L257)
[src/types.ts:257](https://github.com/transitive-bullshit/chatgpt-api/blob/d87ae67/src/types.ts#L257)
___
@ -183,7 +183,7 @@ ___
#### Defined in
[src/types.ts:276](https://github.com/transitive-bullshit/chatgpt-api/blob/88efa64/src/types.ts#L276)
[src/types.ts:276](https://github.com/transitive-bullshit/chatgpt-api/blob/d87ae67/src/types.ts#L276)
___
@ -200,7 +200,7 @@ ___
#### Defined in
[src/types.ts:270](https://github.com/transitive-bullshit/chatgpt-api/blob/88efa64/src/types.ts#L270)
[src/types.ts:270](https://github.com/transitive-bullshit/chatgpt-api/blob/d87ae67/src/types.ts#L270)
___
@ -222,7 +222,7 @@ https://chat.openapi.com/backend-api/conversation/message_feedback
#### Defined in
[src/types.ts:193](https://github.com/transitive-bullshit/chatgpt-api/blob/88efa64/src/types.ts#L193)
[src/types.ts:193](https://github.com/transitive-bullshit/chatgpt-api/blob/d87ae67/src/types.ts#L193)
___
@ -232,7 +232,7 @@ ___
#### Defined in
[src/types.ts:249](https://github.com/transitive-bullshit/chatgpt-api/blob/88efa64/src/types.ts#L249)
[src/types.ts:249](https://github.com/transitive-bullshit/chatgpt-api/blob/d87ae67/src/types.ts#L249)
___
@ -252,7 +252,7 @@ ___
#### Defined in
[src/types.ts:222](https://github.com/transitive-bullshit/chatgpt-api/blob/88efa64/src/types.ts#L222)
[src/types.ts:222](https://github.com/transitive-bullshit/chatgpt-api/blob/d87ae67/src/types.ts#L222)
___
@ -262,7 +262,7 @@ ___
#### Defined in
[src/types.ts:220](https://github.com/transitive-bullshit/chatgpt-api/blob/88efa64/src/types.ts#L220)
[src/types.ts:220](https://github.com/transitive-bullshit/chatgpt-api/blob/d87ae67/src/types.ts#L220)
___
@ -272,7 +272,7 @@ ___
#### Defined in
[src/types.ts:275](https://github.com/transitive-bullshit/chatgpt-api/blob/88efa64/src/types.ts#L275)
[src/types.ts:275](https://github.com/transitive-bullshit/chatgpt-api/blob/d87ae67/src/types.ts#L275)
___
@ -290,7 +290,7 @@ ___
#### Defined in
[src/types.ts:77](https://github.com/transitive-bullshit/chatgpt-api/blob/88efa64/src/types.ts#L77)
[src/types.ts:77](https://github.com/transitive-bullshit/chatgpt-api/blob/d87ae67/src/types.ts#L77)
___
@ -308,7 +308,7 @@ https://chat.openapi.com/backend-api/models
#### Defined in
[src/types.ts:70](https://github.com/transitive-bullshit/chatgpt-api/blob/88efa64/src/types.ts#L70)
[src/types.ts:70](https://github.com/transitive-bullshit/chatgpt-api/blob/d87ae67/src/types.ts#L70)
___
@ -327,7 +327,7 @@ https://chat.openapi.com/backend-api/moderations
#### Defined in
[src/types.ts:97](https://github.com/transitive-bullshit/chatgpt-api/blob/88efa64/src/types.ts#L97)
[src/types.ts:97](https://github.com/transitive-bullshit/chatgpt-api/blob/d87ae67/src/types.ts#L97)
___
@ -347,7 +347,7 @@ https://chat.openapi.com/backend-api/moderations
#### Defined in
[src/types.ts:114](https://github.com/transitive-bullshit/chatgpt-api/blob/88efa64/src/types.ts#L114)
[src/types.ts:114](https://github.com/transitive-bullshit/chatgpt-api/blob/d87ae67/src/types.ts#L114)
___
@ -369,7 +369,7 @@ to authenticate with the unofficial ChatGPT API.
#### Defined in
[src/openai-auth.ts:27](https://github.com/transitive-bullshit/chatgpt-api/blob/88efa64/src/openai-auth.ts#L27)
[src/openai-auth.ts:27](https://github.com/transitive-bullshit/chatgpt-api/blob/d87ae67/src/openai-auth.ts#L27)
___
@ -387,7 +387,7 @@ ___
#### Defined in
[src/types.ts:161](https://github.com/transitive-bullshit/chatgpt-api/blob/88efa64/src/types.ts#L161)
[src/types.ts:161](https://github.com/transitive-bullshit/chatgpt-api/blob/d87ae67/src/types.ts#L161)
___
@ -404,7 +404,7 @@ ___
#### Defined in
[src/types.ts:178](https://github.com/transitive-bullshit/chatgpt-api/blob/88efa64/src/types.ts#L178)
[src/types.ts:178](https://github.com/transitive-bullshit/chatgpt-api/blob/d87ae67/src/types.ts#L178)
___
@ -414,7 +414,7 @@ ___
#### Defined in
[src/types.ts:3](https://github.com/transitive-bullshit/chatgpt-api/blob/88efa64/src/types.ts#L3)
[src/types.ts:3](https://github.com/transitive-bullshit/chatgpt-api/blob/d87ae67/src/types.ts#L3)
___
@ -424,7 +424,7 @@ ___
#### Defined in
[src/types.ts:288](https://github.com/transitive-bullshit/chatgpt-api/blob/88efa64/src/types.ts#L288)
[src/types.ts:288](https://github.com/transitive-bullshit/chatgpt-api/blob/d87ae67/src/types.ts#L288)
___
@ -446,7 +446,7 @@ ___
#### Defined in
[src/types.ts:278](https://github.com/transitive-bullshit/chatgpt-api/blob/88efa64/src/types.ts#L278)
[src/types.ts:278](https://github.com/transitive-bullshit/chatgpt-api/blob/d87ae67/src/types.ts#L278)
___
@ -467,7 +467,7 @@ https://chat.openapi.com/api/auth/session
#### Defined in
[src/types.ts:8](https://github.com/transitive-bullshit/chatgpt-api/blob/88efa64/src/types.ts#L8)
[src/types.ts:8](https://github.com/transitive-bullshit/chatgpt-api/blob/d87ae67/src/types.ts#L8)
___
@ -489,7 +489,7 @@ ___
#### Defined in
[src/types.ts:30](https://github.com/transitive-bullshit/chatgpt-api/blob/88efa64/src/types.ts#L30)
[src/types.ts:30](https://github.com/transitive-bullshit/chatgpt-api/blob/d87ae67/src/types.ts#L30)
## Functions
@ -516,7 +516,7 @@ included them in here.
#### Defined in
[src/utils.ts:73](https://github.com/transitive-bullshit/chatgpt-api/blob/88efa64/src/utils.ts#L73)
[src/utils.ts:73](https://github.com/transitive-bullshit/chatgpt-api/blob/d87ae67/src/utils.ts#L73)
___
@ -532,7 +532,7 @@ Gets the default path to chrome's executable for the current platform.
#### Defined in
[src/openai-auth.ts:299](https://github.com/transitive-bullshit/chatgpt-api/blob/88efa64/src/openai-auth.ts#L299)
[src/openai-auth.ts:362](https://github.com/transitive-bullshit/chatgpt-api/blob/d87ae67/src/openai-auth.ts#L362)
___
@ -556,7 +556,7 @@ recognizes it and blocks access.
#### Defined in
[src/openai-auth.ts:201](https://github.com/transitive-bullshit/chatgpt-api/blob/88efa64/src/openai-auth.ts#L201)
[src/openai-auth.ts:215](https://github.com/transitive-bullshit/chatgpt-api/blob/d87ae67/src/openai-auth.ts#L215)
___
@ -588,6 +588,7 @@ with your updated credentials.
| `__namedParameters.email?` | `string` |
| `__namedParameters.executablePath?` | `string` |
| `__namedParameters.isGoogleLogin?` | `boolean` |
| `__namedParameters.nopechaKey?` | `string` |
| `__namedParameters.page?` | `Page` |
| `__namedParameters.password?` | `string` |
| `__namedParameters.timeoutMs?` | `number` |
@ -598,7 +599,7 @@ with your updated credentials.
#### Defined in
[src/openai-auth.ts:49](https://github.com/transitive-bullshit/chatgpt-api/blob/88efa64/src/openai-auth.ts#L49)
[src/openai-auth.ts:49](https://github.com/transitive-bullshit/chatgpt-api/blob/d87ae67/src/openai-auth.ts#L49)
___
@ -618,7 +619,7 @@ ___
#### Defined in
[src/utils.ts:39](https://github.com/transitive-bullshit/chatgpt-api/blob/88efa64/src/utils.ts#L39)
[src/utils.ts:39](https://github.com/transitive-bullshit/chatgpt-api/blob/d87ae67/src/utils.ts#L39)
___
@ -638,7 +639,7 @@ ___
#### Defined in
[src/utils.ts:12](https://github.com/transitive-bullshit/chatgpt-api/blob/88efa64/src/utils.ts#L12)
[src/utils.ts:12](https://github.com/transitive-bullshit/chatgpt-api/blob/d87ae67/src/utils.ts#L12)
___
@ -658,7 +659,7 @@ ___
#### Defined in
[src/utils.ts:29](https://github.com/transitive-bullshit/chatgpt-api/blob/88efa64/src/utils.ts#L29)
[src/utils.ts:29](https://github.com/transitive-bullshit/chatgpt-api/blob/d87ae67/src/utils.ts#L29)
___
@ -678,4 +679,4 @@ ___
#### Defined in
[src/utils.ts:19](https://github.com/transitive-bullshit/chatgpt-api/blob/88efa64/src/utils.ts#L19)
[src/utils.ts:19](https://github.com/transitive-bullshit/chatgpt-api/blob/d87ae67/src/utils.ts#L19)

Wyświetl plik

@ -1,6 +1,6 @@
chatgpt / [Exports](modules.md)
# Update December 15, 2022 <!-- omit in toc -->
# Update December 18, 2022 <!-- omit in toc -->
On December 11th, OpenAI added Cloudflare protections that make it more difficult to access the unofficial API.
@ -8,7 +8,7 @@ This package has been updated to use Puppeteer to automatically log in to ChatGP
Even with this in place, however, it's common to run into 429 / 403 errors at the moment using the `getOpenAIAuth` + `ChatGPTAPI` approach.
To circumvent these issues, we've also added a full browser-based solution, which uses Puppeteer to login and automate the webapp.
To circumvent these issues, we've also added a **full browser-based solution**, which uses Puppeteer to login and automate the webapp.
The full browser version is working consistently and can be used via:
@ -29,9 +29,9 @@ Note that this solution is not lightweight, but it does work a lot more consiste
If you get a "ChatGPT is at capacity" error when logging in, note that this can also happen on the official webapp as well. Their servers get overloaded at times, and we're all trying our best to offer access to this amazing technology.
To use the updated version, **make sure you're using the latest version of this package and Node.js >= 18**. Then update your code following the examples below, paying special attention to the sections on [Authentication](#authentication) and [Restrictions](#restrictions).
To use the updated version, **make sure you're using the latest version of this package and Node.js >= 18**. Then update your code following the examples below, paying special attention to the sections on [Authentication](#authentication), [Restrictions](#restrictions), and [CAPTCHAs](#captchas).
We're working hard to improve this process (especially CAPTCHA automation). Keep in mind that this package will be updated to use the official API as soon as it's released, so things should get much easier over time. 💪
We recently released support for CAPTCHA automation using either [nopecha](https://nopecha.com/) or [2captcha](https://2captcha.com). Keep in mind that this package will be updated to use the official API as soon as it's released, so things should get much easier over time. 💪
Lastly, please consider starring this repo and <a href="https://twitter.com/transitive_bs">following me on twitter <img src="https://storage.googleapis.com/saasify-assets/twitter-logo.svg" alt="twitter" height="24px" align="center"></a> to help support the project.
@ -56,6 +56,7 @@ Thanks && cheers,
- [Docs](#docs)
- [Demos](#demos)
- [Authentication](#authentication)
- [CAPTCHAs](#captchas)
- [Restrictions](#restrictions)
- [Projects](#projects)
- [Compatibility](#compatibility)
@ -78,6 +79,26 @@ npm install chatgpt puppeteer
## Usage
```ts
import { ChatGPTAPIBrowser } from 'chatgpt'
async function example() {
// use puppeteer to bypass cloudflare (headful because of captchas)
const api = new ChatGPTAPIBrowser({
email: process.env.OPENAI_EMAIL,
password: process.env.OPENAI_PASSWORD
})
await api.initSession()
const result = await api.sendMessage('Hello World!')
console.log(result.response)
}
```
<details>
<summary>Or, if you want to use the REST-based version:</summary>
```ts
import { ChatGPTAPI, getOpenAIAuth } from 'chatgpt'
@ -99,43 +120,26 @@ async function example() {
}
```
Or, if you want to try the full browser-based solution:
```ts
import { ChatGPTAPIBrowser } from 'chatgpt'
async function example() {
// use puppeteer to bypass cloudflare (headful because of captchas)
const api = new ChatGPTAPIBrowser({
email: process.env.OPENAI_EMAIL,
password: process.env.OPENAI_PASSWORD
})
await api.initSession()
const result = await api.sendMessage('Hello World!')
console.log(result.response)
}
```
</details>
ChatGPT responses are formatted as markdown by default. If you want to work with plaintext instead, you can use:
```ts
const api = new ChatGPTAPI({ ...openAIAuth, markdown: false })
const api = new ChatGPTAPIBrowser({ email, password, markdown: false })
```
If you want to track the conversation, use the `conversationId` and `messageId` in the result object, and pass them to `sendMessage` as `conversationId` and `parentMessageId` respectively.
```ts
const api = new ChatGPTAPI({ ...openAIAuth, markdown: false })
const api = new ChatGPTAPIBrowser({ email, password })
await api.initSession()
// send a message and wait for the response
let res = await conversation.sendMessage('What is OpenAI?')
let res = await api.sendMessage('What is OpenAI?')
console.log(res.response)
// send a follow-up
res = await conversation.sendMessage('Can you expand on that?', {
res = await api.sendMessage('Can you expand on that?', {
conversationId: res.conversationId,
parentMessageId: res.messageId
})
@ -143,7 +147,7 @@ console.log(res.response)
// send another follow-up
// send a follow-up
res = await conversation.sendMessage('What were we talking about?', {
res = await api.sendMessage('What were we talking about?', {
conversationId: res.conversationId,
parentMessageId: res.messageId
})
@ -244,9 +248,33 @@ Pass `sessionToken`, `clearanceToken`, and `userAgent` to the `ChatGPTAPI` const
> **Note**
> This package will switch to using the official API once it's released, which will make this process much simpler.
### CAPTCHAs
The browser portions of this package use Puppeteer to automate as much as possible, including all CAPTCHAs. 🔥
Basic Cloudflare CAPTCHAs are handled by default, but if you want to automate the email + password Recaptchas, you'll need to sign up for one of these paid providers:
- [nopecha](https://nopecha.com/) - Uses AI to solve CAPTCHAS
- Faster and cheaper
- Set the `NOPECHA_KEY` env var to your nopecha API key
- [Demo video](https://user-images.githubusercontent.com/552829/208235991-de4890f2-e7ba-4b42-bf55-4fcd792d4b19.mp4) of nopecha solving the login Recaptcha (41 seconds)
- [2captcha](https://2captcha.com) - Uses real people to solve CAPTCHAS
- More well-known solution that's been around longer
- Set the `CAPTCHA_TOKEN` env var to your 2captcha API token
Alternatively, if your OpenAI account uses Google Auth, you shouldn't encounter any of the more complicated Recaptchas — and can avoid using these third-party providers. To use Google auth, make sure your OpenAI account is using Google and then set `isGoogleLogin` to `true` whenever you're passing your `email` and `password`. For example:
```ts
const api = new ChatGPTAPIBrowser({
email: process.env.OPENAI_EMAIL,
password: process.env.OPENAI_PASSWORD,
isGoogleLogin: true
})
```
### Restrictions
These restrictions are for the `getOpenAIAuth` + `ChatGPTAPI` solution, which uses the unofficial API. The browser-based solution, `ChatGPTAPIBrowser`, doesn't have many of these restrictions, though you'll still have to manually bypass CAPTCHAs by hand.
These restrictions are for the `getOpenAIAuth` + `ChatGPTAPI` solution, which uses the unofficial API. The browser-based solution, `ChatGPTAPIBrowser`, generally doesn't have any of these restrictions.
**Please read carefully**
@ -254,7 +282,7 @@ These restrictions are for the `getOpenAIAuth` + `ChatGPTAPI` solution, which us
- Cloudflare `cf_clearance` **tokens expire after 2 hours**, so right now we recommend that you refresh your `cf_clearance` token every hour or so.
- Your `user-agent` and `IP address` **must match** from the real browser window you're logged in with to the one you're using for `ChatGPTAPI`.
- This means that you currently can't log in with your laptop and then run the bot on a server or proxy somewhere.
- Cloudflare will still sometimes ask you to complete a CAPTCHA, so you may need to keep an eye on it and manually resolve the CAPTCHA. Automated CAPTCHA bypass is coming soon.
- Cloudflare will still sometimes ask you to complete a CAPTCHA, so you may need to keep an eye on it and manually resolve the CAPTCHA.
- You should not be using this account while the bot is using it, because that browser window may refresh one of your tokens and invalidate the bot's session.
> **Note**
@ -308,6 +336,7 @@ All of these awesome projects are built using the `chatgpt` package. 🤯
- [TalkGPT](https://github.com/ShadovvBeast/TalkGPT)
- [iOS Shortcut](https://github.com/leecobaby/shortcuts/blob/master/other/ChatGPT_EN.md)
- [Slack Bot](https://github.com/trietphm/chatgpt-slackbot/)
- [Electron Bot](https://github.com/ShiranAbir/chaty)
If you create a cool integration, feel free to open a PR and add it to the list.
@ -322,7 +351,7 @@ This package is ESM-only. It supports:
## Credits
- Huge thanks to [@abacaj](https://github.com/abacaj), [@waylaidwanderer](https://github.com/waylaidwanderer), [@wong2](https://github.com/wong2), [@simon300000](https://github.com/simon300000), [@RomanHotsiy](https://github.com/RomanHotsiy), [@ElijahPepe](https://github.com/ElijahPepe), and all the other contributors 💪
- Huge thanks to [@waylaidwanderer](https://github.com/waylaidwanderer), [@abacaj](https://github.com/abacaj), [@wong2](https://github.com/wong2), [@simon300000](https://github.com/simon300000), [@RomanHotsiy](https://github.com/RomanHotsiy), [@ElijahPepe](https://github.com/ElijahPepe), and all the other contributors 💪
- The original browser version was inspired by this [Go module](https://github.com/danielgross/whatsapp-gpt) by [Daniel Gross](https://github.com/danielgross)
- [OpenAI](https://openai.com) for creating [ChatGPT](https://openai.com/blog/chatgpt/) 🔥