mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-16 21:37:11 +00:00
捕获OpenAI认证阶段异常
Token好像很容易过期,使用过程中突然不回复了,查日志发现Token过期了,但QQ没有提示。
This commit is contained in:
parent
364fe9f578
commit
505d5e30f5
1 changed files with 6 additions and 1 deletions
7
index.js
7
index.js
|
|
@ -117,7 +117,12 @@ export class chatgpt extends plugin {
|
|||
async chatgpt (e) {
|
||||
let question = _.trimStart(e.msg, '#chatgpt')
|
||||
question = question.trimStart()
|
||||
await this.chatGPTApi.ensureAuth()
|
||||
try {
|
||||
await this.chatGPTApi.ensureAuth()
|
||||
} catch (e) {
|
||||
logger.error(e)
|
||||
await this.reply(`OpenAI认证失败,请检查Token:${e}`, true)
|
||||
}
|
||||
let c
|
||||
logger.info(`chatgpt question: ${question}`)
|
||||
let previousConversation = await redis.get(`CHATGPT:CONVERSATIONS:${e.sender.user_id}`)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue