Skip to content

Commit

Permalink
use default values
Browse files Browse the repository at this point in the history
Signed-off-by: Jian Zhang <jiazha@redhat.com>
  • Loading branch information
jianzhangbjz committed Jul 20, 2023
1 parent 9d2bee9 commit 6e7d926
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions cmd/auth/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,19 @@ var addCmd = &cobra.Command{
}

// check if backend is not empty and a valid value
if backend == "" || !validBackend(ai.Backends, backend) {
color.Red("Error: Backend AI cannot be empty and accepted values are '%v'", strings.Join(ai.Backends, ", "))
os.Exit(1)
if backend == "" {
color.Yellow("Warning: backend input is empty, will use the default value: openai")
backend = "openai"
} else {
if !validBackend(ai.Backends, backend) {
color.Red("Error: Backend AI accepted values are '%v'", strings.Join(ai.Backends, ", "))
os.Exit(1)
}
}

// check if model is not empty
if model == "" {
color.Red("Error: Model cannot be empty.")
os.Exit(1)
color.Yellow("Warning: model input is empty, will use the default value: gpt-3.5-turbo")
}

if ai.NeedPassword(backend) && password == "" {
Expand Down

0 comments on commit 6e7d926

Please sign in to comment.