UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

33 lines (32 loc) • 1.69 kB
import "./session-key-DY3MOX4N.mjs"; import { n as normalizeAccountId } from "./account-id-ifCOO7_9.mjs"; import { t as normalizeAnyChannelId } from "./registry-normalize-DKVgg-js.mjs"; import { r as resolveChannelAccountEntry } from "./account-lookup-BAaS-Jak.mjs"; import { n as getLoadedChannelPlugin } from "./registry-Bcrk1FVy.mjs"; import "./plugins-BXkKReMp.mjs"; //#region src/config/markdown-tables.ts const isMarkdownTableMode = (value) => value === "off" || value === "bullets" || value === "code" || value === "block"; function resolveMarkdownModeFromSection(section, channel, accountId) { if (!section) return; const normalizedAccountId = normalizeAccountId(accountId); const accounts = section.accounts; if (accounts && typeof accounts === "object") { const matchMode = resolveChannelAccountEntry(accounts, normalizedAccountId, channel)?.markdown?.tables; if (isMarkdownTableMode(matchMode)) return matchMode; } const sectionMode = section.markdown?.tables; return isMarkdownTableMode(sectionMode) ? sectionMode : void 0; } function resolveMarkdownTableMode(params) { const channel = normalizeAnyChannelId(params.channel); const defaultMode = channel ? getLoadedChannelPlugin(channel)?.messaging?.defaultMarkdownTableMode ?? "code" : "code"; let resolved = defaultMode; if (channel && params.cfg) { const channelsConfig = params.cfg.channels; const rootConfig = params.cfg; resolved = resolveMarkdownModeFromSection(channelsConfig?.[channel] ?? rootConfig[channel], channel, params.accountId) ?? defaultMode; } return resolved === "block" && !params.supportsBlockTables ? "code" : resolved; } //#endregion export { resolveMarkdownTableMode as t };