From 7ba231473a5a300b758dc03ac8467a5de36ae81e Mon Sep 17 00:00:00 2001 From: Roland de Boer Date: Sun, 1 Jan 2023 02:59:26 +0100 Subject: [PATCH] Replace Human: in prompt with actual username --- cogs/gpt_3_commands_and_converser.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cogs/gpt_3_commands_and_converser.py b/cogs/gpt_3_commands_and_converser.py index af1e40fd..4a4e551a 100644 --- a/cogs/gpt_3_commands_and_converser.py +++ b/cogs/gpt_3_commands_and_converser.py @@ -503,6 +503,12 @@ async def encapsulated_send(self, user_id, prompt, ctx, response_message=None): new_prompt = prompt + "\nGPTie: " from_context = isinstance(ctx, discord.ApplicationContext) + # Replace 'Human:' with the user's name + try: + new_prompt = new_prompt.replace("Human:", ctx.author.name + ":") + except AttributeError: + pass + try: tokens = self.usage_service.count_tokens(new_prompt)