mirror of
https://github.com/RockChinQ/QChatGPT.git
synced 2024-11-16 11:42:44 +08:00
perf: 调用OpenAI时的异常处理
This commit is contained in:
parent
48171786e4
commit
acf6110a85
|
@ -118,7 +118,10 @@ class QQBotManager:
|
|||
|
||||
else: # 消息
|
||||
session = pkg.openai.session.get_session(session_name)
|
||||
reply = "[GPT]" + session.append(text_message)
|
||||
try:
|
||||
reply = "[GPT]" + session.append(text_message)
|
||||
except Exception as e:
|
||||
reply = "[bot]err:{}".format(e)
|
||||
|
||||
return reply
|
||||
|
||||
|
@ -147,7 +150,7 @@ class QQBotManager:
|
|||
continue
|
||||
|
||||
if failed == self.retry:
|
||||
reply = "err:请求超时"
|
||||
reply = "[bot]err:请求超时"
|
||||
|
||||
processing.remove("person_{}".format(event.sender.id))
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user