From 2e4de119db31e945b644b1035ab69225effde6e5 Mon Sep 17 00:00:00 2001 From: Kaveen Kumarasinghe Date: Fri, 3 Feb 2023 00:09:49 -0500 Subject: [PATCH] Add thinking message for conversations --- gpt3discord.py | 2 +- services/text_service.py | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/gpt3discord.py b/gpt3discord.py index d0c216ad..50688310 100644 --- a/gpt3discord.py +++ b/gpt3discord.py @@ -30,7 +30,7 @@ from models.openai_model import Model -__version__ = "9.0.3" +__version__ = "9.0.4" PID_FILE = Path("bot.pid") diff --git a/services/text_service.py b/services/text_service.py index 7c0c9f0e..ff0c68c6 100644 --- a/services/text_service.py +++ b/services/text_service.py @@ -630,6 +630,14 @@ async def process_conversation_message( conversation_overrides["presence_penalty"], ) + # Send an embed that tells the user that the bot is thinking + thinking_embed = discord.Embed( + title=f"🤖💬 Thinking...", + color=0x808080, + ) + thinking_embed.set_footer(text="This may take a few seconds.") + thinking_message = await message.reply(embed=thinking_embed) + await TextService.encapsulated_send( converser_cog, message.channel.id, @@ -639,6 +647,10 @@ async def process_conversation_message( model=converser_cog.conversation_threads[message.channel.id].model, custom_api_key=user_api_key, ) + + # Delete the thinking embed + await thinking_message.delete() + return True @staticmethod