Skip to content

Commit 7fc691a

Browse files
authored
fix(telegram): honor table mode in outbound chunks (#85455)
1 parent d8b9736 commit 7fc691a

4 files changed

Lines changed: 20 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ Docs: https://docs.openclaw.ai
4949
- Skills: treat `openclaw.os: macos` as Darwin when checking skill requirements, so macOS-only skills no longer report as missing on macOS hosts. Fixes #61338. Thanks @Jessecq1995.
5050
- Control UI/logs: strip ANSI escape sequences from displayed Gateway log messages so color codes no longer appear as raw text. Fixes #64399. Thanks @guguangxin-eng.
5151
- Docker: pre-create the workspace and auth-profile config mount points with `node` ownership so first-run named volumes do not start root-owned. Fixes #85076. Thanks @Noerr.
52+
- Telegram: pass configured markdown table mode through outbound markdown chunking so chunked sends render tables consistently. Fixes #85085. Thanks @ShuaiHui.
5253
- CLI/update: preserve managed Gateway service environment during package cutovers so macOS LaunchAgent repair/restart reads the pre-update service state instead of caller shell state. (#83026)
5354
- Agents/providers: honor per-model `api` and `baseUrl` overrides in custom provider auth hooks and transport selection. Fixes #80487. (#80488) Thanks @huveewomg.
5455
- Gateway/restart: eager-load the lifecycle runtime before in-place upgrade signal handling so package replacement does not deadlock restart imports. (#84890) Thanks @myps6415.

extensions/telegram/src/format.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -773,6 +773,10 @@ export function markdownToTelegramChunks(
773773
return renderTelegramChunksWithinHtmlLimit(ir, limit);
774774
}
775775

776-
export function markdownToTelegramHtmlChunks(markdown: string, limit: number): string[] {
777-
return markdownToTelegramChunks(markdown, limit).map((chunk) => chunk.html);
776+
export function markdownToTelegramHtmlChunks(
777+
markdown: string,
778+
limit: number,
779+
options: { tableMode?: MarkdownTableMode } = {},
780+
): string[] {
781+
return markdownToTelegramChunks(markdown, limit, options).map((chunk) => chunk.html);
778782
}

extensions/telegram/src/outbound-adapter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ function chunkTelegramOutboundText(
5353
): string[] {
5454
return ctx?.formatting?.parseMode === "HTML"
5555
? splitTelegramHtmlChunks(text, limit)
56-
: markdownToTelegramHtmlChunks(text, limit);
56+
: markdownToTelegramHtmlChunks(text, limit, { tableMode: ctx?.formatting?.tableMode });
5757
}
5858

5959
async function resolveTelegramSendContext(params: {

extensions/telegram/src/telegram-outbound.test.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,16 @@ describe("telegramPlugin outbound", () => {
2929
markdownToTelegramHtmlChunks(text, 4000),
3030
);
3131
});
32+
33+
it("passes markdown table mode to the outbound markdown chunker", () => {
34+
clearTelegramRuntime();
35+
const text = ["| Name | Value |", "|------|-------|", "| A | 1 |"].join("\n");
36+
37+
const chunks = telegramOutbound.chunker?.(text, 4000, {
38+
formatting: { tableMode: "bullets" },
39+
});
40+
41+
expect(chunks?.join("\n")).toContain("Value: 1");
42+
expect(chunks?.join("\n")).not.toContain("| Name | Value |");
43+
});
3244
});

0 commit comments

Comments
 (0)