Skip to content

Commit

Permalink
feat: check for auth only in case of --explain
Browse files Browse the repository at this point in the history
Signed-off-by: Harshit Mehta <harshitm@nvidia.com>
  • Loading branch information
Harshit Mehta committed Apr 13, 2023
1 parent 3517d76 commit 57790e5
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions cmd/analyze/analyze.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,6 @@ var AnalyzeCmd = &cobra.Command{
os.Exit(1)
}

if len(configAI.Providers) == 0 {
color.Red("Error: AI provider not specified in configuration. Please run k8sgpt auth")
os.Exit(1)
}

var aiProvider ai.AIProvider
for _, provider := range configAI.Providers {
if backend == provider.Name {
Expand Down Expand Up @@ -94,6 +89,11 @@ var AnalyzeCmd = &cobra.Command{
}

if explain {
if len(configAI.Providers) == 0 {
color.Red("Error: AI provider not specified in configuration. Please run k8sgpt auth")
os.Exit(1)
}

err := config.GetAIResults(output, anonymize)
if err != nil {
color.Red("Error: %v", err)
Expand Down

0 comments on commit 57790e5

Please sign in to comment.