fix: add per-channel markdown table conversion (#1495) (thanks @odysseus0)
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { createReplyReferencePlanner } from "../../auto-reply/reply/reply-reference.js";
|
||||
import { isSilentReplyText, SILENT_REPLY_TOKEN } from "../../auto-reply/tokens.js";
|
||||
import type { ReplyPayload } from "../../auto-reply/types.js";
|
||||
import type { MarkdownTableMode } from "../../config/types.base.js";
|
||||
import type { RuntimeEnv } from "../../runtime.js";
|
||||
import { markdownToSlackMrkdwnChunks } from "../format.js";
|
||||
import { sendMessageSlack } from "../send.js";
|
||||
@@ -116,6 +117,7 @@ export async function deliverSlackSlashReplies(params: {
|
||||
respond: SlackRespondFn;
|
||||
ephemeral: boolean;
|
||||
textLimit: number;
|
||||
tableMode?: MarkdownTableMode;
|
||||
}) {
|
||||
const messages: string[] = [];
|
||||
const chunkLimit = Math.min(params.textLimit, 4000);
|
||||
@@ -127,7 +129,9 @@ export async function deliverSlackSlashReplies(params: {
|
||||
.filter(Boolean)
|
||||
.join("\n");
|
||||
if (!combined) continue;
|
||||
for (const chunk of markdownToSlackMrkdwnChunks(combined, chunkLimit)) {
|
||||
for (const chunk of markdownToSlackMrkdwnChunks(combined, chunkLimit, {
|
||||
tableMode: params.tableMode,
|
||||
})) {
|
||||
messages.push(chunk);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import { listSkillCommandsForAgents } from "../../auto-reply/skill-commands.js";
|
||||
import { dispatchReplyWithDispatcher } from "../../auto-reply/reply/provider-dispatcher.js";
|
||||
import { finalizeInboundContext } from "../../auto-reply/reply/inbound-context.js";
|
||||
import { resolveNativeCommandsEnabled, resolveNativeSkillsEnabled } from "../../config/commands.js";
|
||||
import { resolveMarkdownTableMode } from "../../config/markdown-tables.js";
|
||||
import { danger, logVerbose } from "../../globals.js";
|
||||
import { buildPairingReply } from "../../pairing/pairing-messages.js";
|
||||
import {
|
||||
@@ -424,6 +425,11 @@ export function registerSlackMonitorSlashCommands(params: {
|
||||
respond,
|
||||
ephemeral: slashCommand.ephemeral,
|
||||
textLimit: ctx.textLimit,
|
||||
tableMode: resolveMarkdownTableMode({
|
||||
cfg,
|
||||
channel: "slack",
|
||||
accountId: route.accountId,
|
||||
}),
|
||||
});
|
||||
},
|
||||
onError: (err, info) => {
|
||||
@@ -438,6 +444,11 @@ export function registerSlackMonitorSlashCommands(params: {
|
||||
respond,
|
||||
ephemeral: slashCommand.ephemeral,
|
||||
textLimit: ctx.textLimit,
|
||||
tableMode: resolveMarkdownTableMode({
|
||||
cfg,
|
||||
channel: "slack",
|
||||
accountId: route.accountId,
|
||||
}),
|
||||
});
|
||||
}
|
||||
} catch (err) {
|
||||
|
||||
Reference in New Issue
Block a user