feat(ia): agentic tool-calling — web search, stats, ranking, wiki
Turn /ia from a fixed-prompt chatbot into an agent that pulls what it needs. Instead of one hardcoded wiki pre-fetch, the model is offered read-only tools and MiniMax's tool_choice=auto lets it decide which to call; results are fed back until it answers (MiniMax.answerWithTools), capped by ia.max-ferramentas. - Search: web search via the cluster's self-hosted SearXNG (JSON API, no external key); results boiled down to a few "título — trecho (url)" lines. - Tools: registry + dispatch for pesquisar_web, wiki, estatisticas_jogador, conquistas_jogador, ranking. All read-only and thread-safe off the main thread, so they run on the existing async answer worker. - Ai.ask: agentic path when ia.ferramentas is on (default), else the previous behaviour untouched. - Config: ia.ferramentas, ia.max-ferramentas, ia.searxng-url, ia.resultados-web, ia.trecho-web; getters in Settings. Reloadable via /canalhandia reload. Verified live against MiniMax-M2.7 + SearXNG: the model auto-calls the tool and answers from the result. SearchTest covers the pure result formatter. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -171,9 +171,10 @@ ranking-tamanho: 5
|
||||
# lp user <nome> permission set canalhandia.ia true
|
||||
# lp group <grupo> permission set canalhandia.ia true
|
||||
#
|
||||
# A IA só produz texto de chat. A resposta nunca é executada como comando, e
|
||||
# nenhuma ferramenta é oferecida ao modelo na requisição — ele não tem como
|
||||
# rodar nada no servidor, no terminal ou no jogo.
|
||||
# A IA só produz texto de chat: a resposta NUNCA é executada como comando. As
|
||||
# ferramentas abaixo são todas de LEITURA (busca web, estatísticas, ranking,
|
||||
# wiki) — o modelo pode consultar informação, mas não muda nada no servidor,
|
||||
# no mundo ou no terminal.
|
||||
ia:
|
||||
url: "https://api.minimax.io/v1/text/chatcompletion_v2"
|
||||
# M2.7 mediu 2,7-5,2s com respostas corretas nos testes. O M3 é um modelo de
|
||||
@@ -181,6 +182,18 @@ ia:
|
||||
# cortada no meio da palavra, a não ser com um orçamento muito maior.
|
||||
modelo: "MiniMax-M2.7"
|
||||
|
||||
# IA agêntica: o modelo decide sozinho quando usar ferramentas (busca web,
|
||||
# estatísticas de jogador, ranking, Minecraft Wiki) em vez de receber tudo
|
||||
# pronto no prompt. Deixa as respostas bem mais espertas.
|
||||
ferramentas: true
|
||||
# Máximo de rodadas de ferramenta por pergunta (trava anti-loop).
|
||||
max-ferramentas: 4
|
||||
# Busca web via SearXNG (self-hosted, sem chave de API externa). URL do serviço.
|
||||
searxng-url: "http://192.168.1.80:30888"
|
||||
# Quantos resultados de busca web devolver, e quanto de cada trecho manter.
|
||||
resultados-web: 5
|
||||
trecho-web: 300
|
||||
|
||||
# Tamanho da resposta pedida ao modelo, e o corte final no chat.
|
||||
# 1200, não 300: o raciocínio oculto do M3 consome o orçamento e a resposta
|
||||
# chega vazia quando o teto é baixo.
|
||||
|
||||
Reference in New Issue
Block a user