fix: sync model tier between TUI and WebChat when switching models

ModelRouter now supports multiple tier-change listeners via addOnTierChange(),
SessionBridge subscribes to tier changes and propagates them to all WebChat
agents (both existing and newly created), and the fullscreen TUI now also
updates the agent's tier when switching models (matching minimal TUI behavior).
This commit is contained in:
William Valentin
2026-02-10 20:22:40 -08:00
parent bf9ca690f3
commit 7a69794418
3 changed files with 38 additions and 5 deletions
+4
View File
@@ -191,6 +191,10 @@ export function App({
}
const tier = resolveModelAlias(command.name);
if (modelRouter.setTier(tier)) {
// Also update the agent tier so chatWithRouter uses the correct client
if (agent) {
agent.setModelTier(tier);
}
setCurrentModel(tier);
const successMsg: Message = { role: 'assistant', content: `Switched to model: ${tier}` };
const successWithTs = session.addMessage(successMsg);