feat(agent): add voice input and photo attachments to assistant
Wire mic through Whisper-compatible transcriptions on LLM_BASE_URL. Photos upload to MinIO and reach the vision model as base64 image_url parts.
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
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");
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user