fix: preserve markdown fences when chunking

This commit is contained in:
Peter Steinberger committed 2026-01-06 20:23:41 +01:00
1 parent afc42c7547
commit 67bda21811
13 files changed
+378 -108

No files matched your search

+6 -2
View File
@@ -22,7 +22,11 @@ import {
DEFAULT_AGENT_WORKSPACE_DIR,
ensureAgentWorkspace,
} from "../agents/workspace.js";
import { chunkText, resolveTextChunkLimit } from "../auto-reply/chunk.js";
import {
chunkMarkdownText,
chunkText,
resolveTextChunkLimit,
} from "../auto-reply/chunk.js";
import type { MsgContext } from "../auto-reply/templating.js";
import {
normalizeThinkLevel,
@@ -667,7 +671,7 @@ export async function agentCommand(
if (deliveryProvider === "telegram" && telegramTarget) {
try {
if (media.length === 0) {
for (const chunk of chunkText(text, deliveryTextLimit)) {
for (const chunk of chunkMarkdownText(text, deliveryTextLimit)) {
await deps.sendMessageTelegram(telegramTarget, chunk, {
verbose: false,
token: telegramToken || undefined,