1
0
forked from boos/BoosAPI

feat: update input_file data format to include data URL scheme

This commit is contained in:
cita
2026-03-09 15:45:43 +08:00
parent 44799c0399
commit 3da1b93c39
6 changed files with 25 additions and 9 deletions
@@ -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),
};
}