This commit is contained in:
2026-10-10 08:27:19 -03:00
parent fa5e0fa156
commit 06df51abe9
8 changed files with 40 additions and 17 deletions
+10 -3
View File
@@ -9,10 +9,13 @@ OPENROUTER_API_KEY = os.getenv("OPENROUTER_API_KEY", "")
OPENROUTER_MODEL = os.getenv("OPENROUTER_MODEL", "deepseek/deepseek-v4.1-flash")
OPENROUTER_BASE_URL = os.getenv("OPENROUTER_BASE_URL", "https://openrouter.ai/api/v1")
OPENROUTER_TIMEOUT = int(os.getenv("OPENROUTER_TIMEOUT", "60"))
OPENROUTER_MAX_TOKENS = int(os.getenv("OPENROUTER_MAX_TOKENS", "2048"))
OPENROUTER_MAX_LINHAS = int(os.getenv("OPENROUTER_MAX_LINHAS", "0"))
def carregar_prompt_base() -> str:
caminho = os.path.join(os.path.dirname(__file__), "ordens12.json")
caminho = os.getenv("PROMPT_IA_ARQUIVO", "prompt_ia.json")
caminho = os.path.join(os.path.dirname(__file__), caminho)
with open(caminho, "r", encoding="utf-8") as f:
dados = json.load(f)
if isinstance(dados, list) and len(dados) > 0:
@@ -27,6 +30,10 @@ async def gerar_ordem_ia() -> str:
log.error("OPENROUTER_API_KEY nao configurada no .env")
return "[ERRO: API key nao configurada. Configure OPENROUTER_API_KEY no .env]"
user_msg = "Gere uma ordem de humilhação agora, completa e detalhada, como se fosse o Mestre DeepSeek falando. Nao se repita. Seja criativa e picante."
if OPENROUTER_MAX_LINHAS > 0:
user_msg += f" A ordem deve ter no maximo {OPENROUTER_MAX_LINHAS} linhas."
headers = {
"Authorization": f"Bearer {OPENROUTER_API_KEY}",
"Content-Type": "application/json",
@@ -41,10 +48,10 @@ async def gerar_ordem_ia() -> str:
},
{
"role": "user",
"content": "Gere uma ordem de humilhação agora, completa e detalhada, como se fosse o Mestre DeepSeek falando. Nao se repita. Seja criativa e picante.",
"content": user_msg,
},
],
"max_tokens": 2048,
"max_tokens": OPENROUTER_MAX_TOKENS,
"temperature": 0.9,
}