diff --git a/app/plugins/misc/gemini.py b/app/plugins/misc/gemini.py index 1384fee..f697634 100644 --- a/app/plugins/misc/gemini.py +++ b/app/plugins/misc/gemini.py @@ -20,7 +20,7 @@ async def basic_check(message: Message): if not Config.GEMINI_API_KEY: await message.reply( "Gemini API KEY not found." - "\nGet it HERE " + "\nGet it HERE " "and set GEMINI_API_KEY var." ) return @@ -71,6 +71,8 @@ async def ai_chat(bot: BOT, message: Message): USAGE: .load_history {question} [reply to history document] """ + if not (await basic_check(message)): # fmt:skip + return reply = message.replied if ( not message.input @@ -84,10 +86,10 @@ async def ai_chat(bot: BOT, message: Message): ) return resp = await message.reply("Loading History...") + doc = (await reply.download(in_memory=True)).getbuffer() + history = pickle.loads(doc) + await resp.edit("History Loaded... Resuming chat") try: - doc = (await reply.download(in_memory=True)).getbuffer() - history = pickle.loads(doc) - await resp.edit("History Loaded... Resuming chat") chat = MODEL.start_chat(history=history) await do_convo(chat=chat, message=message) except TimeoutError: