mirror of
https://github.com/Paillat-dev/Botator.git
synced 2026-01-02 09:16:19 +00:00
debugged
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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.
|
||||
Reference in New Issue
Block a user