fix(tui): include variant in model switch notice (#34856)

Co-authored-by: Aiden Cline <aidenpcline@gmail.com>
This commit is contained in:
opencode-agent[bot] 2026-07-02 00:17:18 -05:00 committed by GitHub
commit cfd35c9354
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 22 additions and 3 deletions

View file

@ -71,6 +71,7 @@ import { OPENCODE_BASE_MODE, useBindings, useCommandShortcut } from "../../keyma
import { usePathFormatter } from "../../context/path-format"
import { LocationProvider } from "../../context/location"
import { createSessionRows, type PartRef, type SessionRow } from "./rows"
import { switchLabel } from "../../util/model"
addDefaultParsers(parsers.parsers)
@ -1231,8 +1232,7 @@ function SessionSwitchMessageV2(props: { message: SessionMessage }) {
const { theme } = useTheme()
const text = () => {
if (props.message.type === "agent-switched") return `Switched agent to ${props.message.agent}`
if (props.message.type === "model-switched")
return `Switched model to ${props.message.model.providerID}/${props.message.model.id}`
if (props.message.type === "model-switched") return switchLabel(props.message.model)
return ""
}
return <text fg={theme.textMuted}>{text()}</text>

View file

@ -26,3 +26,11 @@ export function name(
) {
return get(list, providerID, modelID)?.name ?? modelID
}
export function formatRef(model: { providerID: string; id: string; variant?: string }) {
return [model.providerID, model.id, model.variant].filter((value) => value !== undefined).join("/")
}
export function switchLabel(model: { providerID: string; id: string; variant?: string }) {
return `Switched model to ${formatRef(model)}`
}