Merge pull request #260 from hdm23061993/feat/issue-256

feat: check for auth only in case of --explain
This commit is contained in:
Alex Jones 2023-04-13 09:08:36 +01:00 committed by GitHub
commit 7551f8bf03
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)