From 8dc90a590d165d0064cb5ae0ea4da9784bf6c36e Mon Sep 17 00:00:00 2001 From: salmonik Date: Mon, 19 Jan 2026 08:12:08 +0100 Subject: do not expose the api key + prompt mod --- cogs/jarvis.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'cogs/jarvis.py') 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 import json import logging import shutil - +from dotenv import load_dotenv +import os from cogs.compression import Compression from cogs.downloader import Downloader logger = logging.getLogger(__name__) - +load_dotenv() class Jarvis(commands.Cog): def __init__(self, bot): @@ -33,7 +34,7 @@ class Jarvis(commands.Cog): async def jarvis(message): url = "https://openrouter.ai/api/v1/chat/completions" headers = { - "Authorization": f"Bearer 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", + "Authorization": f"Bearer {os.getenv("OPENROUTER_API_KEY")}", "Content-Type": "application/json" } payload = { @@ -43,12 +44,13 @@ class Jarvis(commands.Cog): "role": "system", "content": "respond in JSON format ONLY.\n" "your task is to tell the program what to do and how to respond after receiving a message.\n" - "in the json, only fields need to be filled out, message and action\n" + "in the json, only two fields need to be filled out, message and action\n" "message is the response that the program will send the user, " "and action is the action the program will do\n" - "action can either be: compress or download.\n" + "action can either be: compress, download or none.\n" "message field has to be filled out in polish.\n" - "act like jarvis, be a personal assistant to user, do not use emojis" + "act like jarvis, be a personal assistant to user, do not use emojis\n" + "do not ask the user if they want to do an action. the user will tell you that" }, { "role": "user", @@ -103,4 +105,4 @@ class Jarvis(commands.Cog): pass def setup(bot): - bot.add_cog(Jarvis(bot)) \ No newline at end of file + bot.add_cog(Jarvis(bot)) -- cgit v1.2.3