[Bug] dsh-llm-pi-ai sends non png/jpeg/gif images as-is; LM Studio rejects webp with 400 "'url' field must be a base64 encoded image." #4615
Replies: 1 comment
|
The reproduced matrix exposes a capability gap that is slightly broader than conversion: rc.2 has three different image capability owners, but only one is modeled on the provider route.
So I agree that conversion can contain LM Studio incompatibility, but I would not use a catch-and-send-original fallback. Once the route is known to reject WebP, a converter failure should remain a typed local failure; sending the original turns a useful decoder/resource error back into the misleading remote 400. I would also keep the original content-addressed attachment immutable and create a derived rendition keyed by source digest plus target MIME, encoder/version, size limits, animation policy, orientation/color rules, and quality. Animated WebP/GIF needs an explicit first-frame/all-frame/reject policy; PNG conversion is not semantically neutral. The route should declare supported MIME types so unsupported input can fail before egress when conversion is unavailable or disallowed. I mapped the current rc.2 path, safe rendition boundary, decoder limits, and a provider conformance matrix here: https://sandbaseai.github.io/deepseek-harness-handbook/pi-ai-image-media-type.html The LM Studio accept/reject matrix remains attributed to this report; I independently verified the DSH storage and conversion source. Disclosure: I maintain the independent community handbook linked above. |
Uh oh!
There was an error while loading. Please reload this page.
Summary
When a user pastes an image into the GUI,
dsh-llm-pi-aiserializes it asdata:<mimeType>;base64,<data>and sends it to the configured backend.Strict OpenAI-compatible backends (LM Studio) only accept
image/png | jpeg | gifdata URIs; webp, bmp, heic, etc. are rejected atthe protocol layer with HTTP 400
"'url' field must be a base64 encoded image.".Environment
0.1.1-rc.2llm-pi-ai,api: openai-completions, baseURL → LM Studioqwen/qwen3.8-27bwithinput: [text, image]Steps to reproduce
page screenshot — very common).
Root cause
Verified directly against the backend — the rejection is a mime whitelist
check, not a base64 validity check:
data:image/png;base64,…data:image/jpeg;base64,…data:image/gif;base64,…data:image/webp;base64,…data:image/bmp;base64,…data:image/heic;base64,…DSH correctly provides base64 bytes; the problem is only the mime type.
dsh-llm-pi-aiuserContent()pushes{ type: "image", data: <base64>, mimeType: <original> }, which pi-ai thenserializes to
data:<original>;base64,…— so any format outside the whitelistfails on every request.
Suggested fix
In the pi-ai adapter (or in
dsh-llm-pi-aiconversion), transcode imagecontent that is not
image/png|jpeg|gifto PNG before sending.sharpisalready available in the profile dependency tree (verified:
sharp(webpBuf).png().toBuffer()round-trips correctly).At minimum, document this backend limitation.
Workaround (local)
We transcode in
userContent()before pushing the image block (sharp, with abest-effort fallback that keeps original bytes); happy to PR this if useful.
All reactions