chore: update ts docs

chatgpt-api
Travis Fischer 2023-02-14 00:31:49 -06:00
rodzic cce73016ab
commit d39f4fa4a9
6 zmienionych plików z 77 dodań i 18 usunięć

Wyświetl plik

@ -8,6 +8,10 @@
- [constructor](ChatGPTAPI.md#constructor)
### Accessors
- [apiKey](ChatGPTAPI.md#apikey)
### Methods
- [sendMessage](ChatGPTAPI.md#sendmessage)
@ -28,9 +32,11 @@ unofficial ChatGPT model.
| `opts` | `Object` | - |
| `opts.apiBaseUrl?` | `string` | **`Default Value`** `'https://api.openai.com'` * |
| `opts.apiKey` | `string` | - |
| `opts.apiReverseProxyUrl?` | `string` | **`Default Value`** `undefined` * |
| `opts.assistantLabel?` | `string` | **`Default Value`** `'ChatGPT'` * |
| `opts.completionParams?` | `Partial`<[`CompletionParams`](../modules/openai.md#completionparams)\> | - |
| `opts.debug?` | `boolean` | **`Default Value`** `false` * |
| `opts.fetch?` | (`input`: `RequestInfo` \| `URL`, `init?`: `RequestInit`) => `Promise`<`Response`\> | - |
| `opts.getMessageById?` | [`GetMessageByIdFunction`](../modules.md#getmessagebyidfunction) | - |
| `opts.maxModelTokens?` | `number` | **`Default Value`** `4096` * |
| `opts.maxResponseTokens?` | `number` | **`Default Value`** `1000` * |
@ -40,7 +46,37 @@ unofficial ChatGPT model.
#### Defined in
[src/chatgpt-api.ts:48](https://github.com/transitive-bullshit/chatgpt-api/blob/aefae23/src/chatgpt-api.ts#L48)
[src/chatgpt-api.ts:53](https://github.com/transitive-bullshit/chatgpt-api/blob/4379d52/src/chatgpt-api.ts#L53)
## Accessors
### apiKey
`get` **apiKey**(): `string`
#### Returns
`string`
#### Defined in
[src/chatgpt-api.ts:353](https://github.com/transitive-bullshit/chatgpt-api/blob/4379d52/src/chatgpt-api.ts#L353)
`set` **apiKey**(`apiKey`): `void`
#### Parameters
| Name | Type |
| :------ | :------ |
| `apiKey` | `string` |
#### Returns
`void`
#### Defined in
[src/chatgpt-api.ts:357](https://github.com/transitive-bullshit/chatgpt-api/blob/4379d52/src/chatgpt-api.ts#L357)
## Methods
@ -75,4 +111,4 @@ The response from ChatGPT
#### Defined in
[src/chatgpt-api.ts:146](https://github.com/transitive-bullshit/chatgpt-api/blob/aefae23/src/chatgpt-api.ts#L146)
[src/chatgpt-api.ts:185](https://github.com/transitive-bullshit/chatgpt-api/blob/4379d52/src/chatgpt-api.ts#L185)

Wyświetl plik

@ -64,7 +64,7 @@ node_modules/.pnpm/typescript@4.9.5/node_modules/typescript/lib/lib.es2022.error
#### Defined in
[src/types.ts:24](https://github.com/transitive-bullshit/chatgpt-api/blob/aefae23/src/types.ts#L24)
[src/types.ts:27](https://github.com/transitive-bullshit/chatgpt-api/blob/4379d52/src/types.ts#L27)
___
@ -74,4 +74,4 @@ ___
#### Defined in
[src/types.ts:25](https://github.com/transitive-bullshit/chatgpt-api/blob/aefae23/src/types.ts#L25)
[src/types.ts:28](https://github.com/transitive-bullshit/chatgpt-api/blob/4379d52/src/types.ts#L28)

Wyświetl plik

@ -7,6 +7,7 @@
### Properties
- [conversationId](ChatMessage.md#conversationid)
- [detail](ChatMessage.md#detail)
- [id](ChatMessage.md#id)
- [parentMessageId](ChatMessage.md#parentmessageid)
- [role](ChatMessage.md#role)
@ -20,7 +21,17 @@
#### Defined in
[src/types.ts:20](https://github.com/transitive-bullshit/chatgpt-api/blob/aefae23/src/types.ts#L20)
[src/types.ts:22](https://github.com/transitive-bullshit/chatgpt-api/blob/4379d52/src/types.ts#L22)
___
### detail
`Optional` **detail**: `any`
#### Defined in
[src/types.ts:23](https://github.com/transitive-bullshit/chatgpt-api/blob/4379d52/src/types.ts#L23)
___
@ -30,7 +41,7 @@ ___
#### Defined in
[src/types.ts:16](https://github.com/transitive-bullshit/chatgpt-api/blob/aefae23/src/types.ts#L16)
[src/types.ts:18](https://github.com/transitive-bullshit/chatgpt-api/blob/4379d52/src/types.ts#L18)
___
@ -40,7 +51,7 @@ ___
#### Defined in
[src/types.ts:19](https://github.com/transitive-bullshit/chatgpt-api/blob/aefae23/src/types.ts#L19)
[src/types.ts:21](https://github.com/transitive-bullshit/chatgpt-api/blob/4379d52/src/types.ts#L21)
___
@ -50,7 +61,7 @@ ___
#### Defined in
[src/types.ts:18](https://github.com/transitive-bullshit/chatgpt-api/blob/aefae23/src/types.ts#L18)
[src/types.ts:20](https://github.com/transitive-bullshit/chatgpt-api/blob/4379d52/src/types.ts#L20)
___
@ -60,4 +71,4 @@ ___
#### Defined in
[src/types.ts:17](https://github.com/transitive-bullshit/chatgpt-api/blob/aefae23/src/types.ts#L17)
[src/types.ts:19](https://github.com/transitive-bullshit/chatgpt-api/blob/4379d52/src/types.ts#L19)

Wyświetl plik

@ -19,6 +19,7 @@
### Type Aliases
- [FetchFn](modules.md#fetchfn)
- [GetMessageByIdFunction](modules.md#getmessagebyidfunction)
- [Role](modules.md#role)
- [SendMessageOptions](modules.md#sendmessageoptions)
@ -26,6 +27,16 @@
## Type Aliases
### FetchFn
Ƭ **FetchFn**: typeof `fetch`
#### Defined in
[src/types.ts:3](https://github.com/transitive-bullshit/chatgpt-api/blob/4379d52/src/types.ts#L3)
___
### GetMessageByIdFunction
Ƭ **GetMessageByIdFunction**: (`id`: `string`) => `Promise`<[`ChatMessage`](interfaces/ChatMessage.md)\>
@ -48,7 +59,7 @@ Returns a chat message from a store by it's ID (or null if not found).
#### Defined in
[src/types.ts:29](https://github.com/transitive-bullshit/chatgpt-api/blob/aefae23/src/types.ts#L29)
[src/types.ts:32](https://github.com/transitive-bullshit/chatgpt-api/blob/4379d52/src/types.ts#L32)
___
@ -58,7 +69,7 @@ ___
#### Defined in
[src/types.ts:1](https://github.com/transitive-bullshit/chatgpt-api/blob/aefae23/src/types.ts#L1)
[src/types.ts:1](https://github.com/transitive-bullshit/chatgpt-api/blob/4379d52/src/types.ts#L1)
___
@ -82,7 +93,7 @@ ___
#### Defined in
[src/types.ts:3](https://github.com/transitive-bullshit/chatgpt-api/blob/aefae23/src/types.ts#L3)
[src/types.ts:5](https://github.com/transitive-bullshit/chatgpt-api/blob/4379d52/src/types.ts#L5)
___
@ -108,4 +119,4 @@ Upserts a chat message to a store.
#### Defined in
[src/types.ts:32](https://github.com/transitive-bullshit/chatgpt-api/blob/aefae23/src/types.ts#L32)
[src/types.ts:35](https://github.com/transitive-bullshit/chatgpt-api/blob/4379d52/src/types.ts#L35)

Wyświetl plik

@ -38,7 +38,7 @@
#### Defined in
[src/types.ts:35](https://github.com/transitive-bullshit/chatgpt-api/blob/aefae23/src/types.ts#L35)
[src/types.ts:38](https://github.com/transitive-bullshit/chatgpt-api/blob/4379d52/src/types.ts#L38)
___
@ -59,7 +59,7 @@ ___
#### Defined in
[src/types.ts:117](https://github.com/transitive-bullshit/chatgpt-api/blob/aefae23/src/types.ts#L117)
[src/types.ts:120](https://github.com/transitive-bullshit/chatgpt-api/blob/4379d52/src/types.ts#L120)
___
@ -69,7 +69,7 @@ ___
#### Defined in
[src/types.ts:126](https://github.com/transitive-bullshit/chatgpt-api/blob/aefae23/src/types.ts#L126)
[src/types.ts:129](https://github.com/transitive-bullshit/chatgpt-api/blob/4379d52/src/types.ts#L129)
___
@ -87,4 +87,4 @@ ___
#### Defined in
[src/types.ts:138](https://github.com/transitive-bullshit/chatgpt-api/blob/aefae23/src/types.ts#L138)
[src/types.ts:141](https://github.com/transitive-bullshit/chatgpt-api/blob/4379d52/src/types.ts#L141)

Wyświetl plik

@ -106,7 +106,6 @@ console.log(res.text)
You can add streaming via the `onProgress` handler:
```ts
// timeout after 2 minutes (which will also abort the underlying HTTP request)
const res = await api.sendMessage('Write a 500 word essay on frogs.', {
// print the partial response as the AI is "typing"
onProgress: (partialResponse) => console.log(partialResponse.text)
@ -255,6 +254,7 @@ All of these awesome projects are built using the `chatgpt` package. 🤯
- [WhatsApp Bot #2](https://github.com/amosayomide05/chatgpt-whatsapp-bot)
- [WhatsApp Bot #3](https://github.com/navopw/whatsapp-chatgpt)
- [WhatsApp Bot #4](https://github.com/noelzappy/chatgpt-whatsapp) (schedule periodic messages)
- [WhatsApp Bot #5](https://github.com/hujanais/bs-chat-gpt3-api) (RaspberryPi + ngrok + Twilio)
- [Matrix Bot](https://github.com/matrixgpt/matrix-chatgpt-bot)
- [Rental Cover Letter Generator](https://sharehouse.app/ai)
- [Assistant CLI](https://github.com/diciaup/assistant-cli)
@ -278,6 +278,7 @@ All of these awesome projects are built using the `chatgpt` package. 🤯
- [QuizGPT: Create Kahoot quizzes with ChatGPT](https://github.com/Kladdy/quizgpt)
- [openai-chatgpt: Talk to ChatGPT from the terminal](https://github.com/gmpetrov/openai-chatgpt)
- [Clippy the Saleforce chatbot](https://github.com/sebas00/chatgptclippy) ClippyJS joke bot
- [ai-assistant](https://github.com/youking-lib/ai-assistant) Chat assistant
If you create a cool integration, feel free to open a PR and add it to the list.