Repository navigation
gateway: preserve Gemini PDF and audio file data on text-only routes - #95
Conversation
|
Thanks! The idea is right: a PDF or audio
Main rejects that turn cleanly as an image the route can't take, or falls back to a model that can. With the patch it becomes an upstream 400 from the text-only model instead. To merge this, |
|
Thanks for v2. The Chat side is fixed now: no more Same request, So a Gemini model that used to receive the PDF now gets a line of text instead. Suggested fix: keep the file in the IR (as a |
|
Thanks for v3. The Code Assist path is fixed now. I pulled it and checked:
One regression is left. Please:
After that I'm happy to merge. |
3d7580a to
6b55bbe
Compare
|
Thanks — v4 addresses both points. I pulled it, merged it onto current main, and checked:
Merged; it will ship in the next release. |
Problem
On a Gemini request routed to a known text-only model, Magpie treats every
fileDatapart as an image. A PDF or audio file can therefore be rejected as an unsupported current image or replaced with an "Image omitted" placeholder in history, even though it is not an image. This loses user input that the destination might otherwise handle.Fix
Check
fileData.mimeTypebefore classifying the part as an image. Keep declared PDF/audio files intact; continue blocking actualimage/*files. Missing or malformed MIME information stays on the conservative image path.Tests
TestGeminiTextOnlyBodyKeepsNonImageFileDatafails on main for PDF and audio, and passes with the fix; it checks that image files remain blocked.go test -race ./internal/gateway -count=1,go vet ./internal/gateway, andgit diff --checkpass.go test ./...is not green in this workspace: the GUI needs GTK4/WebKit packages, and the unrelated existinginternal/provider/TestClaudeLoginsfails even when rerun alone. The gateway suite is green.AI assistance: an AI coding assistant helped investigate, write the patch and tests, and run the checks. I reviewed the changes.