Added official file support
Publish Library / Build NPM Project (push) Successful in 58s
Publish Library / Tag Version (push) Successful in 13s

This commit is contained in:
2026-08-16 15:40:50 -04:00
parent 7308927a3c
commit 797a40a566
5 changed files with 488 additions and 212 deletions
+8 -1
View File
@@ -25,6 +25,13 @@ export class OpenAi extends LLMProvider {
return client;
}
private toWireContent(content: any): any {
if(!Array.isArray(content)) return content;
return content.map(c => c.type === 'image'
? {type: 'image_url', image_url: {url: `data:${c.mime};base64,${c.data}`}}
: {type: 'text', text: c.text});
}
/** Convert standard history -> OpenAI wire format */
private toWire(history: LLMMessage[], system?: string): any[] {
const wire: any[] = [];
@@ -41,7 +48,7 @@ export class OpenAi extends LLMProvider {
content: h.error || h.content || '',
});
} else {
wire.push({role: h.role, content: h.content});
wire.push({role: h.role, content: this.toWireContent(h.content)});
}
}
return wire;