adding workflow

Signed-off-by: AlexsJones <alexsimonjones@gmail.com>
This commit is contained in:
AlexsJones
2023-03-21 20:09:18 +00:00
parent a14cde2c1f
commit 2a6404b94f
7 changed files with 105 additions and 16 deletions

View File

@@ -14,7 +14,6 @@ import (
"github.com/cloud-native-skunkworks/k8sgpt/pkg/client"
"github.com/cloud-native-skunkworks/k8sgpt/pkg/openai"
"github.com/fatih/color"
ai "github.com/sashabaranov/go-openai"
"github.com/spf13/cobra"
"github.com/spf13/viper"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -74,22 +73,15 @@ var problemsCmd = &cobra.Command{
if explain {
s := spinner.New(spinner.CharSets[35], 100*time.Millisecond) // Build our new spinner
s.Start()
resp, err := openAIClient.GetClient().CreateChatCompletion(ctx, ai.ChatCompletionRequest{
Model: ai.GPT3Dot5Turbo,
Messages: []ai.ChatCompletionMessage{
{
Role: "user",
Content: "Simplify the following Kubernetes error message and provide a solution: " + strings.Join(value, " "),
},
},
})
response, err := openAIClient.GetCompletion(ctx, strings.Join(value, " "))
s.Stop()
if err != nil {
color.Red("Error: %v", err)
return
}
color.Green(resp.Choices[0].Message.Content)
color.Green(response)
}
}