Repository navigation
fix(proxy): replace documents DeepSeek refuses with a note - #73
Merged
Merged
Conversation
DeepSeek's Anthropic-shaped endpoint accepts a document block only from a `text` or `file` source and answers a 400 for the whole body otherwise. Claude Code attaches a PDF it has read as a base64 document, which then sits in history, so every later request of the session failed too. A request bound for DeepSeek now has such blocks replaced by a text note saying a document was attached and could not be sent. The note is a pure function of the block, so the cached prefix is not disturbed. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01G6dpqKZuw9vLYFzGPuKppp
The document pass's log line moves into the media module, where the count is produced. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01G6dpqKZuw9vLYFzGPuKppp
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #73 +/- ##
==========================================
+ Coverage 80.28% 80.29% +0.01%
==========================================
Files 248 249 +1
Lines 76232 76333 +101
==========================================
+ Hits 61205 61294 +89
- Misses 15027 15039 +12
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
DeepSeek's Anthropic-shaped endpoint accepts a
documentblock only from atextorfilesource and answers a 400 for the whole body otherwise:Claude Code attaches a PDF it has read as a base64 document. The block then sits in history, so every later request of the session fails too and the session is stuck.
Fix
A request bound for DeepSeek now has each such block replaced by a text note saying a document was attached and could not be sent, so the model can extract the text with a tool instead.
media.rsmodule intab-atelier-proxy, called from the relay's body shaping.tool_resultare found too.cache_controlbreakpoint on the block is kept on the note.textandfiledocument sources, and images, are left alone.Testing
Clippy on the proxy crate is clean and its test suite passes, including five new unit tests in
media.rs.Generated by Claude Code