fix(agent): resolve S3 MIME type detection and prompt parameter in image analysis

This commit is contained in:
yiling
2026-07-28 14:28:41 +08:00
parent f46fa31262
commit 3727879c19
7 changed files with 64 additions and 44 deletions
+4 -1
View File
@@ -106,11 +106,14 @@ export function createAnalyzeImageTool(
const bucket = process.env.S3_BUCKET || 'shumai'
const { buffer, contentType } = await s3Service.getObject(bucket, keyToUse)
const mimeType =
contentType && contentType !== 'application/octet-stream' ? contentType : 'image/webp'
const content: ImageContent[] = [
{
type: 'image',
data: buffer.toString('base64'),
mimeType: contentType || 'image/webp',
mimeType,
},
]
+3 -1
View File
@@ -121,10 +121,12 @@ export function createReadPdfPagesTool(
for (const pageItem of pages) {
const { buffer, contentType } = await s3Service.getObject(bucket, pageItem.key)
const mimeType =
contentType && contentType !== 'application/octet-stream' ? contentType : 'image/webp'
content.push({
type: 'image',
data: buffer.toString('base64'),
mimeType: contentType || 'image/webp',
mimeType,
})
sourceKeys.push(pageItem.key)
}
+3 -1
View File
@@ -102,10 +102,12 @@ export function createScreenshotTool(
for (const shot of screenshots) {
const { buffer, contentType } = await s3Service.getObject(bucket, shot.key)
const mimeType =
contentType && contentType !== 'application/octet-stream' ? contentType : 'image/webp'
content.push({
type: 'image',
data: buffer.toString('base64'),
mimeType: contentType || 'image/webp',
mimeType,
})
sourceKeys.push(shot.key)
}