on main help sign in
fix: correct model selection index in models dialog
1649dd0Kujtim Hoxha
internal/tui/components/dialogs/models/models.go+3−3
@@ -97,13 +97,13 @@ func (m *modelDialogCmp) Init() tea.Cmd {
97 }
97 }
98 modelItems = append(modelItems, commands.NewItemSection(name))
98 modelItems = append(modelItems, commands.NewItemSection(name))
99 for _, model := range provider.Models {
99 for _, model := range provider.Models {
100− if model.ID == agentModel.ID && provider.ID == agentProvider.ID {
101− selectIndex = len(modelItems) // Set the selected index to the current model
102− }
103 modelItems = append(modelItems, completions.NewCompletionItem(model.Name, ModelOption{
100 modelItems = append(modelItems, completions.NewCompletionItem(model.Name, ModelOption{
104 Provider: provider,
101 Provider: provider,
105 Model: model,
102 Model: model,
106 }))
103 }))
104+ if model.ID == agentModel.ID && provider.ID == agentProvider.ID {
105+ selectIndex = len(modelItems) - 1 // Set the selected index to the current model
106+ }
107 }
107 }
108 }
108 }
109
109