Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
xtremehpx committed Jan 5, 2023
2 parents 336a91d + 8c7ab5e commit 6d95f77
Show file tree
Hide file tree
Showing 12 changed files with 116 additions and 186 deletions.
81 changes: 0 additions & 81 deletions demos/demo-conversation-browser.ts

This file was deleted.

11 changes: 6 additions & 5 deletions demos/demo-conversation.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import dotenv from 'dotenv-safe'
import { oraPromise } from 'ora'

import { ChatGPTAPI, getOpenAIAuth } from '../src'
import { ChatGPTAPIBrowser } from '../src'

dotenv.config()

Expand All @@ -16,12 +16,12 @@ async function main() {
const email = process.env.OPENAI_EMAIL
const password = process.env.OPENAI_PASSWORD

const authInfo = await getOpenAIAuth({
const api = new ChatGPTAPIBrowser({
email,
password
password,
debug: false,
minimize: true
})

const api = new ChatGPTAPI({ ...authInfo })
await api.initSession()

const prompt = 'Write a poem about cats.'
Expand Down Expand Up @@ -71,6 +71,7 @@ async function main() {
)
console.log('\n' + res.response + '\n')

// close the browser at the end
await api.closeSession()
}

Expand Down
12 changes: 6 additions & 6 deletions docs/classes/AChatGPTAPI.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/d1b74a8/src/abstract-chatgpt-api.ts#L69)
[src/abstract-chatgpt-api.ts:69](https://github.com/transitive-bullshit/chatgpt-api/blob/025e7e3/src/abstract-chatgpt-api.ts#L69)

___

Expand All @@ -66,7 +66,7 @@ otherwise.

#### Defined in

[src/abstract-chatgpt-api.ts:39](https://github.com/transitive-bullshit/chatgpt-api/blob/d1b74a8/src/abstract-chatgpt-api.ts#L39)
[src/abstract-chatgpt-api.ts:39](https://github.com/transitive-bullshit/chatgpt-api/blob/025e7e3/src/abstract-chatgpt-api.ts#L39)

___

Expand All @@ -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/d1b74a8/src/abstract-chatgpt-api.ts#L10)
[src/abstract-chatgpt-api.ts:10](https://github.com/transitive-bullshit/chatgpt-api/blob/025e7e3/src/abstract-chatgpt-api.ts#L10)

___

Expand All @@ -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/d1b74a8/src/abstract-chatgpt-api.ts#L49)
[src/abstract-chatgpt-api.ts:49](https://github.com/transitive-bullshit/chatgpt-api/blob/025e7e3/src/abstract-chatgpt-api.ts#L49)

___

Expand All @@ -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/d1b74a8/src/abstract-chatgpt-api.ts#L59)
[src/abstract-chatgpt-api.ts:59](https://github.com/transitive-bullshit/chatgpt-api/blob/025e7e3/src/abstract-chatgpt-api.ts#L59)

___

Expand Down Expand Up @@ -164,4 +164,4 @@ the `response` text.

#### Defined in

[src/abstract-chatgpt-api.ts:30](https://github.com/transitive-bullshit/chatgpt-api/blob/d1b74a8/src/abstract-chatgpt-api.ts#L30)
[src/abstract-chatgpt-api.ts:30](https://github.com/transitive-bullshit/chatgpt-api/blob/025e7e3/src/abstract-chatgpt-api.ts#L30)
24 changes: 12 additions & 12 deletions docs/classes/ChatGPTAPI.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ to obtain your `clearanceToken`.

#### Defined in

[src/chatgpt-api.ts:45](https://github.com/transitive-bullshit/chatgpt-api/blob/d1b74a8/src/chatgpt-api.ts#L45)
[src/chatgpt-api.ts:45](https://github.com/transitive-bullshit/chatgpt-api/blob/025e7e3/src/chatgpt-api.ts#L45)

## Accessors

Expand All @@ -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/d1b74a8/src/chatgpt-api.ts#L143)
[src/chatgpt-api.ts:143](https://github.com/transitive-bullshit/chatgpt-api/blob/025e7e3/src/chatgpt-api.ts#L143)

___

Expand All @@ -96,7 +96,7 @@ Gets the current session token.

#### Defined in

[src/chatgpt-api.ts:138](https://github.com/transitive-bullshit/chatgpt-api/blob/d1b74a8/src/chatgpt-api.ts#L138)
[src/chatgpt-api.ts:138](https://github.com/transitive-bullshit/chatgpt-api/blob/025e7e3/src/chatgpt-api.ts#L138)

___

Expand All @@ -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/d1b74a8/src/chatgpt-api.ts#L133)
[src/chatgpt-api.ts:133](https://github.com/transitive-bullshit/chatgpt-api/blob/025e7e3/src/chatgpt-api.ts#L133)

___

Expand All @@ -128,7 +128,7 @@ Gets the current user agent.

#### Defined in

[src/chatgpt-api.ts:148](https://github.com/transitive-bullshit/chatgpt-api/blob/d1b74a8/src/chatgpt-api.ts#L148)
[src/chatgpt-api.ts:148](https://github.com/transitive-bullshit/chatgpt-api/blob/025e7e3/src/chatgpt-api.ts#L148)

## Methods

Expand All @@ -152,7 +152,7 @@ An error if it fails.

#### Defined in

[src/chatgpt-api.ts:470](https://github.com/transitive-bullshit/chatgpt-api/blob/d1b74a8/src/chatgpt-api.ts#L470)
[src/chatgpt-api.ts:470](https://github.com/transitive-bullshit/chatgpt-api/blob/025e7e3/src/chatgpt-api.ts#L470)

___

Expand All @@ -173,7 +173,7 @@ the token fails.

#### Defined in

[src/chatgpt-api.ts:367](https://github.com/transitive-bullshit/chatgpt-api/blob/d1b74a8/src/chatgpt-api.ts#L367)
[src/chatgpt-api.ts:367](https://github.com/transitive-bullshit/chatgpt-api/blob/025e7e3/src/chatgpt-api.ts#L367)

___

Expand All @@ -194,7 +194,7 @@ is valid.

#### Defined in

[src/chatgpt-api.ts:156](https://github.com/transitive-bullshit/chatgpt-api/blob/d1b74a8/src/chatgpt-api.ts#L156)
[src/chatgpt-api.ts:156](https://github.com/transitive-bullshit/chatgpt-api/blob/025e7e3/src/chatgpt-api.ts#L156)

___

Expand Down Expand Up @@ -224,7 +224,7 @@ A valid access token

#### Defined in

[src/chatgpt-api.ts:386](https://github.com/transitive-bullshit/chatgpt-api/blob/d1b74a8/src/chatgpt-api.ts#L386)
[src/chatgpt-api.ts:386](https://github.com/transitive-bullshit/chatgpt-api/blob/025e7e3/src/chatgpt-api.ts#L386)

___

Expand Down Expand Up @@ -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/d1b74a8/src/abstract-chatgpt-api.ts#L59)
[src/abstract-chatgpt-api.ts:59](https://github.com/transitive-bullshit/chatgpt-api/blob/025e7e3/src/abstract-chatgpt-api.ts#L59)

___

Expand Down Expand Up @@ -287,7 +287,7 @@ The response from ChatGPT

#### Defined in

[src/chatgpt-api.ts:180](https://github.com/transitive-bullshit/chatgpt-api/blob/d1b74a8/src/chatgpt-api.ts#L180)
[src/chatgpt-api.ts:180](https://github.com/transitive-bullshit/chatgpt-api/blob/025e7e3/src/chatgpt-api.ts#L180)

___

Expand All @@ -307,4 +307,4 @@ ___

#### Defined in

[src/chatgpt-api.ts:324](https://github.com/transitive-bullshit/chatgpt-api/blob/d1b74a8/src/chatgpt-api.ts#L324)
[src/chatgpt-api.ts:324](https://github.com/transitive-bullshit/chatgpt-api/blob/025e7e3/src/chatgpt-api.ts#L324)
23 changes: 12 additions & 11 deletions docs/classes/ChatGPTAPIBrowser.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ Creates a new client for automating the ChatGPT webapp.
| `opts.isMicrosoftLogin?` | `boolean` | **`Default Value`** `false` * |
| `opts.markdown?` | `boolean` | **`Default Value`** `true` * |
| `opts.minimize?` | `boolean` | **`Default Value`** `true` * |
| `opts.nopechaKey?` | `string` | **`Default Value`** `undefined` * |
| `opts.password` | `string` | - |
| `opts.proxyServer?` | `string` | **`Default Value`** `undefined` * |

Expand All @@ -60,7 +61,7 @@ Creates a new client for automating the ChatGPT webapp.

#### Defined in

[src/chatgpt-api-browser.ts:38](https://github.com/transitive-bullshit/chatgpt-api/blob/d1b74a8/src/chatgpt-api-browser.ts#L38)
[src/chatgpt-api-browser.ts:40](https://github.com/transitive-bullshit/chatgpt-api/blob/025e7e3/src/chatgpt-api-browser.ts#L40)

## Accessors

Expand All @@ -74,7 +75,7 @@ Creates a new client for automating the ChatGPT webapp.

#### Defined in

[src/chatgpt-api-browser.ts:599](https://github.com/transitive-bullshit/chatgpt-api/blob/d1b74a8/src/chatgpt-api-browser.ts#L599)
[src/chatgpt-api-browser.ts:696](https://github.com/transitive-bullshit/chatgpt-api/blob/025e7e3/src/chatgpt-api-browser.ts#L696)

## Methods

Expand All @@ -94,7 +95,7 @@ Creates a new client for automating the ChatGPT webapp.

#### Defined in

[src/chatgpt-api-browser.ts:204](https://github.com/transitive-bullshit/chatgpt-api/blob/d1b74a8/src/chatgpt-api-browser.ts#L204)
[src/chatgpt-api-browser.ts:218](https://github.com/transitive-bullshit/chatgpt-api/blob/025e7e3/src/chatgpt-api-browser.ts#L218)

___

Expand All @@ -114,7 +115,7 @@ ___

#### Defined in

[src/chatgpt-api-browser.ts:241](https://github.com/transitive-bullshit/chatgpt-api/blob/d1b74a8/src/chatgpt-api-browser.ts#L241)
[src/chatgpt-api-browser.ts:255](https://github.com/transitive-bullshit/chatgpt-api/blob/025e7e3/src/chatgpt-api-browser.ts#L255)

___

Expand All @@ -138,7 +139,7 @@ An error if it fails.

#### Defined in

[src/chatgpt-api-browser.ts:574](https://github.com/transitive-bullshit/chatgpt-api/blob/d1b74a8/src/chatgpt-api-browser.ts#L574)
[src/chatgpt-api-browser.ts:642](https://github.com/transitive-bullshit/chatgpt-api/blob/025e7e3/src/chatgpt-api-browser.ts#L642)

___

Expand All @@ -159,7 +160,7 @@ otherwise.

#### Defined in

[src/chatgpt-api-browser.ts:335](https://github.com/transitive-bullshit/chatgpt-api/blob/d1b74a8/src/chatgpt-api-browser.ts#L335)
[src/chatgpt-api-browser.ts:391](https://github.com/transitive-bullshit/chatgpt-api/blob/025e7e3/src/chatgpt-api-browser.ts#L391)

___

Expand All @@ -184,7 +185,7 @@ An error if the session failed to initialize properly.

#### Defined in

[src/chatgpt-api-browser.ts:106](https://github.com/transitive-bullshit/chatgpt-api/blob/d1b74a8/src/chatgpt-api-browser.ts#L106)
[src/chatgpt-api-browser.ts:114](https://github.com/transitive-bullshit/chatgpt-api/blob/025e7e3/src/chatgpt-api-browser.ts#L114)

___

Expand All @@ -204,7 +205,7 @@ Attempts to handle 403 errors by refreshing the page.

#### Defined in

[src/chatgpt-api-browser.ts:313](https://github.com/transitive-bullshit/chatgpt-api/blob/d1b74a8/src/chatgpt-api-browser.ts#L313)
[src/chatgpt-api-browser.ts:333](https://github.com/transitive-bullshit/chatgpt-api/blob/025e7e3/src/chatgpt-api-browser.ts#L333)

___

Expand All @@ -224,7 +225,7 @@ Attempts to handle 401 errors by re-authenticating.

#### Defined in

[src/chatgpt-api-browser.ts:294](https://github.com/transitive-bullshit/chatgpt-api/blob/d1b74a8/src/chatgpt-api-browser.ts#L294)
[src/chatgpt-api-browser.ts:314](https://github.com/transitive-bullshit/chatgpt-api/blob/025e7e3/src/chatgpt-api-browser.ts#L314)

___

Expand All @@ -238,7 +239,7 @@ ___

#### Defined in

[src/chatgpt-api-browser.ts:566](https://github.com/transitive-bullshit/chatgpt-api/blob/d1b74a8/src/chatgpt-api-browser.ts#L566)
[src/chatgpt-api-browser.ts:634](https://github.com/transitive-bullshit/chatgpt-api/blob/025e7e3/src/chatgpt-api-browser.ts#L634)

___

Expand Down Expand Up @@ -271,4 +272,4 @@ the `response` text.

#### Defined in

[src/chatgpt-api-browser.ts:412](https://github.com/transitive-bullshit/chatgpt-api/blob/d1b74a8/src/chatgpt-api-browser.ts#L412)
[src/chatgpt-api-browser.ts:468](https://github.com/transitive-bullshit/chatgpt-api/blob/025e7e3/src/chatgpt-api-browser.ts#L468)
Loading

0 comments on commit 6d95f77

Please sign in to comment.