Skip to content

Commit e559fb2

Browse files
committed
Updates
1 parent 63b692b commit e559fb2

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

cmd/llm/chat.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,9 @@ func (cmd *ChatCmd) Run(globals *Globals) error {
4242
if !cmd.NoStream {
4343
opts = append(opts, llm.WithStream(func(cc llm.Completion) {
4444
if text := cc.Text(0); text != "" {
45-
text = strings.ReplaceAll(text, "\n", " ")
46-
fmt.Print("\r" + text)
45+
count := strings.Count(text, "\n")
46+
fmt.Print(strings.Repeat("\033[F", count) + strings.Repeat(" ", count) + "\r")
47+
fmt.Print(text)
4748
}
4849
}))
4950
}

0 commit comments

Comments
 (0)