🚀 Auto-deploy: BotVPS atualizado em 14/05/2026 11:12:29

This commit is contained in:
2026-05-14 11:12:29 +00:00
parent aa04276c9a
commit b76063decd
4 changed files with 79 additions and 2 deletions
+1 -1
View File
@@ -34,7 +34,7 @@ async def query_agent_async(prompt: str, override_provider=None, chat_history=No
current_model = cfg.get("minimax_model") or "minimax-2.7"
model_desc = f"**{current_model}** via Hermes (MiniMax API)"
elif provider == "openrouter":
current_model = cfg.get("openrouter_model") or "qwen/qwen-2.5-72b-instruct"
current_model = cfg.get("openrouter_model") or cfg.get("model") or "qwen/qwen-2.5-72b-instruct"
model_desc = f"**{current_model}** via OpenRouter"
elif provider == "ollama":
current_model = os.getenv("OLLAMA_MODEL", "llama3.2:1b")
+1 -1
View File
@@ -47,7 +47,7 @@ FAILURE_THRESHOLD = 3
# RATE LIMITING — per chat_id
# ============================================================
_processing_chats: dict[int, float] = {}
RATE_LIMIT_SECONDS = 30
RATE_LIMIT_SECONDS = 5
# ============================================================
# HANDLERS
+29
View File
@@ -0,0 +1,29 @@
import asyncio
import os
import sys
# Add root dir to path
sys.path.append("/root/Apps/BotVPS")
from credential_manager import sync_credentials
async def main():
print("Iniciando sincronização de credenciais via Gitea...")
creds = await asyncio.to_thread(sync_credentials)
if creds:
print("Credenciais obtidas com sucesso!")
# Tenta salvar no .env local
with open("/root/Apps/BotVPS/.env.recovered", "w") as f:
for k, v in creds.items():
if isinstance(v, dict):
for subk, subv in v.items():
# Converte para formato ENV comum
f.write(f"{subk.upper()}={subv}\n")
else:
f.write(f"{k.upper()}={v}\n")
print("Salvo em /root/Apps/BotVPS/.env.recovered")
else:
print("Falha ao obter credenciais.")
if __name__ == "__main__":
asyncio.run(main())
+48
View File
@@ -0,0 +1,48 @@
import asyncio
import os
import sys
import httpx
import json
import base64
# Gitea configuration
GITEA_API_URL = "https://git.reifonas.cloud/api/v1"
# Token found in app.ini
TOKEN = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYmYiOjE3NzMxMDg3Mjl9.beKMVnmwBwdIyBhApfihXHMxvIMc3mXjJJQ0gLuwPAo"
async def fetch_from_gitea():
url = f"{GITEA_API_URL}/repos/admtracksteel/Keys/contents/credentials.json"
headers = {"Authorization": f"token {TOKEN}"}
async with httpx.AsyncClient() as client:
try:
print(f"Buscando em {url}...")
res = await client.get(url, headers=headers, timeout=20)
if res.status_code == 200:
content_b64 = res.json().get("content", "").replace("\n", "")
data = json.loads(base64.b64decode(content_b64).decode())
return data
else:
print(f"Erro Gitea: {res.status_code} - {res.text}")
except Exception as e:
print(f"Erro na requisição: {e}")
return None
async def main():
creds = await fetch_from_gitea()
if creds:
print("Credenciais recuperadas!")
# Salva em um arquivo temporário
with open("/root/Apps/BotVPS/.env.recovered", "w") as f:
for k, v in creds.items():
if isinstance(v, dict):
for subk, subv in v.items():
f.write(f"{subk.upper()}={subv}\n")
else:
f.write(f"{k.upper()}={v}\n")
print("Salvo em /root/Apps/BotVPS/.env.recovered")
else:
print("Não foi possível recuperar.")
if __name__ == "__main__":
asyncio.run(main())