@@ -70,7 +70,7 @@ const (
70// ModelsID is the identifier for the model selection dialog.
70// ModelsID is the identifier for the model selection dialog.
71const ModelsID = "models"
71const ModelsID = "models"
73−const defaultModelsDialogMaxWidth = 70
73+const defaultModelsDialogMaxWidth = 73
75// Models represents a model selection dialog.
75// Models represents a model selection dialog.
76type Models struct {
76type Models struct {
@@ -84,6 +84,7 @@ type Models struct {
84 Tab key.Binding
84 Tab key.Binding
85 UpDown key.Binding
85 UpDown key.Binding
86 Select key.Binding
86 Select key.Binding
87 Next key.Binding
88 Next key.Binding
88 Previous key.Binding
89 Previous key.Binding
89 Close key.Binding
90 Close key.Binding
@@ -124,6 +125,10 @@ func NewModels(com *common.Common, isOnboarding bool) (*Models, error) {
124 key.WithKeys("enter", "ctrl+y"),
125 key.WithKeys("enter", "ctrl+y"),
125 key.WithHelp("enter", "confirm"),
126 key.WithHelp("enter", "confirm"),
128+ m.keyMap.Edit = key.NewBinding(
129+ key.WithKeys("ctrl+e"),
130+ key.WithHelp("ctrl+e", "edit"),
127 m.keyMap.UpDown = key.NewBinding(
132 m.keyMap.UpDown = key.NewBinding(
128 key.WithKeys("up", "down"),
133 key.WithKeys("up", "down"),
129 key.WithHelp("↑/↓", "choose"),
134 key.WithHelp("↑/↓", "choose"),
@@ -181,7 +186,7 @@ func (m *Models) HandleMsg(msg tea.Msg) Action {
182 m.list.SelectNext()
187 m.list.SelectNext()
183 m.list.ScrollToSelected()
188 m.list.ScrollToSelected()
184− case key.Matches(msg, m.keyMap.Select):
189+ case key.Matches(msg, m.keyMap.Select, m.keyMap.Edit):
185 selectedItem := m.list.SelectedItem()
190 selectedItem := m.list.SelectedItem()
186 if selectedItem == nil {
191 if selectedItem == nil {
@@ -192,10 +197,13 @@ func (m *Models) HandleMsg(msg tea.Msg) Action {
200+ isEdit := key.Matches(msg, m.keyMap.Edit)
195 return ActionSelectModel{
202 return ActionSelectModel{
196− Provider: modelItem.prov,
203+ Provider: modelItem.prov,
197− Model: modelItem.SelectedModel(),
204+ Model: modelItem.SelectedModel(),
198− ModelType: modelItem.SelectedModelType(),
205+ ModelType: modelItem.SelectedModelType(),
206+ ReAuthenticate: isEdit,
200 case key.Matches(msg, m.keyMap.Tab):
208 case key.Matches(msg, m.keyMap.Tab):
201 if m.isOnboarding {
209 if m.isOnboarding {
@@ -309,27 +317,35 @@ func (m *Models) ShortHelp() []key.Binding {
309 m.keyMap.Select,
317 m.keyMap.Select,
312− return []key.Binding{
320+ h := []key.Binding{
313 m.keyMap.UpDown,
321 m.keyMap.UpDown,
314 m.keyMap.Tab,
322 m.keyMap.Tab,
315 m.keyMap.Select,
323 m.keyMap.Select,
325+ if m.isSelectedConfigured() {
326+ h = append(h, m.keyMap.Edit)
328+ h = append(h, m.keyMap.Close)
320// FullHelp returns the full help view.
332// FullHelp returns the full help view.
321func (m *Models) FullHelp() [][]key.Binding {
333func (m *Models) FullHelp() [][]key.Binding {
322− return [][]key.Binding{
334+ return [][]key.Binding{m.ShortHelp()}
324− m.keyMap.Select,
336+
325− m.keyMap.Next,
337+func (m *Models) isSelectedConfigured() bool {
326− m.keyMap.Previous,
338+ selectedItem := m.list.SelectedItem()
327− m.keyMap.Tab,
339+ if selectedItem == nil {
329− {
342+ modelItem, ok := selectedItem.(*ModelItem)
330− m.keyMap.Close,
343+ if !ok {
346+ providerID := string(modelItem.prov.ID)
347+ _, isConfigured := m.com.Config().Providers.Get(providerID)
335// setProviderItems sets the provider items in the list.
351// setProviderItems sets the provider items in the list.