Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions cmd/cli/store/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func (s *StoreMethods) Save(LLMConfig LLMProvider) error {
Data: []byte(LLMConfig.APIKey),
})
if err != nil {
return errors.New("error storing credentials")
return fmt.Errorf("failed to store credentials in keyring: %w", err)
}
updated = true
break
Expand All @@ -99,7 +99,7 @@ func (s *StoreMethods) Save(LLMConfig LLMProvider) error {
Data: []byte(LLMConfig.APIKey),
})
if err != nil {
return errors.New("error storing credentials")
return fmt.Errorf("failed to store credentials in keyring: %w", err)
}
}

Expand All @@ -126,7 +126,7 @@ func (s *StoreMethods) DefaultLLMKey() (*LLMProvider, error) {

isConfigExists := StoreUtils.CheckConfig(configPath)
if !isConfigExists {
return nil, errors.New("config file Not exists")
return nil, fmt.Errorf("config file does not exist at %s, run 'commit llm setup' to create it", configPath)
}

data, err := os.ReadFile(configPath)
Expand All @@ -141,7 +141,7 @@ func (s *StoreMethods) DefaultLLMKey() (*LLMProvider, error) {
return nil, fmt.Errorf("config file format error: %w. Please delete the config and run setup again", err)
}
} else {
return nil, errors.New("config file is empty, Please add at least one LLM Key")
return nil, errors.New("config file is empty, run 'commit llm setup' to add your first LLM provider")
}

defaultLLM := cfg.Default
Expand All @@ -157,7 +157,7 @@ func (s *StoreMethods) DefaultLLMKey() (*LLMProvider, error) {
return &useModel, nil
}
}
return nil, errors.New("not found default model in config")
return nil, fmt.Errorf("default model '%s' not found in saved providers, run 'commit llm setup' to configure it", defaultLLM)
}

// ListSavedModels loads all persisted LLM provider configurations.
Expand All @@ -172,7 +172,7 @@ func ListSavedModels() (*Config, error) {

isConfigExists := StoreUtils.CheckConfig(configPath)
if !isConfigExists {
return nil, errors.New("config file not exists")
return nil, fmt.Errorf("config file does not exist at %s, run 'commit llm setup' to create it", configPath)
}

data, err := os.ReadFile(configPath)
Expand All @@ -187,7 +187,7 @@ func ListSavedModels() (*Config, error) {
return nil, fmt.Errorf("config file format error: %w. Please delete the config and run setup again", err)
}
} else {
return nil, errors.New("config file is empty, Please add at least one LLM Key")
return nil, errors.New("config file is empty, run 'commit llm setup' to add your first LLM provider")
}

return &cfg, nil
Expand All @@ -206,7 +206,7 @@ func ChangeDefault(Model types.LLMProvider) error {

isConfigExists := StoreUtils.CheckConfig(configPath)
if !isConfigExists {
return errors.New("config file not exists")
return fmt.Errorf("config file does not exist at %s, run 'commit llm setup' to create it", configPath)
}

data, err := os.ReadFile(configPath)
Expand Down Expand Up @@ -256,7 +256,7 @@ func (s *StoreMethods) DeleteModel(Model types.LLMProvider) error {

isConfigExists := StoreUtils.CheckConfig(configPath)
if !isConfigExists {
return errors.New("config file not exists")
return fmt.Errorf("config file does not exist at %s, run 'commit llm setup' to create it", configPath)
}

data, err := os.ReadFile(configPath)
Expand Down Expand Up @@ -318,7 +318,7 @@ func (s *StoreMethods) UpdateAPIKey(Model types.LLMProvider, APIKey string) erro

isConfigExists := StoreUtils.CheckConfig(configPath)
if !isConfigExists {
return errors.New("config file not exists")
return fmt.Errorf("config file does not exist at %s, run 'commit llm setup' to create it", configPath)
}

data, err := os.ReadFile(configPath)
Expand All @@ -342,7 +342,7 @@ func (s *StoreMethods) UpdateAPIKey(Model types.LLMProvider, APIKey string) erro
Data: []byte(APIKey),
})
if err != nil {
return errors.New("error storing credentials")
return fmt.Errorf("failed to update credentials in keyring: %w", err)
}
updated = true
}
Expand Down
Loading