import assert from "node:assert/strict"; import { describe, it } from "node:test"; import { buildVisionContentParts, textFromMessageContent } from "../../src/lib/llm/content"; describe("llm content helpers", () => { it("reads plain string content", () => { assert.equal(textFromMessageContent("hello"), "hello"); }); it("joins text parts from multimodal content", () => { assert.equal( textFromMessageContent([ { type: "text", text: "first" }, { type: "image_url", image_url: { url: "data:image/png;base64,abc" } }, { type: "text", text: "second" }, ]), "first\nsecond", ); }); it("builds vision parts with fallback prompt when text is empty", () => { const parts = buildVisionContentParts("", ["data:image/jpeg;base64,abc"]); assert.equal(parts.length, 2); assert.equal(parts[0]?.type, "text"); assert.equal(parts[1]?.type, "image_url"); }); });