import { chunkMarkdownTextWithMode, type ChunkMode } from "openclaw/plugin-sdk/reply-chunking";
export type ChunkDiscordTextOpts = { /** Max characters per Discord message. Default: 2000. */
maxChars?: number; /** * Soft max line count per message. Default: 17. * * Discord clients can clip/collapse very tall messages in the UI; splitting * by lines keeps long multi-paragraph replies readable.
*/
maxLines?: number;
};
// Keep italics intact for reasoning payloads that are wrapped once with `_…_`. // When Discord chunking splits the message, we close italics at the end of // each chunk and reopen at the start of the next so every chunk renders // consistently. function rebalanceReasoningItalics(source: string, chunks: string[]): string[] { if (chunks.length <= 1) { return chunks;
}
const adjusted = [...chunks]; for (let i = 0; i < adjusted.length; i++) { const isLast = i === adjusted.length - 1; const current = adjusted[i];
// Ensure current chunk closes italics so Discord renders it italicized. const needsClosing = !current.trimEnd().endsWith("_"); if (needsClosing) {
adjusted[i] = `${current}_`;
}
if (isLast) { break;
}
// Re-open italics on the next chunk if needed. const next = adjusted[i + 1]; const leadingWhitespaceLen = next.length - next.trimStart().length; const leadingWhitespace = next.slice(0, leadingWhitespaceLen); const nextBody = next.slice(leadingWhitespaceLen); if (!nextBody.startsWith("_")) {
adjusted[i + 1] = `${leadingWhitespace}_${nextBody}`;
}
}
return adjusted;
}
Messung V0.5 in Prozent
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.13Bemerkung:
(Wie Sie bei der Firma Beratungs- und Dienstleistungen beauftragen können 2026-06-09)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.