From 57790e5bc7037f57a4f73248fe05cac192511470 Mon Sep 17 00:00:00 2001 From: Harshit Mehta Date: Thu, 13 Apr 2023 11:54:21 +0530 Subject: [PATCH] feat: check for auth only in case of --explain Signed-off-by: Harshit Mehta --- cmd/analyze/analyze.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cmd/analyze/analyze.go b/cmd/analyze/analyze.go index a1b371a549..f001a1bcb9 100644 --- a/cmd/analyze/analyze.go +++ b/cmd/analyze/analyze.go @@ -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 { @@ -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)