refactor: unify markdown formatting pipeline

This commit is contained in:
Peter Steinberger
2026-01-15 00:12:29 +00:00
parent 0d0b77ded6
commit bd7d362d3b
16 changed files with 1245 additions and 350 deletions

View File

@@ -1,4 +1,4 @@
import { chunkMarkdownText } from "../../../auto-reply/chunk.js";
import { markdownToTelegramHtmlChunks } from "../../../telegram/format.js";
import { sendMessageTelegram } from "../../../telegram/send.js";
import type { ChannelOutboundAdapter } from "../types.js";
@@ -10,7 +10,7 @@ function parseReplyToMessageId(replyToId?: string | null) {
export const telegramOutbound: ChannelOutboundAdapter = {
deliveryMode: "direct",
chunker: chunkMarkdownText,
chunker: markdownToTelegramHtmlChunks,
textChunkLimit: 4000,
resolveTarget: ({ to }) => {
const trimmed = to?.trim();
@@ -27,6 +27,7 @@ export const telegramOutbound: ChannelOutboundAdapter = {
const replyToMessageId = parseReplyToMessageId(replyToId);
const result = await send(to, text, {
verbose: false,
textMode: "html",
messageThreadId: threadId ?? undefined,
replyToMessageId,
accountId: accountId ?? undefined,
@@ -39,6 +40,7 @@ export const telegramOutbound: ChannelOutboundAdapter = {
const result = await send(to, text, {
verbose: false,
mediaUrl,
textMode: "html",
messageThreadId: threadId ?? undefined,
replyToMessageId,
accountId: accountId ?? undefined,