From 0adb5c0e389c74e2047ebe3c04689842d4b1ee1b Mon Sep 17 00:00:00 2001 From: Kaveen Kumarasinghe Date: Mon, 2 Jan 2023 19:10:16 -0500 Subject: [PATCH] fix welcome message --- cogs/gpt_3_commands_and_converser.py | 8 ++++---- models/openai_model.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cogs/gpt_3_commands_and_converser.py b/cogs/gpt_3_commands_and_converser.py index 872bc76..a0aa8de 100644 --- a/cogs/gpt_3_commands_and_converser.py +++ b/cogs/gpt_3_commands_and_converser.py @@ -17,8 +17,6 @@ from collections import defaultdict original_message = {} ALLOWED_GUILDS = EnvService.get_allowed_guilds() -print("THE ALLOWED GUILDS ARE: ", ALLOWED_GUILDS) - class GPT3ComCon(commands.Cog, name="GPT3ComCon"): def __init__( @@ -100,10 +98,10 @@ class GPT3ComCon(commands.Cog, name="GPT3ComCon"): query = f"Please generate a welcome message for {member.name} who has just joined the server." try: - welcome_message = self.model.send_request( + welcome_message_response = await self.model.send_request( query, tokens=self.usage_service.count_tokens(query) ) - + welcome_message = str(welcome_message_response["choices"][0]["text"]) except: welcome_message = None @@ -112,6 +110,7 @@ class GPT3ComCon(commands.Cog, name="GPT3ComCon"): welcome_embed = discord.Embed( title=f"Welcome, {member.name}!", description=welcome_message ) + welcome_embed.add_field( name="Just so you know...", value="> My commands are invoked with a forward slash (/)\n> Use /help to see my help message(s).", @@ -860,6 +859,7 @@ class GPT3ComCon(commands.Cog, name="GPT3ComCon"): "num_images", "summarize_conversations", "summarize_threshold", + "welcome_message_enabled", "IMAGE_SAVE_PATH", ], ) diff --git a/models/openai_model.py b/models/openai_model.py index 5ac1ac6..6a6d850 100644 --- a/models/openai_model.py +++ b/models/openai_model.py @@ -53,7 +53,7 @@ class Model: self._summarize_conversations = True self._summarize_threshold = 2500 self.model_max_tokens = 4024 - self._welcome_message_enabled = False + self._welcome_message_enabled = True try: self.IMAGE_SAVE_PATH = os.environ["IMAGE_SAVE_PATH"]