2022-12-15 23:15:38 +00:00
|
|
|
[chatgpt](../readme.md) / [Exports](../modules.md) / ChatGPTAPIBrowser
|
|
|
|
|
|
|
|
# Class: ChatGPTAPIBrowser
|
|
|
|
|
|
|
|
## Table of contents
|
|
|
|
|
|
|
|
### Constructors
|
|
|
|
|
|
|
|
- [constructor](ChatGPTAPIBrowser.md#constructor)
|
|
|
|
|
|
|
|
### Methods
|
|
|
|
|
|
|
|
- [\_onRequest](ChatGPTAPIBrowser.md#_onrequest)
|
|
|
|
- [\_onResponse](ChatGPTAPIBrowser.md#_onresponse)
|
|
|
|
- [close](ChatGPTAPIBrowser.md#close)
|
|
|
|
- [getIsAuthenticated](ChatGPTAPIBrowser.md#getisauthenticated)
|
|
|
|
- [handle403Error](ChatGPTAPIBrowser.md#handle403error)
|
|
|
|
- [init](ChatGPTAPIBrowser.md#init)
|
|
|
|
- [resetThread](ChatGPTAPIBrowser.md#resetthread)
|
|
|
|
- [sendMessage](ChatGPTAPIBrowser.md#sendmessage)
|
|
|
|
|
|
|
|
## Constructors
|
|
|
|
|
|
|
|
### constructor
|
|
|
|
|
|
|
|
• **new ChatGPTAPIBrowser**(`opts`)
|
|
|
|
|
|
|
|
Creates a new client wrapper for automating the ChatGPT webapp.
|
|
|
|
|
|
|
|
#### Parameters
|
|
|
|
|
|
|
|
| Name | Type | Description |
|
|
|
|
| :------ | :------ | :------ |
|
|
|
|
| `opts` | `Object` | - |
|
2022-12-16 23:12:43 +00:00
|
|
|
| `opts.browserPath?` | `string` | **`Default Value`** `undefined` * |
|
2022-12-16 07:38:20 +00:00
|
|
|
| `opts.captchaToken?` | `string` | **`Default Value`** `undefined` * |
|
2022-12-15 23:15:38 +00:00
|
|
|
| `opts.debug?` | `boolean` | **`Default Value`** `false` * |
|
|
|
|
| `opts.email` | `string` | - |
|
2022-12-16 07:38:20 +00:00
|
|
|
| `opts.isGoogleLogin?` | `boolean` | **`Default Value`** `false` * |
|
2022-12-15 23:15:38 +00:00
|
|
|
| `opts.markdown?` | `boolean` | **`Default Value`** `true` * |
|
2022-12-16 07:38:20 +00:00
|
|
|
| `opts.minimize?` | `boolean` | **`Default Value`** `true` * |
|
2022-12-15 23:15:38 +00:00
|
|
|
| `opts.password` | `string` | - |
|
|
|
|
|
|
|
|
#### Defined in
|
|
|
|
|
2022-12-16 23:12:43 +00:00
|
|
|
[src/chatgpt-api-browser.ts:32](https://github.com/transitive-bullshit/chatgpt-api/blob/d685b78/src/chatgpt-api-browser.ts#L32)
|
2022-12-15 23:15:38 +00:00
|
|
|
|
|
|
|
## Methods
|
|
|
|
|
|
|
|
### \_onRequest
|
|
|
|
|
|
|
|
▸ **_onRequest**(`request`): `void`
|
|
|
|
|
|
|
|
#### Parameters
|
|
|
|
|
|
|
|
| Name | Type |
|
|
|
|
| :------ | :------ |
|
|
|
|
| `request` | `HTTPRequest` |
|
|
|
|
|
|
|
|
#### Returns
|
|
|
|
|
|
|
|
`void`
|
|
|
|
|
|
|
|
#### Defined in
|
|
|
|
|
2022-12-16 23:12:43 +00:00
|
|
|
[src/chatgpt-api-browser.ts:153](https://github.com/transitive-bullshit/chatgpt-api/blob/d685b78/src/chatgpt-api-browser.ts#L153)
|
2022-12-15 23:15:38 +00:00
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
### \_onResponse
|
|
|
|
|
|
|
|
▸ **_onResponse**(`response`): `Promise`<`void`\>
|
|
|
|
|
|
|
|
#### Parameters
|
|
|
|
|
|
|
|
| Name | Type |
|
|
|
|
| :------ | :------ |
|
|
|
|
| `response` | `HTTPResponse` |
|
|
|
|
|
|
|
|
#### Returns
|
|
|
|
|
|
|
|
`Promise`<`void`\>
|
|
|
|
|
|
|
|
#### Defined in
|
|
|
|
|
2022-12-16 23:12:43 +00:00
|
|
|
[src/chatgpt-api-browser.ts:190](https://github.com/transitive-bullshit/chatgpt-api/blob/d685b78/src/chatgpt-api-browser.ts#L190)
|
2022-12-15 23:15:38 +00:00
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
### close
|
|
|
|
|
|
|
|
▸ **close**(): `Promise`<`void`\>
|
|
|
|
|
|
|
|
#### Returns
|
|
|
|
|
|
|
|
`Promise`<`void`\>
|
|
|
|
|
|
|
|
#### Defined in
|
|
|
|
|
2022-12-16 23:12:43 +00:00
|
|
|
[src/chatgpt-api-browser.ts:453](https://github.com/transitive-bullshit/chatgpt-api/blob/d685b78/src/chatgpt-api-browser.ts#L453)
|
2022-12-15 23:15:38 +00:00
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
### getIsAuthenticated
|
|
|
|
|
|
|
|
▸ **getIsAuthenticated**(): `Promise`<`boolean`\>
|
|
|
|
|
|
|
|
#### Returns
|
|
|
|
|
|
|
|
`Promise`<`boolean`\>
|
|
|
|
|
|
|
|
#### Defined in
|
|
|
|
|
2022-12-16 23:12:43 +00:00
|
|
|
[src/chatgpt-api-browser.ts:257](https://github.com/transitive-bullshit/chatgpt-api/blob/d685b78/src/chatgpt-api-browser.ts#L257)
|
2022-12-15 23:15:38 +00:00
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
### handle403Error
|
|
|
|
|
|
|
|
▸ **handle403Error**(): `Promise`<`void`\>
|
|
|
|
|
|
|
|
#### Returns
|
|
|
|
|
|
|
|
`Promise`<`void`\>
|
|
|
|
|
|
|
|
#### Defined in
|
|
|
|
|
2022-12-16 23:12:43 +00:00
|
|
|
[src/chatgpt-api-browser.ts:238](https://github.com/transitive-bullshit/chatgpt-api/blob/d685b78/src/chatgpt-api-browser.ts#L238)
|
2022-12-15 23:15:38 +00:00
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
### init
|
|
|
|
|
|
|
|
▸ **init**(): `Promise`<`boolean`\>
|
|
|
|
|
|
|
|
#### Returns
|
|
|
|
|
|
|
|
`Promise`<`boolean`\>
|
|
|
|
|
|
|
|
#### Defined in
|
|
|
|
|
2022-12-16 23:12:43 +00:00
|
|
|
[src/chatgpt-api-browser.ts:76](https://github.com/transitive-bullshit/chatgpt-api/blob/d685b78/src/chatgpt-api-browser.ts#L76)
|
2022-12-15 23:15:38 +00:00
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
### resetThread
|
|
|
|
|
|
|
|
▸ **resetThread**(): `Promise`<`void`\>
|
|
|
|
|
|
|
|
#### Returns
|
|
|
|
|
|
|
|
`Promise`<`void`\>
|
|
|
|
|
|
|
|
#### Defined in
|
|
|
|
|
2022-12-16 23:12:43 +00:00
|
|
|
[src/chatgpt-api-browser.ts:445](https://github.com/transitive-bullshit/chatgpt-api/blob/d685b78/src/chatgpt-api-browser.ts#L445)
|
2022-12-15 23:15:38 +00:00
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
### sendMessage
|
|
|
|
|
|
|
|
▸ **sendMessage**(`message`, `opts?`): `Promise`<`string`\>
|
|
|
|
|
|
|
|
#### Parameters
|
|
|
|
|
|
|
|
| Name | Type |
|
|
|
|
| :------ | :------ |
|
|
|
|
| `message` | `string` |
|
2022-12-16 07:38:20 +00:00
|
|
|
| `opts` | [`SendMessageOptions`](../modules.md#sendmessageoptions) |
|
2022-12-15 23:15:38 +00:00
|
|
|
|
|
|
|
#### Returns
|
|
|
|
|
|
|
|
`Promise`<`string`\>
|
|
|
|
|
|
|
|
#### Defined in
|
|
|
|
|
2022-12-16 23:12:43 +00:00
|
|
|
[src/chatgpt-api-browser.ts:330](https://github.com/transitive-bullshit/chatgpt-api/blob/d685b78/src/chatgpt-api-browser.ts#L330)
|