From 38296ab352ea7dd029f24cea5353b581f53f678b Mon Sep 17 00:00:00 2001 From: Jeffrey Morgan Date: Thu, 1 Feb 2024 21:30:26 -0800 Subject: [PATCH] clear previous images when submitting an image to `ollama run` (#2316) --- cmd/interactive.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cmd/interactive.go b/cmd/interactive.go index 94cc8b70..690cd107 100644 --- a/cmd/interactive.go +++ b/cmd/interactive.go @@ -496,6 +496,14 @@ func generateInteractive(cmd *cobra.Command, opts runOptions) error { if err != nil { return err } + + // clear all previous images for better responses + if len(images) > 0 { + for i := range opts.Messages { + opts.Messages[i].Images = nil + } + } + newMessage.Content = msg newMessage.Images = images }