fix: api3对话不存在增加提示

This commit is contained in:
ikechan8370 2023-03-23 21:03:03 +08:00
parent 6b02beddd8
commit c1ca4f2f9b

View file

@ -91,8 +91,12 @@ export class OfficialChatGPTClient {
}
if (res.status !== 200) {
let body = await res.text()
if (body.indexOf('Conversation not found') > -1) {
throw new Error('对话不存在,请使用指令”#结束对话“结束当前对话后重新开始对话。')
} else {
throw new Error(body)
}
}
// todo accept as stream
const decoder = new TextDecoder('utf-8')
const bodyBytes = await res.arrayBuffer()