fix: use provider block's own vision model on legacy fallback
When falling back to a provider block (providerID / legacy ludmila-ai), prefer the model flagged attachment:true in that block instead of the Google-default options.model. Prevents sending 'gemini-2.5-flash' to the ludmila endpoint which expects 'gemini/gemini-2.5-flash'.
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "vision-bridge",
|
||||
"version": "0.2.0",
|
||||
"version": "0.2.1",
|
||||
"type": "module",
|
||||
"description": "Opencode plugin: bridges images to a vision model when the active model cannot see images.",
|
||||
"main": "src/vision-bridge.ts",
|
||||
|
||||
@@ -147,19 +147,19 @@ export const VisionBridge: Plugin = async (_input: any, options: any = {}) => {
|
||||
const pBase = p?.options?.baseURL
|
||||
const pKey = p?.options?.apiKey
|
||||
if (pBase && pKey) {
|
||||
let pmodel = resolveTemplates(options.model) || ""
|
||||
if (!pmodel) {
|
||||
for (const [id, m] of Object.entries<any>(p?.models ?? {})) {
|
||||
if (m?.attachment === true) {
|
||||
pmodel = typeof m?.id === "string" && m.id ? m.id : id
|
||||
break
|
||||
}
|
||||
// Prefer the provider block's own vision model (attachment: true).
|
||||
// options.model only as a last-resort fallback.
|
||||
let pmodel = ""
|
||||
for (const [id, m] of Object.entries<any>(p?.models ?? {})) {
|
||||
if (m?.attachment === true) {
|
||||
pmodel = typeof m?.id === "string" && m.id ? m.id : id
|
||||
break
|
||||
}
|
||||
}
|
||||
providerInfo = {
|
||||
baseURL: String(pBase).replace(/\/$/, ""),
|
||||
apiKey: pKey,
|
||||
visionModel: pmodel || DEFAULT_MODEL,
|
||||
visionModel: pmodel || resolveTemplates(options.model) || DEFAULT_MODEL,
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user