Merge pull request #54 from jmorganca/empty-line

no prompt on empty line
This commit is contained in:
Michael Yang 2023-07-07 11:29:39 -07:00 committed by GitHub
commit 0fea50cd42
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 31 additions and 26 deletions

View file

@ -9,6 +9,7 @@ import (
"net" "net"
"os" "os"
"path" "path"
"strings"
"time" "time"
"github.com/schollz/progressbar/v3" "github.com/schollz/progressbar/v3"
@ -75,6 +76,7 @@ func RunGenerate(_ *cobra.Command, args []string) error {
} }
func generate(model, prompt string) error { func generate(model, prompt string) error {
if len(strings.TrimSpace(prompt)) > 0 {
client := api.NewClient() client := api.NewClient()
spinner := progressbar.NewOptions(-1, spinner := progressbar.NewOptions(-1,
@ -107,6 +109,8 @@ func generate(model, prompt string) error {
fmt.Println() fmt.Println()
fmt.Println() fmt.Println()
}
return nil return nil
} }

View file

@ -1,2 +1,3 @@
{{ .Prompt }} {{ .Prompt }}
### Response: ### Response: