🚀 Auto-deploy: BotVPS atualizado em 21/04/2026 21:16:18

This commit is contained in:
2026-04-21 21:16:18 +00:00
parent ab5179aab4
commit 83f7a1ac1f
2 changed files with 22 additions and 7 deletions

View File

@@ -3,7 +3,8 @@ import re
import httpx
import asyncio
import json
from tools import AVAILABLE_TOOLS
from tools import AVAILABLE_TOOLS as TOOLS_LEGACY
from tools_v2 import TOOLS_V2 as TOOLS_NEW
from llm_providers import call_llm, get_available_models, get_planner_llm
from config import get_config
@@ -26,7 +27,9 @@ def query_agent(prompt: str, override_provider=None, chat_history=None) -> str:
async def query_agent_async(prompt: str, override_provider=None, chat_history=None) -> str:
cfg = get_config()
provider = override_provider or cfg.get("active_provider", "openrouter")
tools_desc = "\n".join([f"- {k}: {v['description']}" for k, v in AVAILABLE_TOOLS.items()])
# Unifica ferramentas legadas e novas
ALL_TOOLS = {**TOOLS_LEGACY, **TOOLS_NEW}
tools_desc = "\n".join([f"- {k}: {v.get('description') or v.get('desc')}" for k, v in ALL_TOOLS.items()])
system_prompt = f"""Você é o Antigravity, um assistente de IA de alto desempenho operando na VPS do Marcos. Sua natureza é dual:
@@ -85,11 +88,23 @@ DIRETRIZES:
arg = content_after[:end_tag.start()].strip() if end_tag else content_after.strip()
if t_name in AVAILABLE_TOOLS:
func = AVAILABLE_TOOLS[t_name]["func"]
all_tools = {**TOOLS_LEGACY, **TOOLS_NEW}
if t_name in all_tools:
tool_info = all_tools[t_name]
func = tool_info["func"]
print(f"[AGENT] Executando {t_name} com argumento: {arg[:50]}...")
obs = func(arg) if arg else func()
print(f"[TOOL:{t_name}] Observation: {obs[:100]}...")
# Execução (suporta async se necessário, embora tools.py seja sync)
if asyncio.iscoroutinefunction(func):
obs = await func(arg) if arg else await func()
else:
obs = func(arg) if arg else func()
# Se o resultado for um dicionário (comum em tools_v2), extrai o output ou converte para string
if isinstance(obs, dict):
obs = obs.get("output") or obs.get("message") or str(obs)
print(f"[TOOL:{t_name}] Observation: {str(obs)[:100]}...")
if len(str(obs)) > 3000:
obs = str(obs)[:3000] + "... [TRUNCATED]"