From d69fd2b982274a46d31185444192183a4223102e Mon Sep 17 00:00:00 2001 From: zhayujie Date: Mon, 6 Feb 2023 17:03:24 +0800 Subject: [PATCH] fix: session exception due to the openai limit #50 --- bot/openai/open_ai_bot.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bot/openai/open_ai_bot.py b/bot/openai/open_ai_bot.py index d0faacc..afcd7a5 100644 --- a/bot/openai/open_ai_bot.py +++ b/bot/openai/open_ai_bot.py @@ -28,7 +28,8 @@ class OpenAIBot(Bot): reply_content = self.reply_text(new_query, from_user_id) logger.debug("[OPEN_AI] new_query={}, user={}".format(new_query, from_user_id)) - Session.save_session(query, reply_content, from_user_id) + if reply_content and query: + Session.save_session(query, reply_content, from_user_id) return reply_content elif context.get('type', None) == 'IMAGE_CREATE':