Skip to content

Commit

Permalink
Add thinking message for conversations
Browse files Browse the repository at this point in the history
  • Loading branch information
Kav-K committed Feb 3, 2023
1 parent 6b5ad1b commit 2e4de11
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion gpt3discord.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
from models.openai_model import Model


__version__ = "9.0.3"
__version__ = "9.0.4"


PID_FILE = Path("bot.pid")
Expand Down
12 changes: 12 additions & 0 deletions services/text_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
Expand Down

0 comments on commit 2e4de11

Please sign in to comment.