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

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

View file

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