fix formatting when exiting ollama run

This commit is contained in:
Jeffrey Morgan 2023-10-27 21:26:23 -07:00
parent 57a58db1b0
commit 9ec16f0f03
2 changed files with 5 additions and 3 deletions

View file

@ -561,6 +561,7 @@ func generateInteractive(cmd *cobra.Command, model string) error {
line, err := scanner.Readline() line, err := scanner.Readline()
switch { switch {
case errors.Is(err, io.EOF): case errors.Is(err, io.EOF):
fmt.Println()
return nil return nil
case errors.Is(err, readline.ErrInterrupt): case errors.Is(err, readline.ErrInterrupt):
if line == "" { if line == "" {

View file

@ -76,14 +76,15 @@ func (i *Instance) Readline() (string, error) {
} }
r, err := i.Terminal.Read() r, err := i.Terminal.Read()
if err != nil {
return "", io.EOF
}
if buf.IsEmpty() { if buf.IsEmpty() {
fmt.Print(ClearToEOL) fmt.Print(ClearToEOL)
} }
if err != nil {
return "", io.EOF
}
if escex { if escex {
escex = false escex = false