fix(tui): keep selected model name updated

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
taorye 2026-03-09 18:34:03 +08:00 committed by GitHub
parent 3a90e1945f
commit 6214f2308f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -103,7 +103,11 @@ func (s *appState) modelForm(index int) tview.Primitive {
s.showMessage("Duplicate model name", fmt.Sprintf("Model Name '%s' already exists", value)) s.showMessage("Duplicate model name", fmt.Sprintf("Model Name '%s' already exists", value))
return return
} }
oldName := model.ModelName
model.ModelName = value model.ModelName = value
if s.config.Agents.Defaults.Model == oldName {
s.config.Agents.Defaults.Model = value
}
s.dirty = true s.dirty = true
form.SetTitle(fmt.Sprintf("Model: %s", model.ModelName)) form.SetTitle(fmt.Sprintf("Model: %s", model.ModelName))
refreshMainMenuIfPresent(s) refreshMainMenuIfPresent(s)