mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-28 22:14:52 -07:00
fix(partUtils): display media type and size for inline data parts (#21358)
This commit is contained in:
@@ -63,7 +63,18 @@ export function partToString(
|
||||
return `[Function Response: ${part.functionResponse.name}]`;
|
||||
}
|
||||
if (part.inlineData !== undefined) {
|
||||
return `<${part.inlineData.mimeType}>`;
|
||||
const mimeType = part.inlineData.mimeType ?? 'unknown';
|
||||
const data = part.inlineData.data ?? '';
|
||||
const bytes = Math.ceil((data.length * 3) / 4);
|
||||
const kb = (bytes / 1024).toFixed(1);
|
||||
const category = mimeType.startsWith('audio/')
|
||||
? 'Audio'
|
||||
: mimeType.startsWith('video/')
|
||||
? 'Video'
|
||||
: mimeType.startsWith('image/')
|
||||
? 'Image'
|
||||
: 'Media';
|
||||
return `[${category}: ${mimeType}, ${kb} KB]`;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user