From b81d947dbbcdc28c191b45882fca4186667b53b0 Mon Sep 17 00:00:00 2001 From: zwssunny Date: Mon, 27 Feb 2023 22:33:31 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0#=E6=B8=85=E9=99=A4=E6=89=80?= =?UTF-8?q?=E6=9C=89=E4=BA=BA=E8=AE=B0=E5=BF=86=E6=8C=87=E4=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bot/openai/open_ai_bot.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/bot/openai/open_ai_bot.py b/bot/openai/open_ai_bot.py index 4c48c52..9eeb3c9 100644 --- a/bot/openai/open_ai_bot.py +++ b/bot/openai/open_ai_bot.py @@ -22,6 +22,9 @@ class OpenAIBot(Bot): if query == '#清除记忆': Session.clear_session(from_user_id) return '记忆已清除' + elif query == '#清除所有': + Session.clear_all_session() + return '所有人记忆已清除' new_query = Session.build_session_query(query, from_user_id) logger.debug("[OPEN_AI] session query={}".format(new_query)) @@ -157,3 +160,7 @@ class Session(object): @staticmethod def clear_session(user_id): user_session[user_id] = [] + + @staticmethod + def clear_all_session(): + user_session.clear() \ No newline at end of file