docs: update auto-generated docs

pull/38/head
Travis Fischer 2022-12-06 18:19:50 -06:00
rodzic c8b3ac7029
commit 52ae3679ec
4 zmienionych plików z 216 dodań i 31 usunięć

Wyświetl plik

@ -11,6 +11,7 @@
### Methods
- [ensureAuth](ChatGPTAPI.md#ensureauth)
- [getConversation](ChatGPTAPI.md#getconversation)
- [getIsAuthenticated](ChatGPTAPI.md#getisauthenticated)
- [refreshAccessToken](ChatGPTAPI.md#refreshaccesstoken)
- [sendMessage](ChatGPTAPI.md#sendmessage)
@ -36,7 +37,7 @@ Creates a new client wrapper around the unofficial ChatGPT REST API.
#### Defined in
[chatgpt-api.ts:31](https://github.com/transitive-bullshit/chatgpt-api/blob/80d77a3/src/chatgpt-api.ts#L31)
[chatgpt-api.ts:32](https://github.com/transitive-bullshit/chatgpt-api/blob/8e045b2/src/chatgpt-api.ts#L32)
## Methods
@ -50,7 +51,34 @@ Creates a new client wrapper around the unofficial ChatGPT REST API.
#### Defined in
[chatgpt-api.ts:74](https://github.com/transitive-bullshit/chatgpt-api/blob/80d77a3/src/chatgpt-api.ts#L74)
[chatgpt-api.ts:75](https://github.com/transitive-bullshit/chatgpt-api/blob/8e045b2/src/chatgpt-api.ts#L75)
___
### getConversation
**getConversation**(`opts?`): [`ChatGPTConversation`](ChatGPTConversation.md)
Gets a new ChatGPTConversation instance, which can be used to send multiple
messages as part of a single conversation.
#### Parameters
| Name | Type | Description |
| :------ | :------ | :------ |
| `opts` | `Object` | - |
| `opts.conversationId?` | `string` | Optional ID of the previous message in a conversation |
| `opts.parentMessageId?` | `string` | Optional ID of the previous message in a conversation |
#### Returns
[`ChatGPTConversation`](ChatGPTConversation.md)
The new conversation instance
#### Defined in
[chatgpt-api.ts:233](https://github.com/transitive-bullshit/chatgpt-api/blob/8e045b2/src/chatgpt-api.ts#L233)
___
@ -64,7 +92,7 @@ ___
#### Defined in
[chatgpt-api.ts:65](https://github.com/transitive-bullshit/chatgpt-api/blob/80d77a3/src/chatgpt-api.ts#L65)
[chatgpt-api.ts:66](https://github.com/transitive-bullshit/chatgpt-api/blob/8e045b2/src/chatgpt-api.ts#L66)
___
@ -78,7 +106,7 @@ ___
#### Defined in
[chatgpt-api.ts:165](https://github.com/transitive-bullshit/chatgpt-api/blob/80d77a3/src/chatgpt-api.ts#L165)
[chatgpt-api.ts:183](https://github.com/transitive-bullshit/chatgpt-api/blob/8e045b2/src/chatgpt-api.ts#L183)
___
@ -93,15 +121,15 @@ the response.
| Name | Type | Description |
| :------ | :------ | :------ |
| `message` | `string` | The plaintext message to send. |
| `opts` | `Object` | - |
| `opts.conversationId?` | `string` | Optional ID of the previous message in a conversation |
| `opts.onProgress?` | (`partialResponse`: `string`) => `void` | - |
| `message` | `string` | The prompt message to send |
| `opts` | [`SendMessageOptions`](../modules.md#sendmessageoptions) | - |
#### Returns
`Promise`<`string`\>
The response from ChatGPT
#### Defined in
[chatgpt-api.ts:86](https://github.com/transitive-bullshit/chatgpt-api/blob/80d77a3/src/chatgpt-api.ts#L86)
[chatgpt-api.ts:92](https://github.com/transitive-bullshit/chatgpt-api/blob/8e045b2/src/chatgpt-api.ts#L92)

Wyświetl plik

@ -0,0 +1,107 @@
[chatgpt](../readme.md) / [Exports](../modules.md) / ChatGPTConversation
# Class: ChatGPTConversation
A conversation wrapper around the ChatGPTAPI. This allows you to send
multiple messages to ChatGPT and receive responses, without having to
manually pass the conversation ID and parent message ID for each message.
## Table of contents
### Constructors
- [constructor](ChatGPTConversation.md#constructor)
### Properties
- [api](ChatGPTConversation.md#api)
- [conversationId](ChatGPTConversation.md#conversationid)
- [parentMessageId](ChatGPTConversation.md#parentmessageid)
### Methods
- [sendMessage](ChatGPTConversation.md#sendmessage)
## Constructors
### constructor
**new ChatGPTConversation**(`api`, `opts?`)
Creates a new conversation wrapper around the ChatGPT API.
#### Parameters
| Name | Type | Description |
| :------ | :------ | :------ |
| `api` | [`ChatGPTAPI`](ChatGPTAPI.md) | The ChatGPT API instance to use |
| `opts` | `Object` | - |
| `opts.conversationId?` | `string` | Optional ID of a conversation to continue |
| `opts.parentMessageId?` | `string` | Optional ID of the previous message in the conversation |
#### Defined in
[chatgpt-conversation.ts:21](https://github.com/transitive-bullshit/chatgpt-api/blob/8e045b2/src/chatgpt-conversation.ts#L21)
## Properties
### api
**api**: [`ChatGPTAPI`](ChatGPTAPI.md)
#### Defined in
[chatgpt-conversation.ts:10](https://github.com/transitive-bullshit/chatgpt-api/blob/8e045b2/src/chatgpt-conversation.ts#L10)
___
### conversationId
**conversationId**: `string` = `undefined`
#### Defined in
[chatgpt-conversation.ts:11](https://github.com/transitive-bullshit/chatgpt-api/blob/8e045b2/src/chatgpt-conversation.ts#L11)
___
### parentMessageId
**parentMessageId**: `string` = `undefined`
#### Defined in
[chatgpt-conversation.ts:12](https://github.com/transitive-bullshit/chatgpt-api/blob/8e045b2/src/chatgpt-conversation.ts#L12)
## Methods
### sendMessage
**sendMessage**(`message`, `opts?`): `Promise`<`string`\>
Sends a message to ChatGPT, waits for the response to resolve, and returns
the response.
If this is the first message in the conversation, the conversation ID and
parent message ID will be automatically set.
This allows you to send multiple messages to ChatGPT and receive responses,
without having to manually pass the conversation ID and parent message ID
for each message.
#### Parameters
| Name | Type | Description |
| :------ | :------ | :------ |
| `message` | `string` | The prompt message to send |
| `opts` | [`SendConversationMessageOptions`](../modules.md#sendconversationmessageoptions) | - |
#### Returns
`Promise`<`string`\>
The response from ChatGPT
#### Defined in
[chatgpt-conversation.ts:48](https://github.com/transitive-bullshit/chatgpt-api/blob/8e045b2/src/chatgpt-conversation.ts#L48)

Wyświetl plik

@ -7,6 +7,7 @@
### Classes
- [ChatGPTAPI](classes/ChatGPTAPI.md)
- [ChatGPTConversation](classes/ChatGPTConversation.md)
### Type Aliases
@ -28,6 +29,8 @@
- [Prompt](modules.md#prompt)
- [PromptContent](modules.md#promptcontent)
- [Role](modules.md#role)
- [SendConversationMessageOptions](modules.md#sendconversationmessageoptions)
- [SendMessageOptions](modules.md#sendmessageoptions)
- [SessionResult](modules.md#sessionresult)
- [User](modules.md#user)
@ -43,7 +46,7 @@
#### Defined in
[types.ts:109](https://github.com/transitive-bullshit/chatgpt-api/blob/80d77a3/src/types.ts#L109)
[types.ts:109](https://github.com/transitive-bullshit/chatgpt-api/blob/8e045b2/src/types.ts#L109)
___
@ -53,7 +56,7 @@ ___
#### Defined in
[types.ts:1](https://github.com/transitive-bullshit/chatgpt-api/blob/80d77a3/src/types.ts#L1)
[types.ts:1](https://github.com/transitive-bullshit/chatgpt-api/blob/8e045b2/src/types.ts#L1)
___
@ -75,7 +78,7 @@ https://chat.openapi.com/backend-api/conversation
#### Defined in
[types.ts:134](https://github.com/transitive-bullshit/chatgpt-api/blob/80d77a3/src/types.ts#L134)
[types.ts:134](https://github.com/transitive-bullshit/chatgpt-api/blob/8e045b2/src/types.ts#L134)
___
@ -93,7 +96,7 @@ ___
#### Defined in
[types.ts:251](https://github.com/transitive-bullshit/chatgpt-api/blob/80d77a3/src/types.ts#L251)
[types.ts:251](https://github.com/transitive-bullshit/chatgpt-api/blob/8e045b2/src/types.ts#L251)
___
@ -118,7 +121,7 @@ ___
#### Defined in
[types.ts:257](https://github.com/transitive-bullshit/chatgpt-api/blob/80d77a3/src/types.ts#L257)
[types.ts:257](https://github.com/transitive-bullshit/chatgpt-api/blob/8e045b2/src/types.ts#L257)
___
@ -135,7 +138,7 @@ ___
#### Defined in
[types.ts:270](https://github.com/transitive-bullshit/chatgpt-api/blob/80d77a3/src/types.ts#L270)
[types.ts:270](https://github.com/transitive-bullshit/chatgpt-api/blob/8e045b2/src/types.ts#L270)
___
@ -157,7 +160,7 @@ https://chat.openapi.com/backend-api/conversation/message_feedback
#### Defined in
[types.ts:193](https://github.com/transitive-bullshit/chatgpt-api/blob/80d77a3/src/types.ts#L193)
[types.ts:193](https://github.com/transitive-bullshit/chatgpt-api/blob/8e045b2/src/types.ts#L193)
___
@ -167,7 +170,7 @@ ___
#### Defined in
[types.ts:249](https://github.com/transitive-bullshit/chatgpt-api/blob/80d77a3/src/types.ts#L249)
[types.ts:249](https://github.com/transitive-bullshit/chatgpt-api/blob/8e045b2/src/types.ts#L249)
___
@ -187,7 +190,7 @@ ___
#### Defined in
[types.ts:222](https://github.com/transitive-bullshit/chatgpt-api/blob/80d77a3/src/types.ts#L222)
[types.ts:222](https://github.com/transitive-bullshit/chatgpt-api/blob/8e045b2/src/types.ts#L222)
___
@ -197,7 +200,7 @@ ___
#### Defined in
[types.ts:220](https://github.com/transitive-bullshit/chatgpt-api/blob/80d77a3/src/types.ts#L220)
[types.ts:220](https://github.com/transitive-bullshit/chatgpt-api/blob/8e045b2/src/types.ts#L220)
___
@ -207,7 +210,7 @@ ___
#### Defined in
[types.ts:275](https://github.com/transitive-bullshit/chatgpt-api/blob/80d77a3/src/types.ts#L275)
[types.ts:275](https://github.com/transitive-bullshit/chatgpt-api/blob/8e045b2/src/types.ts#L275)
___
@ -225,7 +228,7 @@ ___
#### Defined in
[types.ts:77](https://github.com/transitive-bullshit/chatgpt-api/blob/80d77a3/src/types.ts#L77)
[types.ts:77](https://github.com/transitive-bullshit/chatgpt-api/blob/8e045b2/src/types.ts#L77)
___
@ -243,7 +246,7 @@ https://chat.openapi.com/backend-api/models
#### Defined in
[types.ts:70](https://github.com/transitive-bullshit/chatgpt-api/blob/80d77a3/src/types.ts#L70)
[types.ts:70](https://github.com/transitive-bullshit/chatgpt-api/blob/8e045b2/src/types.ts#L70)
___
@ -262,7 +265,7 @@ https://chat.openapi.com/backend-api/moderations
#### Defined in
[types.ts:97](https://github.com/transitive-bullshit/chatgpt-api/blob/80d77a3/src/types.ts#L97)
[types.ts:97](https://github.com/transitive-bullshit/chatgpt-api/blob/8e045b2/src/types.ts#L97)
___
@ -282,7 +285,7 @@ https://chat.openapi.com/backend-api/moderations
#### Defined in
[types.ts:114](https://github.com/transitive-bullshit/chatgpt-api/blob/80d77a3/src/types.ts#L114)
[types.ts:114](https://github.com/transitive-bullshit/chatgpt-api/blob/8e045b2/src/types.ts#L114)
___
@ -300,7 +303,7 @@ ___
#### Defined in
[types.ts:161](https://github.com/transitive-bullshit/chatgpt-api/blob/80d77a3/src/types.ts#L161)
[types.ts:161](https://github.com/transitive-bullshit/chatgpt-api/blob/8e045b2/src/types.ts#L161)
___
@ -317,7 +320,7 @@ ___
#### Defined in
[types.ts:178](https://github.com/transitive-bullshit/chatgpt-api/blob/80d77a3/src/types.ts#L178)
[types.ts:178](https://github.com/transitive-bullshit/chatgpt-api/blob/8e045b2/src/types.ts#L178)
___
@ -327,7 +330,37 @@ ___
#### Defined in
[types.ts:3](https://github.com/transitive-bullshit/chatgpt-api/blob/80d77a3/src/types.ts#L3)
[types.ts:3](https://github.com/transitive-bullshit/chatgpt-api/blob/8e045b2/src/types.ts#L3)
___
### SendConversationMessageOptions
Ƭ **SendConversationMessageOptions**: `Omit`<[`SendMessageOptions`](modules.md#sendmessageoptions), ``"conversationId"`` \| ``"parentMessageId"``\>
#### Defined in
[types.ts:285](https://github.com/transitive-bullshit/chatgpt-api/blob/8e045b2/src/types.ts#L285)
___
### SendMessageOptions
Ƭ **SendMessageOptions**: `Object`
#### Type declaration
| Name | Type |
| :------ | :------ |
| `abortSignal?` | `AbortSignal` |
| `conversationId?` | `string` |
| `onConversationResponse?` | (`response`: [`ConversationResponseEvent`](modules.md#conversationresponseevent)) => `void` |
| `onProgress?` | (`partialResponse`: `string`) => `void` |
| `parentMessageId?` | `string` |
#### Defined in
[types.ts:277](https://github.com/transitive-bullshit/chatgpt-api/blob/8e045b2/src/types.ts#L277)
___
@ -348,7 +381,7 @@ https://chat.openapi.com/api/auth/session
#### Defined in
[types.ts:8](https://github.com/transitive-bullshit/chatgpt-api/blob/80d77a3/src/types.ts#L8)
[types.ts:8](https://github.com/transitive-bullshit/chatgpt-api/blob/8e045b2/src/types.ts#L8)
___
@ -370,7 +403,7 @@ ___
#### Defined in
[types.ts:30](https://github.com/transitive-bullshit/chatgpt-api/blob/80d77a3/src/types.ts#L30)
[types.ts:30](https://github.com/transitive-bullshit/chatgpt-api/blob/8e045b2/src/types.ts#L30)
## Functions
@ -390,4 +423,4 @@ ___
#### Defined in
[utils.ts:4](https://github.com/transitive-bullshit/chatgpt-api/blob/80d77a3/src/utils.ts#L4)
[utils.ts:4](https://github.com/transitive-bullshit/chatgpt-api/blob/8e045b2/src/utils.ts#L4)

Wyświetl plik

@ -15,6 +15,7 @@ chatgpt / [Exports](modules.md)
- [Usage](#usage)
- [Docs](#docs)
- [How it works](#how-it-works)
- [Compatibility](#compatibility)
- [Examples](#examples)
- [Credit](#credit)
- [License](#license)
@ -96,6 +97,19 @@ If you want to run the built-in demo, store this value as `SESSION_TOKEN` in a l
> **Note**
> Prior to v1.0.0, this package used a headless browser via [Playwright](https://playwright.dev/) to automate the web UI. Here are the [docs for the initial browser version](https://github.com/transitive-bullshit/chatgpt-api/tree/v0.4.2).
## Compatibility
This package is ESM-only. It supports:
- Node.js >= 16.8
- If you need Node.js 14 support, use [`v1.4.0`](https://github.com/transitive-bullshit/chatgpt-api/releases/tag/v1.4.0)
- If you need CommonJS support, use [`v1.3.0`](https://github.com/transitive-bullshit/chatgpt-api/releases/tag/v1.3.0)
- Edge runtimes like CF workers and Vercel edge functions
- Modern browsers
- This is mainly intended for chrome extensions where your code is protected to a degree
- **We do not recommend using `chatgpt` from client-side browser code** because it would expose your private session token
- If you want to build a website with `chatgpt`, we recommend using it only from your backend API
## Examples
All of these awesome projects are built using the `chatgpt` package. 🤯
@ -103,13 +117,16 @@ All of these awesome projects are built using the `chatgpt` package. 🤯
- [Twitter Bot](https://github.com/transitive-bullshit/chatgpt-twitter-bot) powered by ChatGPT ✨
- Mention [@ChatGPTBot](https://twitter.com/ChatGPTBot) on Twitter with your prompt to try it out
- [Chrome Extension](https://github.com/gragland/chatgpt-everywhere) ([demo](https://twitter.com/gabe_ragland/status/1599466486422470656))
- [VSCode Extension](https://github.com/mpociot/chatgpt-vscode) ([demo](https://twitter.com/marcelpociot/status/1599180144551526400))
- [VSCode Extension #1](https://github.com/mpociot/chatgpt-vscode) ([demo](https://twitter.com/marcelpociot/status/1599180144551526400))
- [VSCode Extension #2](https://github.com/barnesoir/chatgpt-vscode-plugin)
- [Raycast Extension](https://github.com/abielzulio/chatgpt-raycast) ([demo](https://twitter.com/abielzulio/status/1600176002042191875))
- [Go Telegram Bot](https://github.com/m1guelpf/chatgpt-telegram)
- [GitHub ProBot](https://github.com/oceanlvr/ChatGPTBot)
- [Discord Bot](https://github.com/onury5506/Discord-ChatGPT-Bot)
- [WeChat Bot](https://github.com/AutumnWhj/ChatGPT-wechat-bot)
- [Lovelines.xyz](https://lovelines.xyz)
- [EXM smart contracts](https://github.com/decentldotland/molecule)
- [Flutter ChatGPT API](https://github.com/coskuncay/flutter_chatgpt_api)
If you create a cool integration, feel free to open a PR and add it to the list.