fix: add slack chunk limits

This commit is contained in:
Peter Steinberger
2026-01-04 07:23:39 +01:00
parent 7701d395e9
commit 607de4a403
2 changed files with 6 additions and 1 deletions

View File

@@ -50,6 +50,7 @@ describe("resolveTextChunkLimit", () => {
it("uses per-surface defaults", () => {
expect(resolveTextChunkLimit(undefined, "whatsapp")).toBe(4000);
expect(resolveTextChunkLimit(undefined, "telegram")).toBe(4000);
expect(resolveTextChunkLimit(undefined, "slack")).toBe(4000);
expect(resolveTextChunkLimit(undefined, "signal")).toBe(4000);
expect(resolveTextChunkLimit(undefined, "imessage")).toBe(4000);
expect(resolveTextChunkLimit(undefined, "discord")).toBe(2000);
@@ -62,8 +63,9 @@ describe("resolveTextChunkLimit", () => {
});
it("uses the matching provider override", () => {
const cfg = { discord: { textChunkLimit: 111 } };
const cfg = { discord: { textChunkLimit: 111 }, slack: { textChunkLimit: 222 } };
expect(resolveTextChunkLimit(cfg, "discord")).toBe(111);
expect(resolveTextChunkLimit(cfg, "slack")).toBe(222);
expect(resolveTextChunkLimit(cfg, "telegram")).toBe(4000);
});
});

View File

@@ -8,6 +8,7 @@ export type TextChunkSurface =
| "whatsapp"
| "telegram"
| "discord"
| "slack"
| "signal"
| "imessage"
| "webchat";
@@ -16,6 +17,7 @@ const DEFAULT_CHUNK_LIMIT_BY_SURFACE: Record<TextChunkSurface, number> = {
whatsapp: 4000,
telegram: 4000,
discord: 2000,
slack: 4000,
signal: 4000,
imessage: 4000,
webchat: 4000,
@@ -30,6 +32,7 @@ export function resolveTextChunkLimit(
if (surface === "whatsapp") return cfg?.whatsapp?.textChunkLimit;
if (surface === "telegram") return cfg?.telegram?.textChunkLimit;
if (surface === "discord") return cfg?.discord?.textChunkLimit;
if (surface === "slack") return cfg?.slack?.textChunkLimit;
if (surface === "signal") return cfg?.signal?.textChunkLimit;
if (surface === "imessage") return cfg?.imessage?.textChunkLimit;
return undefined;