Added system message for emoji reactions

This commit is contained in:
phixxy 2023-07-11 18:10:44 -07:00
parent cb880ad94d
commit 74a75007b8

View file

@ -224,8 +224,8 @@ def edit_channel_config(channel_id, key, value):
async def react_to_msg(ctx, react): async def react_to_msg(ctx, react):
if True: if True:
if not random.randint(0,10) and ctx.author.id != 1097302679836971038: if not random.randint(0,10) and ctx.author.id != 1097302679836971038:
prompt = "Send only an emoji as a discord reaction to the following chat message sent to you:\n" system_msg = "Send only an emoji as a discord reaction to the following chat message"
message = prompt + ctx.content[0] + '\n' message = ctx.content[0]
headers = { headers = {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
'Authorization': f'Bearer {os.getenv("openai.api_key")}', 'Authorization': f'Bearer {os.getenv("openai.api_key")}',
@ -233,7 +233,7 @@ async def react_to_msg(ctx, react):
data = { data = {
"model": "gpt-3.5-turbo", "model": "gpt-3.5-turbo",
"messages": [{"role": "user", "content": message}] "messages": [{"role": "system", "content": system_msg}, {"role": "user", "content": message}]
} }
url = "https://api.openai.com/v1/chat/completions" url = "https://api.openai.com/v1/chat/completions"