Browse Source

tweak: adjust agent variant logic to not require exact match on model, and instead check if the variant is available for model (#12838)

Aiden Cline 2 weeks ago
parent
commit
8ad4768ecd
1 changed files with 5 additions and 8 deletions
  1. 5 8
      packages/opencode/src/session/prompt.ts

+ 5 - 8
packages/opencode/src/session/prompt.ts

@@ -843,14 +843,11 @@ export namespace SessionPrompt {
     const agent = await Agent.get(input.agent ?? (await Agent.defaultAgent()))
 
     const model = input.model ?? agent.model ?? (await lastModel(input.sessionID))
-    const variant =
-      input.variant ??
-      (agent.variant &&
-      agent.model &&
-      model.providerID === agent.model.providerID &&
-      model.modelID === agent.model.modelID
-        ? agent.variant
-        : undefined)
+    const full =
+      !input.variant && agent.variant
+        ? await Provider.getModel(model.providerID, model.modelID).catch(() => undefined)
+        : undefined
+    const variant = input.variant ?? (agent.variant && full?.variants?.[agent.variant] ? agent.variant : undefined)
 
     const info: MessageV2.Info = {
       id: input.messageID ?? Identifier.ascending("message"),