mirror of
https://github.com/sune-org/us.proxy.sune.chat.git
synced 2026-08-07 07:25:46 +00:00
Fix: Add PDF document support for Claude streaming
Co-authored-by: gemini-3.6-flash <noreply@google.com>
This commit is contained in:
11
providers.js
11
providers.js
@@ -158,6 +158,17 @@ export async function streamClaude({ apiKey, body, signal, onDelta, isRunning })
|
|||||||
const match = String(p.image_url?.url || p.image_url || '').match(/^data:(image\/\w+);base64,(.*)$/)
|
const match = String(p.image_url?.url || p.image_url || '').match(/^data:(image\/\w+);base64,(.*)$/)
|
||||||
if (match) return { type: 'image', source: { type: 'base64', media_type: match[1], data: match[2] } }
|
if (match) return { type: 'image', source: { type: 'base64', media_type: match[1], data: match[2] } }
|
||||||
}
|
}
|
||||||
|
if (p.type === 'document' && p.source) return p
|
||||||
|
if (p.type === 'file' && p.file?.file_data) {
|
||||||
|
return {
|
||||||
|
type: 'document',
|
||||||
|
source: {
|
||||||
|
type: 'base64',
|
||||||
|
media_type: 'application/pdf',
|
||||||
|
data: p.file.file_data,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
return null
|
return null
|
||||||
}).filter(Boolean),
|
}).filter(Boolean),
|
||||||
})).filter(m => m.content.length),
|
})).filter(m => m.content.length),
|
||||||
|
|||||||
Reference in New Issue
Block a user