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 { detectThinkKeyword, extractPromptText } from "./detector"
|
||||||
import { getHighVariant, isAlreadyHighVariant } from "./switcher"
|
import { isAlreadyHighVariant } from "./switcher"
|
||||||
import type { ThinkModeState } from "./types"
|
import type { ThinkModeState } from "./types"
|
||||||
import { log } from "../../shared"
|
import { log } from "../../shared"
|
||||||
|
|
||||||
@@ -56,22 +56,10 @@ export function createThinkModeHook() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const highVariant = getHighVariant(currentModel.modelID)
|
output.message.variant = "high"
|
||||||
|
state.modelSwitched = false
|
||||||
if (highVariant) {
|
state.variantSet = true
|
||||||
output.message.model = {
|
log("Think mode: variant set to high", { sessionID })
|
||||||
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,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
thinkModeState.set(sessionID, state)
|
thinkModeState.set(sessionID, state)
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user