Skip to content

Commit

Permalink
chore: fixing default model issue (#702)
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
  • Loading branch information
AlexsJones committed Oct 11, 2023
1 parent 6d3038b commit 2a34ff2
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions cmd/auth/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ import (
"golang.org/x/term"
)

const (
defaultBackend = "openai"
defaultModel = "gpt-3.5-turbo"
)

var addCmd = &cobra.Command{
Use: "add",
Short: "Add new provider",
Expand Down Expand Up @@ -66,8 +71,8 @@ var addCmd = &cobra.Command{

// check if backend is not empty and a valid value
if backend == "" {
color.Yellow("Warning: backend input is empty, will use the default value: openai")
backend = "openai"
color.Yellow(fmt.Sprintf("Warning: backend input is empty, will use the default value: %s", defaultBackend))
backend = defaultBackend
} else {
if !validBackend(ai.Backends, backend) {
color.Red("Error: Backend AI accepted values are '%v'", strings.Join(ai.Backends, ", "))
Expand All @@ -77,7 +82,8 @@ var addCmd = &cobra.Command{

// check if model is not empty
if model == "" {
color.Yellow("Warning: model input is empty, will use the default value: gpt-3.5-turbo")
model = defaultModel
color.Yellow(fmt.Sprintf("Warning: model input is empty, will use the default value: %s", defaultModel))
}
if temperature > 1.0 || temperature < 0.0 {
color.Red("Error: temperature ranges from 0 to 1.")
Expand Down Expand Up @@ -123,9 +129,9 @@ var addCmd = &cobra.Command{

func init() {
// add flag for backend
addCmd.Flags().StringVarP(&backend, "backend", "b", "openai", "Backend AI provider")
addCmd.Flags().StringVarP(&backend, "backend", "b", defaultBackend, "Backend AI provider")
// add flag for model
addCmd.Flags().StringVarP(&model, "model", "m", "gpt-3.5-turbo", "Backend AI model")
addCmd.Flags().StringVarP(&model, "model", "m", defaultModel, "Backend AI model")
// add flag for password
addCmd.Flags().StringVarP(&password, "password", "p", "", "Backend AI password")
// add flag for url
Expand Down

0 comments on commit 2a34ff2

Please sign in to comment.