fix: adjust vision capability check to not block when no model resolved
- Only block when a resolved model is explicitly not vision-capable - Set up vision cache in model passthrough test for proper isolation
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import { describe, expect, test, mock } from "bun:test"
|
import { describe, expect, test, mock } from "bun:test"
|
||||||
import type { ToolContext } from "@opencode-ai/plugin/tool"
|
import type { ToolContext } from "@opencode-ai/plugin/tool"
|
||||||
|
import { setVisionCapableModelsCache } from "../../shared/vision-capable-models-cache"
|
||||||
import { normalizeArgs, validateArgs, createLookAt } from "./tools"
|
import { normalizeArgs, validateArgs, createLookAt } from "./tools"
|
||||||
|
|
||||||
describe("look-at tool", () => {
|
describe("look-at tool", () => {
|
||||||
@@ -255,6 +256,8 @@ describe("look-at tool", () => {
|
|||||||
// when LookAt tool executed
|
// when LookAt tool executed
|
||||||
// then model info should be passed to sync prompt
|
// then model info should be passed to sync prompt
|
||||||
test("passes multimodal-looker model to sync prompt when available", async () => {
|
test("passes multimodal-looker model to sync prompt when available", async () => {
|
||||||
|
setVisionCapableModelsCache(new Map([["google/gemini-3-flash", { providerID: "google", modelID: "gemini-3-flash" }]]))
|
||||||
|
|
||||||
let promptBody: any
|
let promptBody: any
|
||||||
|
|
||||||
const mockClient = {
|
const mockClient = {
|
||||||
|
|||||||
@@ -148,11 +148,11 @@ Be thorough on what was requested, concise on everything else.
|
|||||||
If the requested information is not found, clearly state what is missing.`
|
If the requested information is not found, clearly state what is missing.`
|
||||||
|
|
||||||
const { agentModel, agentVariant } = await resolveMultimodalLookerAgentMetadata(ctx)
|
const { agentModel, agentVariant } = await resolveMultimodalLookerAgentMetadata(ctx)
|
||||||
if (!agentModel || !isVisionCapableResolvedModel(agentModel)) {
|
if (agentModel && !isVisionCapableResolvedModel(agentModel)) {
|
||||||
log("[look_at] No vision-capable multimodal-looker model resolved", {
|
log("[look_at] Resolved model is not vision-capable, blocking", {
|
||||||
resolvedModel: agentModel,
|
resolvedModel: agentModel,
|
||||||
})
|
})
|
||||||
return "Error: No vision-capable multimodal-looker model available"
|
return "Error: Resolved multimodal-looker model is not vision-capable"
|
||||||
}
|
}
|
||||||
|
|
||||||
log(`[look_at] Creating session with parent: ${toolContext.sessionID}`)
|
log(`[look_at] Creating session with parent: ${toolContext.sessionID}`)
|
||||||
@@ -204,7 +204,7 @@ Original error: ${createResult.error}`
|
|||||||
{ type: "text", text: prompt },
|
{ type: "text", text: prompt },
|
||||||
filePart,
|
filePart,
|
||||||
],
|
],
|
||||||
model: { providerID: agentModel.providerID, modelID: agentModel.modelID },
|
...(agentModel ? { model: { providerID: agentModel.providerID, modelID: agentModel.modelID } } : {}),
|
||||||
...(agentVariant ? { variant: agentVariant } : {}),
|
...(agentVariant ? { variant: agentVariant } : {}),
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user