BBotEnvelope
Espacio de programación con IA

Fragmentación de mensajes de bot

Divide el texto del bot según el límite configurado de unidades UTF-16 sin separar pares sustitutos.

● ● ●BotEnvelope●
Flujos de trabajo · Fragmentación de mensajes 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);
✳Divide el texto del bot según el límite configurado de unidades UTF-16 sin separar pares sustitutos.
✓ CambiosRevisa antes de aplicar ↗
Vista ilustrativa
  1. Proyecto

    Prueba un emoji en el límite, un mensaje vacío y bloques de código, conservando el texto al reunir los fragmentos.

  2. Revisa antes de aplicar

    Compara el comportamiento real con el resultado esperado. Si una prueba falla, investiga la causa antes de hacer más cambios.

  3. Modelos

    Configura un endpoint compatible con OpenAI o Anthropic usando la URL base y, si hace falta, una clave API. Prueba la conexión. Un servidor local debe estar en ejecución; las herramientas remotas pueden enviar datos por separado.

Flujos de trabajo

Fragmentación de mensajes de bot

Flujos de trabajo ↗
Flujos de trabajo
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);
Espacio de programación con IA

Tu próxima idea empieza aquí.

Descargar para Windows ↗