aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cogs/jarvis.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/cogs/jarvis.py b/cogs/jarvis.py
index 2d2a601..b488508 100644
--- a/cogs/jarvis.py
+++ b/cogs/jarvis.py
@@ -5,12 +5,13 @@ import requests
5import json 5import json
6import logging 6import logging
7import shutil 7import shutil
8 8from dotenv import load_dotenv
9import os
9from cogs.compression import Compression 10from cogs.compression import Compression
10from cogs.downloader import Downloader 11from cogs.downloader import Downloader
11 12
12logger = logging.getLogger(__name__) 13logger = logging.getLogger(__name__)
13 14load_dotenv()
14 15
15class Jarvis(commands.Cog): 16class Jarvis(commands.Cog):
16 def __init__(self, bot): 17 def __init__(self, bot):
@@ -33,7 +34,7 @@ class Jarvis(commands.Cog):
33 async def jarvis(message): 34 async def jarvis(message):
34 url = "https://openrouter.ai/api/v1/chat/completions" 35 url = "https://openrouter.ai/api/v1/chat/completions"
35 headers = { 36 headers = {
36 "Authorization": f"Bearer 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", 37 "Authorization": f"Bearer {os.getenv("OPENROUTER_API_KEY")}",
37 "Content-Type": "application/json" 38 "Content-Type": "application/json"
38 } 39 }
39 payload = { 40 payload = {
@@ -43,12 +44,13 @@ class Jarvis(commands.Cog):
43 "role": "system", 44 "role": "system",
44 "content": "respond in JSON format ONLY.\n" 45 "content": "respond in JSON format ONLY.\n"
45 "your task is to tell the program what to do and how to respond after receiving a message.\n" 46 "your task is to tell the program what to do and how to respond after receiving a message.\n"
46 "in the json, only fields need to be filled out, message and action\n" 47 "in the json, only two fields need to be filled out, message and action\n"
47 "message is the response that the program will send the user, " 48 "message is the response that the program will send the user, "
48 "and action is the action the program will do\n" 49 "and action is the action the program will do\n"
49 "action can either be: compress or download.\n" 50 "action can either be: compress, download or none.\n"
50 "message field has to be filled out in polish.\n" 51 "message field has to be filled out in polish.\n"
51 "act like jarvis, be a personal assistant to user, do not use emojis" 52 "act like jarvis, be a personal assistant to user, do not use emojis\n"
53 "do not ask the user if they want to do an action. the user will tell you that"
52 }, 54 },
53 { 55 {
54 "role": "user", 56 "role": "user",
@@ -103,4 +105,4 @@ class Jarvis(commands.Cog):
103 pass 105 pass
104 106
105def setup(bot): 107def setup(bot):
106 bot.add_cog(Jarvis(bot)) \ No newline at end of file 108 bot.add_cog(Jarvis(bot))