From acf6110a85a085de62d328bfcd90f3d2d127fc64 Mon Sep 17 00:00:00 2001 From: Rock Chin Date: Thu, 8 Dec 2022 16:52:41 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E8=B0=83=E7=94=A8OpenAI=E6=97=B6?= =?UTF-8?q?=E7=9A=84=E5=BC=82=E5=B8=B8=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/qqbot/manager.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pkg/qqbot/manager.py b/pkg/qqbot/manager.py index 8b698b4..40a8014 100644 --- a/pkg/qqbot/manager.py +++ b/pkg/qqbot/manager.py @@ -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))