Forked from vadimfedenko/analyze-images
Forked from vadimfedenko/analyze-images
dist / inlineImage.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.inlineImage = inlineImage;
const sdk_1 = require("@lmstudio/sdk");
const attachmentIdentity_1 = require("./attachmentIdentity");
// SDK uploads are owned by the client connection and expire on disconnect.
// Embed bytes in the serialized message so saved chats can survive restarts.
function inlineImage(client, name, bytes) {
if (!bytes.length || bytes.length > attachmentIdentity_1.IMAGE_LIMIT)
throw new Error("Image exceeds inline attachment size limit.");
return sdk_1.ChatMessage.from({ role: "user", content: [{ type: "file", name,
identifier: `base64:${bytes.toString("base64")}`, sizeBytes: bytes.length, fileType: "image",
}] }).getFiles(client)[0];
}
//# sourceMappingURL=inlineImage.js.mapdist / inlineImage.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.inlineImage = inlineImage;
const sdk_1 = require("@lmstudio/sdk");
const attachmentIdentity_1 = require("./attachmentIdentity");
// SDK uploads are owned by the client connection and expire on disconnect.
// Embed bytes in the serialized message so saved chats can survive restarts.
function inlineImage(client, name, bytes) {
if (!bytes.length || bytes.length > attachmentIdentity_1.IMAGE_LIMIT)
throw new Error("Image exceeds inline attachment size limit.");
return sdk_1.ChatMessage.from({ role: "user", content: [{ type: "file", name,
identifier: `base64:${bytes.toString("base64")}`, sizeBytes: bytes.length, fileType: "image",
}] }).getFiles(client)[0];
}
//# sourceMappingURL=inlineImage.js.map