chore: small update

Kujtim Hoxha created

Change summary

internal/config/load.go                           | 6 ++++++
internal/config/load_test.go                      | 6 +++---
internal/fur/provider/provider.go                 | 2 +-
internal/tui/components/chat/messages/messages.go | 2 +-
internal/tui/components/chat/sidebar/sidebar.go   | 2 +-
internal/tui/components/dialogs/models/models.go  | 6 +++---
internal/tui/page/chat/chat.go                    | 2 +-
7 files changed, 16 insertions(+), 10 deletions(-)

Detailed changes

internal/config/load.go 🔗

@@ -145,6 +145,9 @@ func (cfg *Config) configureProviders(env env.Env, resolver VariableResolver, kn
 						continue
 					}
 					seen[model.ID] = true
+					if model.Model == "" {
+						model.Model = model.ID
+					}
 					models = append(models, model)
 				}
 				for _, model := range p.Models {
@@ -152,6 +155,9 @@ func (cfg *Config) configureProviders(env env.Env, resolver VariableResolver, kn
 						continue
 					}
 					seen[model.ID] = true
+					if model.Model == "" {
+						model.Model = model.ID
+					}
 					models = append(models, model)
 				}
 

internal/config/load_test.go 🔗

@@ -98,8 +98,8 @@ func TestConfig_configureProvidersWithOverride(t *testing.T) {
 				BaseURL: "https://api.openai.com/v2",
 				Models: []provider.Model{
 					{
-						ID:   "test-model",
-						Name: "Updated",
+						ID:    "test-model",
+						Model: "Updated",
 					},
 					{
 						ID: "another-model",
@@ -122,7 +122,7 @@ func TestConfig_configureProvidersWithOverride(t *testing.T) {
 	assert.Equal(t, "xyz", cfg.Providers["openai"].APIKey)
 	assert.Equal(t, "https://api.openai.com/v2", cfg.Providers["openai"].BaseURL)
 	assert.Len(t, cfg.Providers["openai"].Models, 2)
-	assert.Equal(t, "Updated", cfg.Providers["openai"].Models[0].Name)
+	assert.Equal(t, "Updated", cfg.Providers["openai"].Models[0].Model)
 }
 
 func TestConfig_configureProvidersWithNewProvider(t *testing.T) {

internal/fur/provider/provider.go 🔗

@@ -45,7 +45,7 @@ type Provider struct {
 // Model represents an AI model configuration.
 type Model struct {
 	ID                     string  `json:"id"`
-	Name                   string  `json:"model"`
+	Model                  string  `json:"model"`
 	CostPer1MIn            float64 `json:"cost_per_1m_in"`
 	CostPer1MOut           float64 `json:"cost_per_1m_out"`
 	CostPer1MInCached      float64 `json:"cost_per_1m_in_cached"`

internal/tui/components/chat/messages/messages.go 🔗

@@ -296,7 +296,7 @@ func (m *assistantSectionModel) View() string {
 	infoMsg := t.S().Subtle.Render(duration.String())
 	icon := t.S().Subtle.Render(styles.ModelIcon)
 	model := config.Get().GetModel(m.message.Provider, m.message.Model)
-	modelFormatted := t.S().Muted.Render(model.Name)
+	modelFormatted := t.S().Muted.Render(model.Model)
 	assistant := fmt.Sprintf("%s %s %s", icon, modelFormatted, infoMsg)
 	return t.S().Base.PaddingLeft(2).Render(
 		core.Section(assistant, m.width-2),

internal/tui/components/chat/sidebar/sidebar.go 🔗

@@ -481,7 +481,7 @@ func (s *sidebarCmp) currentModelBlock() string {
 	t := styles.CurrentTheme()
 
 	modelIcon := t.S().Base.Foreground(t.FgSubtle).Render(styles.ModelIcon)
-	modelName := t.S().Text.Render(model.Name)
+	modelName := t.S().Text.Render(model.Model)
 	modelInfo := fmt.Sprintf("%s %s", modelIcon, modelName)
 	parts := []string{
 		modelInfo,

internal/tui/components/dialogs/models/models.go 🔗

@@ -264,7 +264,7 @@ func (m *modelDialogCmp) SetModelType(modelType int) tea.Cmd {
 			for i, model := range providerConfig.Models {
 				configProvider.Models[i] = provider.Model{
 					ID:                     model.ID,
-					Name:                   model.Name,
+					Model:                  model.Model,
 					CostPer1MIn:            model.CostPer1MIn,
 					CostPer1MOut:           model.CostPer1MOut,
 					CostPer1MInCached:      model.CostPer1MInCached,
@@ -285,7 +285,7 @@ func (m *modelDialogCmp) SetModelType(modelType int) tea.Cmd {
 			}
 			modelItems = append(modelItems, commands.NewItemSection(name))
 			for _, model := range configProvider.Models {
-				modelItems = append(modelItems, completions.NewCompletionItem(model.Name, ModelOption{
+				modelItems = append(modelItems, completions.NewCompletionItem(model.Model, ModelOption{
 					Provider: configProvider,
 					Model:    model,
 				}))
@@ -315,7 +315,7 @@ func (m *modelDialogCmp) SetModelType(modelType int) tea.Cmd {
 		}
 		modelItems = append(modelItems, commands.NewItemSection(name))
 		for _, model := range provider.Models {
-			modelItems = append(modelItems, completions.NewCompletionItem(model.Name, ModelOption{
+			modelItems = append(modelItems, completions.NewCompletionItem(model.Model, ModelOption{
 				Provider: provider,
 				Model:    model,
 			}))

internal/tui/page/chat/chat.go 🔗

@@ -175,7 +175,7 @@ func (p *chatPage) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
 			if model.SupportsImages {
 				return p, util.CmdHandler(OpenFilePickerMsg{})
 			} else {
-				return p, util.ReportWarn("File attachments are not supported by the current model: " + model.Name)
+				return p, util.ReportWarn("File attachments are not supported by the current model: " + model.Model)
 			}
 		case key.Matches(msg, p.keyMap.Tab):
 			if p.session.ID == "" {