Added official file support
This commit is contained in:
@@ -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",
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user