forked from boos/BoosAPI
feat: update input_file data format to include data URL scheme
This commit is contained in:
@@ -71,7 +71,7 @@ describe('proxyInputFileResolver', () => {
|
||||
type: 'input_file',
|
||||
file_id: 'file-metapi-123',
|
||||
filename: 'brief.pdf',
|
||||
file_data: Buffer.from('%PDF-local').toString('base64'),
|
||||
file_data: `data:application/pdf;base64,${Buffer.from('%PDF-local').toString('base64')}`,
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import type { ProxyResourceOwner } from '../middleware/auth.js';
|
||||
import { getProxyFileByPublicIdForOwner, LOCAL_PROXY_FILE_ID_PREFIX } from './proxyFileStore.js';
|
||||
import { ensureBase64DataUrl } from '../transformers/shared/inputFile.js';
|
||||
|
||||
function isRecord(value: unknown): value is Record<string, unknown> {
|
||||
return !!value && typeof value === 'object' && !Array.isArray(value);
|
||||
@@ -213,7 +214,7 @@ function toResponsesResolvedBlock(file: { fileId?: string; filename: string; fil
|
||||
type: 'input_file',
|
||||
...(file.fileId ? { file_id: file.fileId } : {}),
|
||||
filename: file.filename,
|
||||
file_data: file.fileData,
|
||||
file_data: ensureBase64DataUrl(file.fileData, file.mimeType),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user