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",
|
"name": "vision-bridge",
|
||||||
"version": "0.2.0",
|
"version": "0.2.1",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"description": "Opencode plugin: bridges images to a vision model when the active model cannot see images.",
|
"description": "Opencode plugin: bridges images to a vision model when the active model cannot see images.",
|
||||||
"main": "src/vision-bridge.ts",
|
"main": "src/vision-bridge.ts",
|
||||||
|
|||||||
@@ -147,19 +147,19 @@ export const VisionBridge: Plugin = async (_input: any, options: any = {}) => {
|
|||||||
const pBase = p?.options?.baseURL
|
const pBase = p?.options?.baseURL
|
||||||
const pKey = p?.options?.apiKey
|
const pKey = p?.options?.apiKey
|
||||||
if (pBase && pKey) {
|
if (pBase && pKey) {
|
||||||
let pmodel = resolveTemplates(options.model) || ""
|
// Prefer the provider block's own vision model (attachment: true).
|
||||||
if (!pmodel) {
|
// options.model only as a last-resort fallback.
|
||||||
for (const [id, m] of Object.entries<any>(p?.models ?? {})) {
|
let pmodel = ""
|
||||||
if (m?.attachment === true) {
|
for (const [id, m] of Object.entries<any>(p?.models ?? {})) {
|
||||||
pmodel = typeof m?.id === "string" && m.id ? m.id : id
|
if (m?.attachment === true) {
|
||||||
break
|
pmodel = typeof m?.id === "string" && m.id ? m.id : id
|
||||||
}
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
providerInfo = {
|
providerInfo = {
|
||||||
baseURL: String(pBase).replace(/\/$/, ""),
|
baseURL: String(pBase).replace(/\/$/, ""),
|
||||||
apiKey: pKey,
|
apiKey: pKey,
|
||||||
visionModel: pmodel || DEFAULT_MODEL,
|
visionModel: pmodel || resolveTemplates(options.model) || DEFAULT_MODEL,
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user