From 2ce2838895efd2210ff9e0ac66f28d424f694262 Mon Sep 17 00:00:00 2001 From: multipleof4 Date: Thu, 23 Jul 2026 11:04:51 -0700 Subject: [PATCH] Fix: Add PDF document support for Claude streaming Co-authored-by: gemini-3.6-flash --- providers.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/providers.js b/providers.js index 85c6fe6..ab1c59c 100644 --- a/providers.js +++ b/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,(.*)$/) 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 }).filter(Boolean), })).filter(m => m.content.length),