Added official file support
All checks were successful
Publish Library / Build NPM Project (push) Successful in 50s
Publish Library / Tag Version (push) Successful in 13s

This commit is contained in:
2026-08-17 15:16:32 -04:00
parent 797a40a566
commit 5826573d5c
2 changed files with 4 additions and 1 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "@ztimson/ai-utils",
"version": "1.6.0",
"version": "1.6.1",
"description": "AI Utility library",
"author": "Zak Timson",
"license": "MIT",

View File

@@ -50,6 +50,8 @@ export type LLMMessage = {
role: 'assistant' | 'system' | 'user';
/** Message content */
content: string | any;
/** Files attached to request */
files?: LLMFile[];
/** Timestamp */
timestamp?: number;
/** Response duration in ms */
@@ -487,6 +489,7 @@ Linked: ${makeUnique([...r.links, ...r.backlinks]).join(', ')}
const lastMsg = history[history.length - 1];
const originalContent = lastMsg?.content;
if(files.length && lastMsg?.role === 'user') {
lastMsg.files = files;
const {text, images} = await this.resolveFiles(files);
const merged = text ? `${originalContent}\n\n${text}` : originalContent;
lastMsg.content = images.length