fix: add warn log for context_length_exceeded error

This commit is contained in:
ikechan8370 2023-03-05 23:18:45 +08:00
parent 354183a0cc
commit 970e89969d

View file

@ -846,6 +846,7 @@ export class chatgpt extends plugin {
msg = await this.chatGPTApi.sendMessage(prompt, option)
} catch (err) {
if (err.message?.indexOf('context_length_exceeded')) {
logger.warn(err)
await redis.del(`CHATGPT:CONVERSATIONS:${e.sender.user_id}`)
await e.reply('字数超限啦,将为您自动结束本次对话。')
return null