From 9526542e50c04fe183fe5d1c8d7a1cd00d5911f9 Mon Sep 17 00:00:00 2001 From: Jin <439661734@qq.com> Date: Tue, 6 Dec 2022 09:11:56 +0800 Subject: [PATCH 01/12] doc: add Wechat Bot to examples list --- readme.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/readme.md b/readme.md index 1d501a4..dcbff7b 100644 --- a/readme.md +++ b/readme.md @@ -107,6 +107,8 @@ All of these awesome projects are built using the `chatgpt` package. 🤯 - [Discord Bot](https://github.com/onury5506/Discord-ChatGPT-Bot) - [Lovelines.xyz](https://lovelines.xyz) - [EXM smart contracts](https://github.com/decentldotland/molecule) +- [Wechat Bot](https://github.com/AutumnWhj/ChatGPT-wechat-bot) + - ChatGPT webchart bot is a WeChat assistant based on NodeJS and webchaty If you create a cool integration, feel free to open a PR and add it to the list. From 700cb68c80358c40310700fbfde0d7d043e14244 Mon Sep 17 00:00:00 2001 From: ItzBlinkzy Date: Tue, 6 Dec 2022 03:52:37 +0000 Subject: [PATCH 02/12] Replaced typo converstationId with conversationId --- docs/classes/ChatGPTAPI.md | 2 +- src/chatgpt-api.ts | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/classes/ChatGPTAPI.md b/docs/classes/ChatGPTAPI.md index 1c54cf9..76eb5f5 100644 --- a/docs/classes/ChatGPTAPI.md +++ b/docs/classes/ChatGPTAPI.md @@ -95,7 +95,7 @@ the response. | :------ | :------ | :------ | | `message` | `string` | The plaintext message to send. | | `opts` | `Object` | - | -| `opts.converstationId?` | `string` | - | +| `opts.conversationId?` | `string` | - | | `opts.onProgress?` | (`partialResponse`: `string`) => `void` | - | #### Returns diff --git a/src/chatgpt-api.ts b/src/chatgpt-api.ts index 594d860..7598960 100644 --- a/src/chatgpt-api.ts +++ b/src/chatgpt-api.ts @@ -86,11 +86,11 @@ export class ChatGPTAPI { async sendMessage( message: string, opts: { - converstationId?: string + conversationId?: string onProgress?: (partialResponse: string) => void } = {} ): Promise { - const { converstationId = uuidv4(), onProgress } = opts + const { conversationId = uuidv4(), onProgress } = opts const accessToken = await this.refreshAccessToken() @@ -107,7 +107,7 @@ export class ChatGPTAPI { } ], model: 'text-davinci-002-render', - parent_message_id: converstationId + parent_message_id: conversationId } const url = `${this._backendApiBaseUrl}/conversation` From 4ac583b9f70e268390a91b97f8911bb0b4df2e81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wang=20D=C3=A0p=C3=A9ng?= Date: Tue, 6 Dec 2022 12:17:59 +0800 Subject: [PATCH 03/12] Add link to wong2/chat-gpt-google-extension --- readme.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/readme.md b/readme.md index 1d501a4..ef6438a 100644 --- a/readme.md +++ b/readme.md @@ -112,8 +112,9 @@ If you create a cool integration, feel free to open a PR and add it to the list. ## Credit -- Huge thanks to [@RomanHotsiy](https://github.com/RomanHotsiy), [@ElijahPepe](https://github.com/ElijahPepe), [@wong2](https://github.com/wong2), and all the other contributors 💪 +- Huge thanks to [@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) +- Thew new version takes code for ChatGPT API request from [chat-gpt-google-extension](https://github.com/wong2/chat-gpt-google-extension) by [@wong2](https://github.com/wong2) ## License From c41fee9aae7c367aaf975cd26c80a9f081b66d77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wang=20D=C3=A0p=C3=A9ng?= Date: Tue, 6 Dec 2022 12:19:56 +0800 Subject: [PATCH 04/12] Fix typo --- readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.md b/readme.md index ef6438a..388684e 100644 --- a/readme.md +++ b/readme.md @@ -114,7 +114,7 @@ If you create a cool integration, feel free to open a PR and add it to the list. - Huge thanks to [@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) -- Thew new version takes code for ChatGPT API request from [chat-gpt-google-extension](https://github.com/wong2/chat-gpt-google-extension) by [@wong2](https://github.com/wong2) +- The new version takes code for ChatGPT API request from [chat-gpt-google-extension](https://github.com/wong2/chat-gpt-google-extension) by [@wong2](https://github.com/wong2) ## License From 56c71299ca38a8b397979700420401c827f857da Mon Sep 17 00:00:00 2001 From: Travis Fischer Date: Mon, 5 Dec 2022 22:53:20 -0600 Subject: [PATCH 05/12] chore: update docs --- docs/classes/ChatGPTAPI.md | 12 ++++---- docs/modules.md | 45 ++++++++++++++------------- docs/readme.md | 63 +++++++++++++++++++------------------- 3 files changed, 60 insertions(+), 60 deletions(-) diff --git a/docs/classes/ChatGPTAPI.md b/docs/classes/ChatGPTAPI.md index 76eb5f5..a0e1e2d 100644 --- a/docs/classes/ChatGPTAPI.md +++ b/docs/classes/ChatGPTAPI.md @@ -36,7 +36,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/c9cef79/src/chatgpt-api.ts#L31) +[chatgpt-api.ts:31](https://github.com/transitive-bullshit/chatgpt-api/blob/cf5e775/src/chatgpt-api.ts#L31) ## Methods @@ -50,7 +50,7 @@ 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/c9cef79/src/chatgpt-api.ts#L74) +[chatgpt-api.ts:74](https://github.com/transitive-bullshit/chatgpt-api/blob/cf5e775/src/chatgpt-api.ts#L74) ___ @@ -64,7 +64,7 @@ ___ #### Defined in -[chatgpt-api.ts:65](https://github.com/transitive-bullshit/chatgpt-api/blob/c9cef79/src/chatgpt-api.ts#L65) +[chatgpt-api.ts:65](https://github.com/transitive-bullshit/chatgpt-api/blob/cf5e775/src/chatgpt-api.ts#L65) ___ @@ -78,7 +78,7 @@ ___ #### Defined in -[chatgpt-api.ts:165](https://github.com/transitive-bullshit/chatgpt-api/blob/c9cef79/src/chatgpt-api.ts#L165) +[chatgpt-api.ts:165](https://github.com/transitive-bullshit/chatgpt-api/blob/cf5e775/src/chatgpt-api.ts#L165) ___ @@ -95,7 +95,7 @@ the response. | :------ | :------ | :------ | | `message` | `string` | The plaintext message to send. | | `opts` | `Object` | - | -| `opts.conversationId?` | `string` | - | +| `opts.conversationId?` | `string` | Optional ID of the previous message in a conversation | | `opts.onProgress?` | (`partialResponse`: `string`) => `void` | - | #### Returns @@ -104,4 +104,4 @@ the response. #### Defined in -[chatgpt-api.ts:86](https://github.com/transitive-bullshit/chatgpt-api/blob/c9cef79/src/chatgpt-api.ts#L86) +[chatgpt-api.ts:86](https://github.com/transitive-bullshit/chatgpt-api/blob/cf5e775/src/chatgpt-api.ts#L86) diff --git a/docs/modules.md b/docs/modules.md index 388a9b2..8a7b224 100644 --- a/docs/modules.md +++ b/docs/modules.md @@ -43,7 +43,7 @@ #### Defined in -[types.ts:104](https://github.com/transitive-bullshit/chatgpt-api/blob/c9cef79/src/types.ts#L104) +[types.ts:109](https://github.com/transitive-bullshit/chatgpt-api/blob/cf5e775/src/types.ts#L109) ___ @@ -53,7 +53,7 @@ ___ #### Defined in -[types.ts:1](https://github.com/transitive-bullshit/chatgpt-api/blob/c9cef79/src/types.ts#L1) +[types.ts:1](https://github.com/transitive-bullshit/chatgpt-api/blob/cf5e775/src/types.ts#L1) ___ @@ -75,7 +75,7 @@ https://chat.openapi.com/backend-api/conversation #### Defined in -[types.ts:129](https://github.com/transitive-bullshit/chatgpt-api/blob/c9cef79/src/types.ts#L129) +[types.ts:134](https://github.com/transitive-bullshit/chatgpt-api/blob/cf5e775/src/types.ts#L134) ___ @@ -93,7 +93,7 @@ ___ #### Defined in -[types.ts:246](https://github.com/transitive-bullshit/chatgpt-api/blob/c9cef79/src/types.ts#L246) +[types.ts:251](https://github.com/transitive-bullshit/chatgpt-api/blob/cf5e775/src/types.ts#L251) ___ @@ -118,7 +118,7 @@ ___ #### Defined in -[types.ts:252](https://github.com/transitive-bullshit/chatgpt-api/blob/c9cef79/src/types.ts#L252) +[types.ts:257](https://github.com/transitive-bullshit/chatgpt-api/blob/cf5e775/src/types.ts#L257) ___ @@ -135,7 +135,7 @@ ___ #### Defined in -[types.ts:265](https://github.com/transitive-bullshit/chatgpt-api/blob/c9cef79/src/types.ts#L265) +[types.ts:270](https://github.com/transitive-bullshit/chatgpt-api/blob/cf5e775/src/types.ts#L270) ___ @@ -157,7 +157,7 @@ https://chat.openapi.com/backend-api/conversation/message_feedback #### Defined in -[types.ts:188](https://github.com/transitive-bullshit/chatgpt-api/blob/c9cef79/src/types.ts#L188) +[types.ts:193](https://github.com/transitive-bullshit/chatgpt-api/blob/cf5e775/src/types.ts#L193) ___ @@ -167,7 +167,7 @@ ___ #### Defined in -[types.ts:244](https://github.com/transitive-bullshit/chatgpt-api/blob/c9cef79/src/types.ts#L244) +[types.ts:249](https://github.com/transitive-bullshit/chatgpt-api/blob/cf5e775/src/types.ts#L249) ___ @@ -187,7 +187,7 @@ ___ #### Defined in -[types.ts:217](https://github.com/transitive-bullshit/chatgpt-api/blob/c9cef79/src/types.ts#L217) +[types.ts:222](https://github.com/transitive-bullshit/chatgpt-api/blob/cf5e775/src/types.ts#L222) ___ @@ -197,7 +197,7 @@ ___ #### Defined in -[types.ts:215](https://github.com/transitive-bullshit/chatgpt-api/blob/c9cef79/src/types.ts#L215) +[types.ts:220](https://github.com/transitive-bullshit/chatgpt-api/blob/cf5e775/src/types.ts#L220) ___ @@ -207,7 +207,7 @@ ___ #### Defined in -[types.ts:270](https://github.com/transitive-bullshit/chatgpt-api/blob/c9cef79/src/types.ts#L270) +[types.ts:275](https://github.com/transitive-bullshit/chatgpt-api/blob/cf5e775/src/types.ts#L275) ___ @@ -225,7 +225,7 @@ ___ #### Defined in -[types.ts:72](https://github.com/transitive-bullshit/chatgpt-api/blob/c9cef79/src/types.ts#L72) +[types.ts:77](https://github.com/transitive-bullshit/chatgpt-api/blob/cf5e775/src/types.ts#L77) ___ @@ -243,7 +243,7 @@ https://chat.openapi.com/backend-api/models #### Defined in -[types.ts:65](https://github.com/transitive-bullshit/chatgpt-api/blob/c9cef79/src/types.ts#L65) +[types.ts:70](https://github.com/transitive-bullshit/chatgpt-api/blob/cf5e775/src/types.ts#L70) ___ @@ -262,7 +262,7 @@ https://chat.openapi.com/backend-api/moderations #### Defined in -[types.ts:92](https://github.com/transitive-bullshit/chatgpt-api/blob/c9cef79/src/types.ts#L92) +[types.ts:97](https://github.com/transitive-bullshit/chatgpt-api/blob/cf5e775/src/types.ts#L97) ___ @@ -282,7 +282,7 @@ https://chat.openapi.com/backend-api/moderations #### Defined in -[types.ts:109](https://github.com/transitive-bullshit/chatgpt-api/blob/c9cef79/src/types.ts#L109) +[types.ts:114](https://github.com/transitive-bullshit/chatgpt-api/blob/cf5e775/src/types.ts#L114) ___ @@ -300,7 +300,7 @@ ___ #### Defined in -[types.ts:156](https://github.com/transitive-bullshit/chatgpt-api/blob/c9cef79/src/types.ts#L156) +[types.ts:161](https://github.com/transitive-bullshit/chatgpt-api/blob/cf5e775/src/types.ts#L161) ___ @@ -317,7 +317,7 @@ ___ #### Defined in -[types.ts:173](https://github.com/transitive-bullshit/chatgpt-api/blob/c9cef79/src/types.ts#L173) +[types.ts:178](https://github.com/transitive-bullshit/chatgpt-api/blob/cf5e775/src/types.ts#L178) ___ @@ -327,7 +327,7 @@ ___ #### Defined in -[types.ts:3](https://github.com/transitive-bullshit/chatgpt-api/blob/c9cef79/src/types.ts#L3) +[types.ts:3](https://github.com/transitive-bullshit/chatgpt-api/blob/cf5e775/src/types.ts#L3) ___ @@ -342,12 +342,13 @@ https://chat.openapi.com/api/auth/session | Name | Type | Description | | :------ | :------ | :------ | | `accessToken` | `string` | The access token | +| `error?` | `string` \| ``null`` | If there was an error associated with this request | | `expires` | `string` | ISO date of the expiration date of the access token | -| `user` | [`User`](modules.md#user) | Object of the current user | +| `user` | [`User`](modules.md#user) | Authenticated user | #### Defined in -[types.ts:8](https://github.com/transitive-bullshit/chatgpt-api/blob/c9cef79/src/types.ts#L8) +[types.ts:8](https://github.com/transitive-bullshit/chatgpt-api/blob/cf5e775/src/types.ts#L8) ___ @@ -369,7 +370,7 @@ ___ #### Defined in -[types.ts:25](https://github.com/transitive-bullshit/chatgpt-api/blob/c9cef79/src/types.ts#L25) +[types.ts:30](https://github.com/transitive-bullshit/chatgpt-api/blob/cf5e775/src/types.ts#L30) ## Functions @@ -389,4 +390,4 @@ ___ #### Defined in -[utils.ts:4](https://github.com/transitive-bullshit/chatgpt-api/blob/c9cef79/src/utils.ts#L4) +[utils.ts:4](https://github.com/transitive-bullshit/chatgpt-api/blob/cf5e775/src/utils.ts#L4) diff --git a/docs/readme.md b/docs/readme.md index 3208a7d..2a41923 100644 --- a/docs/readme.md +++ b/docs/readme.md @@ -11,10 +11,10 @@ chatgpt / [Exports](modules.md) [![NPM](https://img.shields.io/npm/v/chatgpt.svg)](https://www.npmjs.com/package/chatgpt) [![Build Status](https://github.com/transitive-bullshit/chatgpt-api/actions/workflows/test.yml/badge.svg)](https://github.com/transitive-bullshit/chatgpt-api/actions/workflows/test.yml) [![MIT License](https://img.shields.io/badge/license-MIT-blue)](https://github.com/transitive-bullshit/chatgpt-api/blob/main/license) [![Prettier Code Formatting](https://img.shields.io/badge/code_style-prettier-brightgreen.svg)](https://prettier.io) - [Intro](#intro) -- [How it works](#how-it-works) - [Install](#install) - [Usage](#usage) - [Docs](#docs) +- [How it works](#how-it-works) - [Examples](#examples) - [Credit](#credit) - [License](#license) @@ -25,34 +25,10 @@ This package is a Node.js wrapper around [ChatGPT](https://openai.com/blog/chatg You can use it to start building projects powered by ChatGPT like chatbots, websites, etc... -## How it works - -This package requires a valid session token from ChatGPT to access it's unofficial REST API. - -To get a session token: - -1. Go to https://chat.openai.com/chat and log in or sign up. -2. Open dev tools. -3. Open `Application` > `Cookies`. - ![ChatGPT cookies](./media/session-token.png) -4. Copy the value for `__Secure-next-auth.session-token` and save it to your environment. - -If you want to run the built-in demo, store this value as `SESSION_TOKEN` in a local `.env` file. - -> **Note** -> This package will switch to using the official API once it's released. - -> **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). - ## Install ```bash -npm install --save chatgpt -# or -yarn add chatgpt -# or -pnpm add chatgpt +npm install chatgpt ``` ## Usage @@ -61,9 +37,10 @@ pnpm add chatgpt import { ChatGPTAPI } from 'chatgpt' async function example() { + // sessionToken is required; see below for details const api = new ChatGPTAPI({ sessionToken: process.env.SESSION_TOKEN }) - // ensure the API is properly authenticated (optional) + // ensure the API is properly authenticated await api.ensureAuth() // send a message and wait for the response @@ -85,31 +62,53 @@ const api = new ChatGPTAPI({ }) ``` -A full [example](./src/example.ts) is included for testing purposes: +A full [demo](./src/demo.ts) is included for testing purposes: ```bash # 1. clone repo # 2. install node deps # 3. set `SESSION_TOKEN` in .env # 4. run: -npx tsx src/example.ts +npx tsx src/demo.ts ``` ## Docs See the [auto-generated docs](./docs/classes/ChatGPTAPI.md) for more info on methods and parameters. +## How it works + +**This package requires a valid session token from ChatGPT to access it's unofficial REST API.** + +To get a session token: + +1. Go to https://chat.openai.com/chat and log in or sign up. +2. Open dev tools. +3. Open `Application` > `Cookies`. + ![ChatGPT cookies](./media/session-token.png) +4. Copy the value for `__Secure-next-auth.session-token` and save it to your environment. + +If you want to run the built-in demo, store this value as `SESSION_TOKEN` in a local `.env` file. + +> **Note** +> This package will switch to using the official API once it's released. + +> **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). + ## Examples -All of these awesome projects use the `chatgpt` package. 🤯 +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)) - [Go Telegram Bot](https://github.com/m1guelpf/chatgpt-telegram) -- [Github ProBot](https://github.com/oceanlvr/ChatGPTBot) +- [GitHub ProBot](https://github.com/oceanlvr/ChatGPTBot) +- [Discord Bot](https://github.com/onury5506/Discord-ChatGPT-Bot) - [Lovelines.xyz](https://lovelines.xyz) +- [EXM smart contracts](https://github.com/decentldotland/molecule) If you create a cool integration, feel free to open a PR and add it to the list. @@ -122,4 +121,4 @@ If you create a cool integration, feel free to open a PR and add it to the list. MIT © [Travis Fischer](https://transitivebullsh.it) -Support my open source work by following me on twitter twitter +If you found this project interesting, please consider supporting my open source work by [sponsoring me](https://github.com/sponsors/transitive-bullshit) or following me on twitter twitter From 1c37fd6d6b3503626cc24ec64c09cf0c4fb54891 Mon Sep 17 00:00:00 2001 From: Travis Fischer Date: Mon, 5 Dec 2022 22:56:41 -0600 Subject: [PATCH 06/12] =?UTF-8?q?=F0=9F=99=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.md b/readme.md index 388684e..d6402bb 100644 --- a/readme.md +++ b/readme.md @@ -114,7 +114,7 @@ If you create a cool integration, feel free to open a PR and add it to the list. - Huge thanks to [@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) -- The new version takes code for ChatGPT API request from [chat-gpt-google-extension](https://github.com/wong2/chat-gpt-google-extension) by [@wong2](https://github.com/wong2) +- The original REST version was inspired by [chat-gpt-google-extension](https://github.com/wong2/chat-gpt-google-extension) by [@wong2](https://github.com/wong2) ## License From b8cbfae669eb56b4e26e8edd70e6d121f8ce92e6 Mon Sep 17 00:00:00 2001 From: Travis Fischer Date: Mon, 5 Dec 2022 22:58:50 -0600 Subject: [PATCH 07/12] Update readme.md --- readme.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/readme.md b/readme.md index dcbff7b..2d4486c 100644 --- a/readme.md +++ b/readme.md @@ -105,10 +105,9 @@ All of these awesome projects are built using the `chatgpt` package. 🤯 - [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) -- [Wechat Bot](https://github.com/AutumnWhj/ChatGPT-wechat-bot) - - ChatGPT webchart bot is a WeChat assistant based on NodeJS and webchaty If you create a cool integration, feel free to open a PR and add it to the list. From 7111542714ed69bcf3884e3ec551adbf194fc5f1 Mon Sep 17 00:00:00 2001 From: Travis Fischer Date: Mon, 5 Dec 2022 23:05:24 -0600 Subject: [PATCH 08/12] test: adjust unit test timeouts --- src/chatgpt-api.test.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/chatgpt-api.test.ts b/src/chatgpt-api.test.ts index bacee3b..ea0bd18 100644 --- a/src/chatgpt-api.test.ts +++ b/src/chatgpt-api.test.ts @@ -8,6 +8,8 @@ dotenv.config() const isCI = !!process.env.CI test('ChatGPTAPI invalid session token', async (t) => { + t.timeout(30 * 1000) // 30 seconds + t.throws(() => new ChatGPTAPI({ sessionToken: null }), { message: 'ChatGPT invalid session token' }) @@ -51,6 +53,7 @@ test('ChatGPTAPI valid session token', async (t) => { if (!isCI) { test('ChatGPTAPI expired session token', async (t) => { + t.timeout(30 * 1000) // 30 seconds const expiredSessionToken = process.env.TEST_EXPIRED_SESSION_TOKEN await t.throwsAsync( From a84826f29bdb5987c86c95061a95600eb81b53a0 Mon Sep 17 00:00:00 2001 From: Travis Fischer Date: Mon, 5 Dec 2022 23:58:00 -0600 Subject: [PATCH 09/12] 1.2.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 6a1eaba..7fc5702 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "chatgpt", - "version": "1.2.0", + "version": "1.2.1", "description": "Node.js client for the unofficial ChatGPT API.", "author": "Travis Fischer ", "repository": "transitive-bullshit/chatgpt-api", From 343157c2669be93cacea88209641518da792b884 Mon Sep 17 00:00:00 2001 From: Abi Raja Date: Tue, 6 Dec 2022 12:12:06 +0530 Subject: [PATCH 10/12] put default export as the last in package.json --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 7fc5702..3947b55 100644 --- a/package.json +++ b/package.json @@ -11,8 +11,8 @@ "exports": { ".": { "import": "./build/index.js", - "default": "./build/index.js", - "types": "./build/index.d.ts" + "types": "./build/index.d.ts", + "default": "./build/index.js" } }, "files": [ From 445b1e48ef622dee064430a48f3753cdec3e82bf Mon Sep 17 00:00:00 2001 From: Travis Fischer Date: Tue, 6 Dec 2022 02:40:40 -0600 Subject: [PATCH 11/12] chore: update docs --- docs/classes/ChatGPTAPI.md | 10 ++++----- docs/modules.md | 42 +++++++++++++++++++------------------- docs/readme.md | 4 +++- 3 files changed, 29 insertions(+), 27 deletions(-) diff --git a/docs/classes/ChatGPTAPI.md b/docs/classes/ChatGPTAPI.md index a0e1e2d..35c6b7a 100644 --- a/docs/classes/ChatGPTAPI.md +++ b/docs/classes/ChatGPTAPI.md @@ -36,7 +36,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/cf5e775/src/chatgpt-api.ts#L31) +[chatgpt-api.ts:31](https://github.com/transitive-bullshit/chatgpt-api/blob/80d77a3/src/chatgpt-api.ts#L31) ## Methods @@ -50,7 +50,7 @@ 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/cf5e775/src/chatgpt-api.ts#L74) +[chatgpt-api.ts:74](https://github.com/transitive-bullshit/chatgpt-api/blob/80d77a3/src/chatgpt-api.ts#L74) ___ @@ -64,7 +64,7 @@ ___ #### Defined in -[chatgpt-api.ts:65](https://github.com/transitive-bullshit/chatgpt-api/blob/cf5e775/src/chatgpt-api.ts#L65) +[chatgpt-api.ts:65](https://github.com/transitive-bullshit/chatgpt-api/blob/80d77a3/src/chatgpt-api.ts#L65) ___ @@ -78,7 +78,7 @@ ___ #### Defined in -[chatgpt-api.ts:165](https://github.com/transitive-bullshit/chatgpt-api/blob/cf5e775/src/chatgpt-api.ts#L165) +[chatgpt-api.ts:165](https://github.com/transitive-bullshit/chatgpt-api/blob/80d77a3/src/chatgpt-api.ts#L165) ___ @@ -104,4 +104,4 @@ the response. #### Defined in -[chatgpt-api.ts:86](https://github.com/transitive-bullshit/chatgpt-api/blob/cf5e775/src/chatgpt-api.ts#L86) +[chatgpt-api.ts:86](https://github.com/transitive-bullshit/chatgpt-api/blob/80d77a3/src/chatgpt-api.ts#L86) diff --git a/docs/modules.md b/docs/modules.md index 8a7b224..9b0f344 100644 --- a/docs/modules.md +++ b/docs/modules.md @@ -43,7 +43,7 @@ #### Defined in -[types.ts:109](https://github.com/transitive-bullshit/chatgpt-api/blob/cf5e775/src/types.ts#L109) +[types.ts:109](https://github.com/transitive-bullshit/chatgpt-api/blob/80d77a3/src/types.ts#L109) ___ @@ -53,7 +53,7 @@ ___ #### Defined in -[types.ts:1](https://github.com/transitive-bullshit/chatgpt-api/blob/cf5e775/src/types.ts#L1) +[types.ts:1](https://github.com/transitive-bullshit/chatgpt-api/blob/80d77a3/src/types.ts#L1) ___ @@ -75,7 +75,7 @@ https://chat.openapi.com/backend-api/conversation #### Defined in -[types.ts:134](https://github.com/transitive-bullshit/chatgpt-api/blob/cf5e775/src/types.ts#L134) +[types.ts:134](https://github.com/transitive-bullshit/chatgpt-api/blob/80d77a3/src/types.ts#L134) ___ @@ -93,7 +93,7 @@ ___ #### Defined in -[types.ts:251](https://github.com/transitive-bullshit/chatgpt-api/blob/cf5e775/src/types.ts#L251) +[types.ts:251](https://github.com/transitive-bullshit/chatgpt-api/blob/80d77a3/src/types.ts#L251) ___ @@ -118,7 +118,7 @@ ___ #### Defined in -[types.ts:257](https://github.com/transitive-bullshit/chatgpt-api/blob/cf5e775/src/types.ts#L257) +[types.ts:257](https://github.com/transitive-bullshit/chatgpt-api/blob/80d77a3/src/types.ts#L257) ___ @@ -135,7 +135,7 @@ ___ #### Defined in -[types.ts:270](https://github.com/transitive-bullshit/chatgpt-api/blob/cf5e775/src/types.ts#L270) +[types.ts:270](https://github.com/transitive-bullshit/chatgpt-api/blob/80d77a3/src/types.ts#L270) ___ @@ -157,7 +157,7 @@ https://chat.openapi.com/backend-api/conversation/message_feedback #### Defined in -[types.ts:193](https://github.com/transitive-bullshit/chatgpt-api/blob/cf5e775/src/types.ts#L193) +[types.ts:193](https://github.com/transitive-bullshit/chatgpt-api/blob/80d77a3/src/types.ts#L193) ___ @@ -167,7 +167,7 @@ ___ #### Defined in -[types.ts:249](https://github.com/transitive-bullshit/chatgpt-api/blob/cf5e775/src/types.ts#L249) +[types.ts:249](https://github.com/transitive-bullshit/chatgpt-api/blob/80d77a3/src/types.ts#L249) ___ @@ -187,7 +187,7 @@ ___ #### Defined in -[types.ts:222](https://github.com/transitive-bullshit/chatgpt-api/blob/cf5e775/src/types.ts#L222) +[types.ts:222](https://github.com/transitive-bullshit/chatgpt-api/blob/80d77a3/src/types.ts#L222) ___ @@ -197,7 +197,7 @@ ___ #### Defined in -[types.ts:220](https://github.com/transitive-bullshit/chatgpt-api/blob/cf5e775/src/types.ts#L220) +[types.ts:220](https://github.com/transitive-bullshit/chatgpt-api/blob/80d77a3/src/types.ts#L220) ___ @@ -207,7 +207,7 @@ ___ #### Defined in -[types.ts:275](https://github.com/transitive-bullshit/chatgpt-api/blob/cf5e775/src/types.ts#L275) +[types.ts:275](https://github.com/transitive-bullshit/chatgpt-api/blob/80d77a3/src/types.ts#L275) ___ @@ -225,7 +225,7 @@ ___ #### Defined in -[types.ts:77](https://github.com/transitive-bullshit/chatgpt-api/blob/cf5e775/src/types.ts#L77) +[types.ts:77](https://github.com/transitive-bullshit/chatgpt-api/blob/80d77a3/src/types.ts#L77) ___ @@ -243,7 +243,7 @@ https://chat.openapi.com/backend-api/models #### Defined in -[types.ts:70](https://github.com/transitive-bullshit/chatgpt-api/blob/cf5e775/src/types.ts#L70) +[types.ts:70](https://github.com/transitive-bullshit/chatgpt-api/blob/80d77a3/src/types.ts#L70) ___ @@ -262,7 +262,7 @@ https://chat.openapi.com/backend-api/moderations #### Defined in -[types.ts:97](https://github.com/transitive-bullshit/chatgpt-api/blob/cf5e775/src/types.ts#L97) +[types.ts:97](https://github.com/transitive-bullshit/chatgpt-api/blob/80d77a3/src/types.ts#L97) ___ @@ -282,7 +282,7 @@ https://chat.openapi.com/backend-api/moderations #### Defined in -[types.ts:114](https://github.com/transitive-bullshit/chatgpt-api/blob/cf5e775/src/types.ts#L114) +[types.ts:114](https://github.com/transitive-bullshit/chatgpt-api/blob/80d77a3/src/types.ts#L114) ___ @@ -300,7 +300,7 @@ ___ #### Defined in -[types.ts:161](https://github.com/transitive-bullshit/chatgpt-api/blob/cf5e775/src/types.ts#L161) +[types.ts:161](https://github.com/transitive-bullshit/chatgpt-api/blob/80d77a3/src/types.ts#L161) ___ @@ -317,7 +317,7 @@ ___ #### Defined in -[types.ts:178](https://github.com/transitive-bullshit/chatgpt-api/blob/cf5e775/src/types.ts#L178) +[types.ts:178](https://github.com/transitive-bullshit/chatgpt-api/blob/80d77a3/src/types.ts#L178) ___ @@ -327,7 +327,7 @@ ___ #### Defined in -[types.ts:3](https://github.com/transitive-bullshit/chatgpt-api/blob/cf5e775/src/types.ts#L3) +[types.ts:3](https://github.com/transitive-bullshit/chatgpt-api/blob/80d77a3/src/types.ts#L3) ___ @@ -348,7 +348,7 @@ https://chat.openapi.com/api/auth/session #### Defined in -[types.ts:8](https://github.com/transitive-bullshit/chatgpt-api/blob/cf5e775/src/types.ts#L8) +[types.ts:8](https://github.com/transitive-bullshit/chatgpt-api/blob/80d77a3/src/types.ts#L8) ___ @@ -370,7 +370,7 @@ ___ #### Defined in -[types.ts:30](https://github.com/transitive-bullshit/chatgpt-api/blob/cf5e775/src/types.ts#L30) +[types.ts:30](https://github.com/transitive-bullshit/chatgpt-api/blob/80d77a3/src/types.ts#L30) ## Functions @@ -390,4 +390,4 @@ ___ #### Defined in -[utils.ts:4](https://github.com/transitive-bullshit/chatgpt-api/blob/cf5e775/src/utils.ts#L4) +[utils.ts:4](https://github.com/transitive-bullshit/chatgpt-api/blob/80d77a3/src/utils.ts#L4) diff --git a/docs/readme.md b/docs/readme.md index 2a41923..bf546da 100644 --- a/docs/readme.md +++ b/docs/readme.md @@ -107,6 +107,7 @@ All of these awesome projects are built using the `chatgpt` package. 🤯 - [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) @@ -114,8 +115,9 @@ If you create a cool integration, feel free to open a PR and add it to the list. ## Credit -- Huge thanks to [@RomanHotsiy](https://github.com/RomanHotsiy), [@ElijahPepe](https://github.com/ElijahPepe), [@wong2](https://github.com/wong2), and all the other contributors 💪 +- Huge thanks to [@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) +- The original REST version was inspired by [chat-gpt-google-extension](https://github.com/wong2/chat-gpt-google-extension) by [@wong2](https://github.com/wong2) ## License From 5849f1aea466a97bc0aa24bbf5d5cf891cce2799 Mon Sep 17 00:00:00 2001 From: Travis Fischer Date: Tue, 6 Dec 2022 02:40:50 -0600 Subject: [PATCH 12/12] 1.2.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 3947b55..6d44fd4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "chatgpt", - "version": "1.2.1", + "version": "1.2.2", "description": "Node.js client for the unofficial ChatGPT API.", "author": "Travis Fischer ", "repository": "transitive-bullshit/chatgpt-api",