fix(think-mode): remove modelID modification, only set variant
The hook was incorrectly setting output.message.model.modelID to non-existent variants like gpt-5-nano-high, causing ProviderModelNotFoundError. OpenCode's native variant system only needs the variant field - it handles the transformation automatically. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { detectThinkKeyword, extractPromptText } from "./detector"
|
||||
import { getHighVariant, isAlreadyHighVariant } from "./switcher"
|
||||
import { isAlreadyHighVariant } from "./switcher"
|
||||
import type { ThinkModeState } from "./types"
|
||||
import { log } from "../../shared"
|
||||
|
||||
@@ -56,22 +56,10 @@ export function createThinkModeHook() {
|
||||
return
|
||||
}
|
||||
|
||||
const highVariant = getHighVariant(currentModel.modelID)
|
||||
|
||||
if (highVariant) {
|
||||
output.message.model = {
|
||||
providerID: currentModel.providerID,
|
||||
modelID: highVariant,
|
||||
}
|
||||
output.message.variant = "high"
|
||||
state.modelSwitched = true
|
||||
state.variantSet = true
|
||||
log("Think mode: model switched to high variant", {
|
||||
sessionID,
|
||||
from: currentModel.modelID,
|
||||
to: highVariant,
|
||||
})
|
||||
}
|
||||
output.message.variant = "high"
|
||||
state.modelSwitched = false
|
||||
state.variantSet = true
|
||||
log("Think mode: variant set to high", { sessionID })
|
||||
|
||||
thinkModeState.set(sessionID, state)
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user