Merge origin/main into codex/modeltester-attachment-review-fixes
This commit is contained in:
@@ -12,6 +12,10 @@ function asTrimmedString(value: unknown): string {
|
||||
return typeof value === 'string' ? value.trim() : '';
|
||||
}
|
||||
|
||||
function isImageMimeType(mimeType: string): boolean {
|
||||
return mimeType.toLowerCase().startsWith('image/');
|
||||
}
|
||||
|
||||
function parseJsonIfPossible(value: string): unknown {
|
||||
const trimmed = value.trim();
|
||||
if (!trimmed) return {};
|
||||
|
||||
@@ -50,6 +50,41 @@ describe('geminiGenerateContentTransformer.inbound', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('parses non-image inlineData parts into canonical file parts', () => {
|
||||
const result = geminiGenerateContentTransformer.parseRequest({
|
||||
model: 'gemini-2.5-pro',
|
||||
contents: [
|
||||
{
|
||||
role: 'user',
|
||||
parts: [
|
||||
{ text: 'summarize this pdf' },
|
||||
{
|
||||
inlineData: {
|
||||
mimeType: 'application/pdf',
|
||||
data: 'JVBERi0xLjQK',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
expect(result.error).toBeUndefined();
|
||||
expect(result.value?.messages).toEqual([
|
||||
{
|
||||
role: 'user',
|
||||
parts: [
|
||||
{ type: 'text', text: 'summarize this pdf' },
|
||||
{
|
||||
type: 'file',
|
||||
fileData: 'JVBERi0xLjQK',
|
||||
mimeType: 'application/pdf',
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
it('builds native Gemini requests from canonical envelopes', () => {
|
||||
const body = geminiGenerateContentTransformer.buildProtocolRequest({
|
||||
operation: 'generate',
|
||||
|
||||
Reference in New Issue
Block a user