🚀 Auto-deploy: BotVPS atualizado em 29/03/2026 01:00:58
This commit is contained in:
10
ai_agent.py
10
ai_agent.py
@@ -82,10 +82,16 @@ DIRETRIZES:
|
|||||||
print(f"[AGENT] Iteração {i+1} - Enviando para {provider} (modelo padrão)...")
|
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)
|
response = await get_llm_response_async(system_prompt + current_history, provider, cfg)
|
||||||
print(f"[LLM RESPONSE]: {response}")
|
print(f"[LLM RESPONSE]: {response}")
|
||||||
match = re.search(r"\[TOOL:(.*?)\](.*?)\[/TOOL\]", response, re.I | re.S)
|
# Regex robusto que encontra o [TOOL:nome] e extrai o argumento mesmo sem [/TOOL]
|
||||||
|
match = re.search(r"\[TOOL:([^\]]+)\]", response, re.I)
|
||||||
|
|
||||||
if match:
|
if match:
|
||||||
t_name, arg = match.group(1).strip(), match.group(2).strip()
|
t_name = match.group(1).strip()
|
||||||
|
content_after = response[match.end():]
|
||||||
|
end_tag = re.search(r"\[/TOOL\]", content_after, re.I)
|
||||||
|
|
||||||
|
arg = content_after[:end_tag.start()].strip() if end_tag else content_after.strip()
|
||||||
|
|
||||||
if t_name in AVAILABLE_TOOLS:
|
if t_name in AVAILABLE_TOOLS:
|
||||||
func = AVAILABLE_TOOLS[t_name]["func"]
|
func = AVAILABLE_TOOLS[t_name]["func"]
|
||||||
# Assume ferramentas são síncronas em tools.py (legado)
|
# Assume ferramentas são síncronas em tools.py (legado)
|
||||||
|
|||||||
Reference in New Issue
Block a user