fix: preserve markdown fences when chunking

This commit is contained in:
Peter Steinberger
2026-01-06 20:19:56 +01:00
parent afc42c7547
commit 67bda21811
13 changed files with 378 additions and 108 deletions

View File

@@ -1,4 +1,7 @@
import { chunkText, resolveTextChunkLimit } from "../auto-reply/chunk.js";
import {
chunkMarkdownText,
resolveTextChunkLimit,
} from "../auto-reply/chunk.js";
import { formatAgentEnvelope } from "../auto-reply/envelope.js";
import {
normalizeGroupActivation,
@@ -556,7 +559,7 @@ async function deliverWebReply(params: {
skipLog,
} = params;
const replyStarted = Date.now();
const textChunks = chunkText(replyResult.text || "", textLimit);
const textChunks = chunkMarkdownText(replyResult.text || "", textLimit);
const mediaList = replyResult.mediaUrls?.length
? replyResult.mediaUrls
: replyResult.mediaUrl