fix: add retry for 403

This commit is contained in:
ikechan8370 2023-03-13 15:07:56 +08:00
parent 1050bcc57c
commit 8ea7ab07ec
2 changed files with 3 additions and 0 deletions

View file

@ -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))

0
utils/uploadRecords.js Normal file
View file