BBotEnvelope
Ambiente de programação com IA

Divisão de mensagens de bot

Divida o texto do bot no limite configurado de UTF-16 sem separar pares substitutos.

● ● ●BotEnvelope●
Fluxos de trabalho · Divisão de mensagens de bot ×
if (!Number.isInteger(start) || start < 0 || start > text.length) {
  throw new Error("start.invalid");
}
if (!Number.isInteger(limit) || limit < 1) throw new Error("limit.invalid");
if (start === text.length) return "";
let end = Math.min(start + limit, text.length);
const last = text.charCodeAt(end - 1);
if (end < text.length && last >= 0xD800 && last <= 0xDBFF) end--;
if (end === start) throw new Error("limit.too_small");
return text.slice(start, end);
✳Divida o texto do bot no limite configurado de UTF-16 sem separar pares substitutos.
✓ AlteraçõesRevise antes de aplicar ↗
Ilustração do ambiente
  1. Projeto

    Confira um emoji na borda, uma mensagem vazia e blocos de código, preservando o texto ao juntar os trechos.

  2. Revise antes de aplicar

    Compare o comportamento real com o resultado esperado. Se uma verificação falhar, investigue a causa antes de fazer outras alterações.

  3. Modelos

    Configure um endpoint compatível com OpenAI ou Anthropic com a URL base e uma chave API, quando necessária. Teste a conexão. O servidor local precisa estar em execução; ferramentas remotas podem transmitir dados separadamente.

Fluxos de trabalho

Divisão de mensagens de bot

Fluxos de trabalho ↗
Fluxos de trabalho
if (!Number.isInteger(start) || start < 0 || start > text.length) {
  throw new Error("start.invalid");
}
if (!Number.isInteger(limit) || limit < 1) throw new Error("limit.invalid");
if (start === text.length) return "";
let end = Math.min(start + limit, text.length);
const last = text.charCodeAt(end - 1);
if (end < text.length && last >= 0xD800 && last <= 0xDBFF) end--;
if (end === start) throw new Error("limit.too_small");
return text.slice(start, end);
Ambiente de programação com IA

Seu próximo projeto começa aqui.

Baixar para Windows ↗