@@ -535,7 +535,12 @@ func (p *chatPage) toggleThinking() tea.Cmd {
536 // Toggle the thinking mode
536 // Toggle the thinking mode
537 currentModel.Think = !currentModel.Think
537 currentModel.Think = !currentModel.Think
538− cfg.Models[agentCfg.Model] = currentModel
538+ if err := cfg.UpdatePreferredModel(agentCfg.Model, currentModel); err != nil {
539+ return util.InfoMsg{
540+ Type: util.InfoTypeError,
541+ Msg: "Failed to update thinking mode: " + err.Error(),
540 // Update the agent with the new configuration
545 // Update the agent with the new configuration
541 if err := p.app.UpdateAgentModel(context.TODO()); err != nil {
546 if err := p.app.UpdateAgentModel(context.TODO()); err != nil {