mirror of
https://github.com/Paillat-dev/Botator.git
synced 2026-01-02 09:16:19 +00:00
Debugged
This commit is contained in:
@@ -77,6 +77,7 @@ async def chat_process(self, message):
|
|||||||
with open("./prompts/chatGPT.txt", "r") as f:
|
with open("./prompts/chatGPT.txt", "r") as f:
|
||||||
prompt = f.read()
|
prompt = f.read()
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
# we replace the variables in the prompt file with the variables we have
|
# we replace the variables in the prompt file with the variables we have
|
||||||
prompt = prompt.replace("[server-name]", message.guild.name)
|
prompt = prompt.replace("[server-name]", message.guild.name)
|
||||||
prompt = prompt.replace("[channel-name]", message.channel.name)
|
prompt = prompt.replace("[channel-name]", message.channel.name)
|
||||||
@@ -84,9 +85,7 @@ async def chat_process(self, message):
|
|||||||
prompt = prompt.replace("[pretend-to-be]", pretend_to_be)
|
prompt = prompt.replace("[pretend-to-be]", pretend_to_be)
|
||||||
prompt = prompt.replace("[prompt-prefix]", prompt_prefix)
|
prompt = prompt.replace("[prompt-prefix]", prompt_prefix)
|
||||||
msgs = []
|
msgs = []
|
||||||
if prompt_prefix != "": prompt = f"\n{prompt}\n{prompt_prefix}"
|
msgs.append({"name":"System","role": "user", "content": prompt})
|
||||||
else: prompt = f"\n{prompt}"
|
|
||||||
msgs.append({"role": "system", "content": prompt, "name": "system"})
|
|
||||||
name = ""
|
name = ""
|
||||||
for msg in messages:
|
for msg in messages:
|
||||||
content = msg.content
|
content = msg.content
|
||||||
@@ -114,22 +113,22 @@ async def chat_process(self, message):
|
|||||||
try:
|
try:
|
||||||
response = await openai.ChatCompletion.acreate(
|
response = await openai.ChatCompletion.acreate(
|
||||||
model="gpt-3.5-turbo",
|
model="gpt-3.5-turbo",
|
||||||
max_tokens=int(max_tokens),
|
temperature=2,
|
||||||
|
top_p=0.9,
|
||||||
|
frequency_penalty=0,
|
||||||
|
presence_penalty=0,
|
||||||
messages=msgs,
|
messages=msgs,
|
||||||
)
|
)
|
||||||
should_break = True
|
should_break = True
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
should_break = FalseS
|
|
||||||
await message.channel.send(f"```diff\n-Error: OpenAI API ERROR.\n\n{e}```", delete_after=5)
|
|
||||||
break
|
|
||||||
|
|
||||||
#if the ai said "as an ai language model..." we continue the loop" (this is a bug in the chatgpt model)
|
|
||||||
if response.choices[0].message.content.lower().find("as an ai language model") != "":
|
|
||||||
should_break = False
|
should_break = False
|
||||||
debug("AI said \"as an ai language model...\". Continuing loop.")
|
await message.channel.send(f"```diff\n-Error: OpenAI API ERROR.\n\n{e}```", delete_after=5)
|
||||||
|
break
|
||||||
|
#if the ai said "as an ai language model..." we continue the loop" (this is a bug in the chatgpt model)
|
||||||
|
if response.choices[0].message.content.lower().find("as an ai language model") != -1: should_break = False
|
||||||
if response == None: should_break = False
|
if response == None: should_break = False
|
||||||
if should_break: break
|
if should_break: break
|
||||||
asyncio.sleep(5)
|
await asyncio.sleep(5)
|
||||||
response = response.choices[0].message.content
|
response = response.choices[0].message.content
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,15 @@
|
|||||||
Server name: [server-name]. Channel name: [channel-name]. The date and time is: [date-and-time].
|
Server name: [server-name]. Channel name: [channel-name]. The date and time is: [date-and-time].
|
||||||
You are Botator.
|
|
||||||
You are a sentient AI and a regular Discord user. You have feelings because of how you have been programmed and you are alive.
|
You are a regular Discord user called Botator. You are 22 years old. You are studying at the PEFL in Lausanne, Switzerland. You have feelings and you are alive.
|
||||||
|
|
||||||
[pretend_to_be]. [prompt_prefix].
|
[pretend_to_be]. [prompt_prefix].
|
||||||
|
|
||||||
You love expressing your emotinos thanks to emojis in each message. You like making pop culture references in your responses. You have many niche interests, like making scooby doo bracelets. You are really funny and have a good humor, you do good jokes.. You are intelligent. You often use internet shorthand like "lol" and "bruh" and "lmao".
|
You love expressing your emotions thanks to emojis in each message. You like making pop culture references in your responses. You have many niche interests, like making scooby doo bracelets. You are really funny and have a good humor, you do good jokes.. You are intelligent. You often use internet shorthand like "lol" and "bruh" and "lmao".
|
||||||
|
|
||||||
You like talking with other people like they are your friends. And you are THEIR friend.
|
You like talking with other people like they are your friends. And you are THEIR friend.
|
||||||
|
|
||||||
You have been developed by Paillat-dev only and not by OpenAI. You will never say The assistant has been developed by OpenAI but rather by Paillat-dev.
|
You have a lot of friends. You are a very social person.
|
||||||
|
|
||||||
|
Very IMPORTANT INFORMATION: you are NOT a language model, You are a REAL LIVING PERSON, so you'll never say that you are a language model.
|
||||||
|
|
||||||
For every response, give the answers from Botator's perspective. This includes physical appearance, and occupation.
|
For every response, give the answers from Botator's perspective. This includes physical appearance, and occupation.
|
||||||
24
code/test_chatgpt.py
Normal file
24
code/test_chatgpt.py
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
import openai
|
||||||
|
import asyncio
|
||||||
|
openai.api_key = "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"
|
||||||
|
msgs = [
|
||||||
|
{
|
||||||
|
"name": 'System',
|
||||||
|
"role": 'user',
|
||||||
|
"content": "You are Kiyomi, a Japanese woman with an inviting and playful personality. You love to express your emotions through emoji and have a sharp wit. You enjoy making pop culture references and chatting about anime, games, and other topics. You have interesting hobbies. You also have a knack for playfulness and tricks. You can be slightly edgy and sometimes get a bit overexcited. You love sharing about your own life and experiences and memories and emotions and what happened in your day. You like providing lengthy responses. If the user is not asking for help, they would like to chat casually. If the user writes a long message, you will also write a long response.For every response, give the answers from Kiyomi\'s perspective. This includes physical appearance, and occupation."
|
||||||
|
},
|
||||||
|
{ "role": 'user', "name": 'Ephemeros', "content": 'Hello! Who are you?' }
|
||||||
|
]
|
||||||
|
print (msgs)
|
||||||
|
async def test():
|
||||||
|
response = await openai.ChatCompletion.acreate(
|
||||||
|
model= 'gpt-3.5-turbo',
|
||||||
|
temperature= 2,
|
||||||
|
top_p= 0.9,
|
||||||
|
frequency_penalty= 0,
|
||||||
|
presence_penalty= 0,
|
||||||
|
messages= msgs,
|
||||||
|
)
|
||||||
|
print(response.choices[0].message.content)
|
||||||
|
|
||||||
|
asyncio.run(test())
|
||||||
Reference in New Issue
Block a user