mirror of
https://github.com/k8sgpt-ai/k8sgpt.git
synced 2025-08-29 04:40:42 +00:00
fix: short term solution for exhaustion
Signed-off-by: AlexsJones <alexsimonjones@gmail.com>
This commit is contained in:
parent
d0e4684e82
commit
5890e3a79c
@ -104,6 +104,11 @@ var AnalyzeCmd = &cobra.Command{
|
|||||||
if explain {
|
if explain {
|
||||||
parsedText, err := analyzer.ParseViaAI(ctx, aiClient, analysis.Error, nocache)
|
parsedText, err := analyzer.ParseViaAI(ctx, aiClient, analysis.Error, nocache)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
// Check for exhaustion
|
||||||
|
if strings.Contains(err.Error(), "status code: 429") {
|
||||||
|
color.Red("Exhausted API quota. Please try again later")
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
color.Red("Error: %v", err)
|
color.Red("Error: %v", err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,7 @@ func ParseViaAI(ctx context.Context, aiClient ai.IAI, prompt []string,
|
|||||||
response, err := aiClient.GetCompletion(ctx, inputKey)
|
response, err := aiClient.GetCompletion(ctx, inputKey)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
color.Red("error getting completion: %v", err)
|
color.Red("error getting completion: %v", err)
|
||||||
return "", nil
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
if !viper.IsSet(sEnc) {
|
if !viper.IsSet(sEnc) {
|
||||||
|
Loading…
Reference in New Issue
Block a user