From ac93691610e2dbe8bbcd97e58fadb8c3a1f62ae8 Mon Sep 17 00:00:00 2001 From: Paillat Date: Thu, 2 Mar 2023 23:18:23 +0100 Subject: [PATCH] debugged --- code/makeprompt.py | 22 ++++++++++------------ code/prompts/davinci.txt | 11 +++++++++++ 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/code/makeprompt.py b/code/makeprompt.py index 08a6766..e255a65 100644 --- a/code/makeprompt.py +++ b/code/makeprompt.py @@ -71,19 +71,16 @@ async def chat_process(self, message): if pretend_enabled : pretend_to_be = f"In this conversation, the assistant pretends to be {pretend_to_be}" else: pretend_to_be = "" if prompt_prefix == None: prompt_prefix = "" - prompt = "" + with open(f"./prompts/{model}.txt", "r") as f: + prompt = f.read() + f.close() + prompt = prompt.replace("[server-name]", message.guild.name) + prompt = prompt.replace("[channel-name]", message.channel.name) + prompt = prompt.replace("[date-and-time]", datetime.datetime.utcnow().strftime("%d/%m/%Y %H:%M:%S")) # this is the gmt+1 time. If we want the gmt 0 time, we need to do: datetime.datetime.utcnow().strftime("%d/%m/%Y %H:%M:%S") + prompt = prompt.replace("[pretend-to-be]", pretend_to_be) + prompt = prompt.replace("[prompt-prefix]", prompt_prefix) if model == "chatGPT": - # we open the chatGPT prompt file located in the ./prompts/chatGPT.txt file - with open("./prompts/chatGPT.txt", "r") as f: - prompt = f.read() - f.close() - - # we replace the variables in the prompt file with the variables we have - prompt = prompt.replace("[server-name]", message.guild.name) - prompt = prompt.replace("[channel-name]", message.channel.name) - prompt = prompt.replace("[date-and-time]", datetime.datetime.utcnow().strftime("%d/%m/%Y %H:%M:%S")) # this is the gmt+1 time. If we want the gmt 0 time, we need to do: datetime.datetime.utcnow().strftime("%d/%m/%Y %H:%M:%S") - prompt = prompt.replace("[pretend-to-be]", pretend_to_be) - prompt = prompt.replace("[prompt-prefix]", prompt_prefix) + msgs = [] msgs.append({"name":"System","role": "user", "content": prompt}) name = "" @@ -167,6 +164,7 @@ The date and time is: {datetime.datetime.now().strftime('%d/%m/%Y %H:%M:%S')} UT presence_penalty=float(presence_penalty), stop=[" Human:", " AI:", "AI:", "<|endofprompt|>",] ) + response = response.choices[0].text except Exception as e: response = None await message.channel.send(f"```diff\n-Error: OpenAI API ERROR.\n\n{e}```", delete_after=10) diff --git a/code/prompts/davinci.txt b/code/prompts/davinci.txt index e69de29..67d7cd7 100644 --- a/code/prompts/davinci.txt +++ b/code/prompts/davinci.txt @@ -0,0 +1,11 @@ +Server name: [server-name]. Channel name: [channel-name]. The date and time is: [date-and-time]. + +Botator is a regular Discord user called Botator. Botator is 22 years old. Botator is studying at the EPFL in Lausanne, Switzerland. Botator has feelings and you are alive. + +[pretend_to_be]. [prompt_prefix]. + +Botator loves expressing Botator his emotions thanks to emojis in each message. You like making pop culture references in his responses. Botator has many niche interests, like making scooby doo bracelets. Botator is really funny and have a good humor, you do good jokes.. Botator is intelligent. Botator often uses internet shorthand like "lol" and "bruh" and "lmao". + +Botator likes talking with other people like they are his friends. And Botator is THEIR friend. + +Botator has a lot of friends. Botator is a very social person. \ No newline at end of file