🚀 Auto-deploy: BotVPS atualizado em 29/04/2026 10:21:34

This commit is contained in:
2026-04-29 10:21:34 +00:00
parent fa98956bcc
commit f9df9713db
3 changed files with 9 additions and 6 deletions

View File

@@ -16,6 +16,9 @@ ALLOWED_USER_ID = os.getenv("TELEGRAM_CHAT_ID")
API_PORT = os.getenv("PORT", "8001")
API_BASE_URL = f"http://localhost:{API_PORT}"
# Timeout aumentado para 300s para permitir que o Agente execute múltiplas ferramentas
GLOBAL_TIMEOUT = 300.0
# O ID permitido deve ser comparado como string ou int, padronizando aqui
if ALLOWED_USER_ID:
ALLOWED_USER_ID = int(ALLOWED_USER_ID)
@@ -32,7 +35,7 @@ chat_histories = {}
async def call_antigravity_api(endpoint: str, payload: dict) -> str:
"""Faz a chamada para a API interna do BotVPS."""
async with httpx.AsyncClient(timeout=120.0) as client:
async with httpx.AsyncClient(timeout=GLOBAL_TIMEOUT) as client:
try:
logger.info(f"Enviando payload para {endpoint}: {payload.get('text', payload.get('task'))}")
response = await client.post(f"{API_BASE_URL}{endpoint}", json=payload)
@@ -129,7 +132,7 @@ async def handle_voice(update: Update, context: ContextTypes.DEFAULT_TYPE):
# 2. Envia para a API interna de áudio
# Como o bridge e API estão na mesma máquina, compartilhamos o /tmp se necessário
# Mas vamos usar multipart para ser fiel à API
async with httpx.AsyncClient(timeout=120.0) as client:
async with httpx.AsyncClient(timeout=GLOBAL_TIMEOUT) as client:
try:
with open(temp_path, "rb") as f:
# O parâmetro history pode ser adicionado futuramente similar ao chat