diff --git a/gpt3discord.py b/gpt3discord.py index c90be72..52b6ee8 100644 --- a/gpt3discord.py +++ b/gpt3discord.py @@ -31,7 +31,7 @@ from services.environment_service import EnvService from models.openai_model import Model -__version__ = "10.8.1" +__version__ = "10.8.2" PID_FILE = Path("bot.pid") diff --git a/services/text_service.py b/services/text_service.py index e81e659..810ed6a 100644 --- a/services/text_service.py +++ b/services/text_service.py @@ -90,7 +90,6 @@ class TextService: converser_cog.pinecone_service and ctx.channel.id in converser_cog.conversation_threads ): - # Delete "GPTie: <|endofstatement|>" from the user's conversation history if it exists for item in converser_cog.conversation_threads[ctx.channel.id].history: if item.text.strip() == BOT_NAME + "<|endofstatement|>": converser_cog.conversation_threads[ @@ -584,42 +583,55 @@ class TextService: # Since this is async, we don't want to allow the user to send another prompt while a conversation # prompt is processing, that'll mess up the conversation history! if message.author.id in converser_cog.awaiting_responses: - message = await message.reply( + resp_message = await message.reply( embed=discord.Embed( title=f"You are already waiting for a response, please wait and speak afterwards.", color=0x808080, ) ) + try: + await resp_message.channel.trigger_typing() + except: + pass # get the current date, add 10 seconds to it, and then turn it into a timestamp. # we need to use our deletion service because this isn't an interaction, it's a regular message. deletion_time = datetime.datetime.now() + datetime.timedelta( - seconds=10 + seconds=5 ) deletion_time = deletion_time.timestamp() - deletion_message = Deletion(message, deletion_time) + deletion_message = Deletion(resp_message, deletion_time) + deletion_original_message = Deletion(message, deletion_time) await converser_cog.deletion_queue.put(deletion_message) + await converser_cog.deletion_queue.put(deletion_original_message) return if message.channel.id in converser_cog.awaiting_thread_responses: - message = await message.reply( + resp_message = await message.reply( embed=discord.Embed( title=f"This thread is already waiting for a response, please wait and speak afterwards.", color=0x808080, ) ) + try: + await resp_message.channel.trigger_typing() + except: + pass + # get the current date, add 10 seconds to it, and then turn it into a timestamp. # we need to use our deletion service because this isn't an interaction, it's a regular message. deletion_time = datetime.datetime.now() + datetime.timedelta( - seconds=10 + seconds=5 ) deletion_time = deletion_time.timestamp() - deletion_message = Deletion(message, deletion_time) + deletion_message = Deletion(resp_message, deletion_time) + deletion_original_message = Deletion(message, deletion_time) await converser_cog.deletion_queue.put(deletion_message) + await converser_cog.deletion_queue.put(deletion_original_message) return @@ -672,10 +684,18 @@ class TextService: title=f"🤖💬 Thinking...", color=0x808080, ) + thinking_embed.set_footer(text="This may take a few seconds.") thinking_message = await message.reply(embed=thinking_embed) + try: + await message.channel.trigger_typing() + except Exception: + pass converser_cog.full_conversation_history[message.channel.id].append(prompt) + if not converser_cog.pinecone_service: + primary_prompt += BOT_NAME + await TextService.encapsulated_send( converser_cog, message.channel.id,