Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: fixing default model issue #702

Merged
merged 2 commits into from
Oct 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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