feat: /ia — chat question-and-answer backed by MiniMax
Adds an `ia` module: `/ia <pergunta>` sends the question to an OpenAI-compatible chat-completions endpoint (MiniMax by default) and posts the reply to chat. Access is gated by `canalhandia.ia`, declared `default: op` so the operator has it out of the box and LuckPerms can grant it to anyone else. The model can only ever produce chat text: - the reply goes to sendMessage and nowhere else — it is never passed to the command dispatcher; - no `tools`/`tool_choice` are sent, so there is nothing for the model to call; - the system prompt states it has no server, shell or command access; - replies are sanitised — colour codes stripped so they cannot forge server messages, newlines folded so one answer is one chat entry, and leading slashes removed so nothing reads as a command to run. The API key is deliberately not a config value, since config.yml is committed. It is read from MINIMAX_API_KEY or from plugins/Canalhandia/minimax.key, which is now gitignored. Cost is bounded by a per-player cooldown and a server-wide daily cap, both visible in /canalhandia status. The HTTP call runs off the main thread; only the delivery hops back onto it.
This commit is contained in:
@@ -56,6 +56,10 @@ commands:
|
||||
f:
|
||||
description: Presta luto pela última morte.
|
||||
usage: /f
|
||||
ia:
|
||||
description: Faz uma pergunta simples para a IA.
|
||||
usage: /ia <pergunta>
|
||||
aliases: [pergunta]
|
||||
|
||||
permissions:
|
||||
# Declared explicitly: an undeclared Bukkit permission falls back to op-only,
|
||||
@@ -75,6 +79,9 @@ permissions:
|
||||
canalhandia.admin:
|
||||
description: Permite mudar módulos, modo, intervalo, categorias e reações.
|
||||
default: op
|
||||
canalhandia.ia:
|
||||
description: Permite usar /ia. Padrão op; o LuckPerms pode conceder a outros.
|
||||
default: op
|
||||
canalhandia.isento:
|
||||
description: Quem tem isto nunca é sorteado como assunto.
|
||||
default: false
|
||||
|
||||
Reference in New Issue
Block a user