feat(ia): split long/list answers into separate chat messages

Minecraft has no meaningful character cap on what the server sends —
the 256-char limit is only on what a player types. The real problem
was that AiText.sanitise flattened every \n to a space, so a
model-produced numbered list or multi-paragraph answer landed as one
wrapped wall of text instead of readable lines.

AiText.segments() keeps the model's own line breaks, re-wraps any
line still too long at a sentence boundary (falling back to a
word/char wrap for pathological input), and caps both the total
character budget (ia.max-caracteres, unchanged meaning) and the
number of chat messages (new ia.max-mensagens, default 4) so a
runaway list can't flood chat.

Ai.deliver sends one message per segment instead of one flattened
line; style() tags only the first with [IA], continuation lines get
a plain " » " marker so a 5-item list reads as one grouped answer,
not five separate replies.

295 -> 305 tests.
This commit is contained in:
marcos
2026-08-09 06:06:51 +00:00
parent 67a2cbb37d
commit c54c6b22b3
5 changed files with 320 additions and 6 deletions
+8
View File
@@ -187,6 +187,14 @@ ia:
max-tokens: 1200
max-caracteres: 500
# O Minecraft não limita o tamanho de uma mensagem que o SERVIDOR manda (o
# limite de 256 caracteres é só no que um JOGADOR digita). O problema de
# despejar uma lista inteira numa linha só é de leitura, não do jogo: vira
# um bloco de texto em vez de itens separados. Por isso a resposta é
# dividida em até N mensagens de chat — uma lista de 5 itens vira 5 linhas.
# max-caracteres continua sendo o teto total somado entre todas elas.
max-mensagens: 4
# Tamanho máximo da pergunta, em caracteres.
max-pergunta: 300