refactor(shared): reuse chat content extractor for assistant text

This commit is contained in:
Peter Steinberger
2026-02-17 00:53:38 +00:00
parent ddef3cadba
commit f452a7a60b
4 changed files with 41 additions and 39 deletions

View File

@@ -30,6 +30,22 @@ describe("extractTextFromChatContent", () => {
}),
).toBe("Here ok");
});
it("supports custom join and normalization", () => {
expect(
extractTextFromChatContent(
[
{ type: "text", text: " hello " },
{ type: "text", text: "world " },
],
{
sanitizeText: (text) => text.trim(),
joinWith: "\n",
normalizeText: (text) => text.trim(),
},
),
).toBe("hello\nworld");
});
});
describe("shared/frontmatter", () => {