From 8ea7ab07ec6912f8cef4d38d856007bdfdac7110 Mon Sep 17 00:00:00 2001 From: ikechan8370 Date: Mon, 13 Mar 2023 15:07:56 +0800 Subject: [PATCH] fix: add retry for 403 --- utils/message.js | 3 +++ utils/uploadRecords.js | 0 2 files changed, 3 insertions(+) create mode 100644 utils/uploadRecords.js diff --git a/utils/message.js b/utils/message.js index 98962ac..2435d18 100644 --- a/utils/message.js +++ b/utils/message.js @@ -86,6 +86,9 @@ export class OfficialChatGPTClient { referrer: 'https://chat.openai.com/chat' } const res = await this._fetch(url, option) + if (res.status === 403) { + return await this.sendMessage(prompt, opts) + } if (res.status !== 200) { let body = await res.json() throw new Error(JSON.stringify(body, null, 2)) diff --git a/utils/uploadRecords.js b/utils/uploadRecords.js new file mode 100644 index 0000000..e69de29