Skip to content

Commit 52a1b86

Browse files
authored
Merge pull request #84 from browser-use/alex/revert-83-unsupported-parts
Revert: trust user-declared modalities in openai-compatible
2 parents 8f9db17 + 08cd48c commit 52a1b86

1 file changed

Lines changed: 0 additions & 15 deletions

File tree

packages/opencode/src/provider/transform.ts

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -390,21 +390,6 @@ function applyCaching(msgs: ModelMessage[], model: Provider.Model): ModelMessage
390390
}
391391

392392
function unsupportedParts(msgs: ModelMessage[], model: Provider.Model): ModelMessage[] {
393-
// @ai-sdk/openai-compatible is the user-configured proxy provider — there is
394-
// no models.dev entry to consult, so model.capabilities.input.{image,audio,
395-
// video,pdf} all silently default to false (provider.ts:1298-1304) unless
396-
// the user explicitly declares `modalities` in opencode.json. Replacing
397-
// every image/file part with an inline ERROR text part in that case is a
398-
// silent footgun: bcode strips the screenshot before the wire and the
399-
// model receives "ERROR: Cannot read image..." as if it came from the user,
400-
// producing nonsensical replies ("I can't see the image"). The honest
401-
// behavior is to forward the part — upstream returns a real provider error
402-
// if it truly can't handle it, which is far more debuggable than fabricated
403-
// capability text. Native providers (@ai-sdk/anthropic, @ai-sdk/openai,
404-
// @ai-sdk/google, @ai-sdk/amazon-bedrock) keep the check because models.dev
405-
// is authoritative for them.
406-
if (model.api.npm === "@ai-sdk/openai-compatible") return msgs
407-
408393
return msgs.map((msg) => {
409394
if (msg.role !== "user" || !Array.isArray(msg.content)) return msg
410395

0 commit comments

Comments
 (0)