refactor: move text chunk limits to providers

This commit is contained in:
Peter Steinberger
2026-01-03 01:27:37 +01:00
parent 75a9cd83a0
commit f5189cc897
6 changed files with 71 additions and 58 deletions

View File

@@ -55,20 +55,15 @@ describe("resolveTextChunkLimit", () => {
expect(resolveTextChunkLimit(undefined, "discord")).toBe(2000);
});
it("supports a global override", () => {
const cfg = { messages: { textChunkLimit: 1234 } };
expect(resolveTextChunkLimit(cfg, "whatsapp")).toBe(1234);
expect(resolveTextChunkLimit(cfg, "discord")).toBe(1234);
});
it("prefers per-surface overrides over global", () => {
const cfg = {
messages: {
textChunkLimit: 1234,
textChunkLimitBySurface: { discord: 111 },
},
};
expect(resolveTextChunkLimit(cfg, "discord")).toBe(111);
it("supports provider overrides", () => {
const cfg = { telegram: { textChunkLimit: 1234 } };
expect(resolveTextChunkLimit(cfg, "whatsapp")).toBe(4000);
expect(resolveTextChunkLimit(cfg, "telegram")).toBe(1234);
});
it("uses the matching provider override", () => {
const cfg = { discord: { textChunkLimit: 111 } };
expect(resolveTextChunkLimit(cfg, "discord")).toBe(111);
expect(resolveTextChunkLimit(cfg, "telegram")).toBe(4000);
});
});