mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 09:31:25 +00:00
refactor(shared): reuse chat content extractor for assistant text
This commit is contained in:
@@ -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", () => {
|
||||
|
||||
Reference in New Issue
Block a user