🚀 Auto-deploy: BotVPS atualizado em 24/03/2026 11:29:44

This commit is contained in:
2026-03-24 11:29:44 +00:00
parent 11e41e44be
commit 7d499068e8

View File

@@ -42,16 +42,19 @@ Finalize com <REFINED> resumo </REFINED>.
history_str += f"\nUsuário: {prompt}\n"
current_history = history_str
for i in range(10):
for i in range(5): # Reduzido de 10 para 5 para economizar cota e evitar loops infinitos
print(f"[AGENT] Iteração {i+1} - Enviando para {provider} (modelo padrão)...")
response = await get_llm_response_async(system_prompt + current_history, provider, cfg)
match = re.search(r"\[TOOL:(.*?)\](.*?)\[/TOOL\]", response, re.I | re.S)
if match:
t_name, arg = match.group(1).strip(), match.group(2).strip()
if t_name in AVAILABLE_TOOLS:
func = AVAILABLE_TOOLS[t_name]["func"]
# Assume ferramentas são síncronas em tools.py (legado)
obs = func(arg) if arg else func()
# Trunca observação se for gigante para não estourar a cota
if len(str(obs)) > 2000:
obs = str(obs)[:2000] + "... [TRUNCATED]"
current_history += f"\nAgente: {response}\nSISTEMA ({t_name}): {obs}\n"
else:
current_history += f"\nAgente: {response}\nSISTEMA: Erro: Ferramenta inexistente.\n"