feat(caps): user-registered models trust upstream vision instead of stripping media
This commit is contained in:
@@ -317,6 +317,11 @@ export const PATTERN_CAPABILITIES = [
|
||||
{ pattern: "*ling-*", caps: { reasoning: true, contextWindow: 128000 } },
|
||||
];
|
||||
|
||||
// OpenRouter-style gateways validate modalities upstream — a text-only model
|
||||
// sent an image gets a clear upstream error instead of silent corruption. So for
|
||||
// unknown models on these providers, trust vision instead of stripping images.
|
||||
const TRUST_UPSTREAM_VISION = new Set(["openrouter"]);
|
||||
|
||||
/**
|
||||
* Resolve capabilities for a model using the 4-step fallback chain,
|
||||
* merged over DEFAULT_CAPABILITIES so the result is always complete.
|
||||
@@ -349,6 +354,9 @@ export function getCapabilitiesForModel(provider, model) {
|
||||
}
|
||||
}
|
||||
|
||||
// 4. Floor
|
||||
// 4. Floor (upstream-validated gateways keep vision on for unknown models)
|
||||
if (provider && TRUST_UPSTREAM_VISION.has(provider)) {
|
||||
return { ...DEFAULT_CAPABILITIES, vision: true };
|
||||
}
|
||||
return { ...DEFAULT_CAPABILITIES };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user