mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-16 13:27:08 +00:00
feat: API3的报错优化
This commit is contained in:
parent
89d3bb52dd
commit
08fe3314d1
2 changed files with 5 additions and 1 deletions
|
|
@ -55,7 +55,7 @@ const defaultConfig = {
|
|||
noiseScaleW: 0.668,
|
||||
lengthScale: 1.2,
|
||||
initiativeChatGroups: [],
|
||||
version: 'v2.1.3'
|
||||
version: 'v2.1.4'
|
||||
}
|
||||
const _path = process.cwd()
|
||||
let config = {}
|
||||
|
|
|
|||
|
|
@ -86,6 +86,10 @@ export class OfficialChatGPTClient {
|
|||
referrer: 'https://chat.openai.com/chat'
|
||||
}
|
||||
const res = await this._fetch(url, option)
|
||||
if (res.status !== 200) {
|
||||
let body = await res.json()
|
||||
throw new Error(JSON.stringify(body, null, 2))
|
||||
}
|
||||
const decoder = new TextDecoder('utf-8')
|
||||
const bodyBytes = await res.arrayBuffer()
|
||||
const bodyText = decoder.decode(bodyBytes)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue