From e9216ea459f3fabaef81f376ddbf0ba6ef292b37 Mon Sep 17 00:00:00 2001 From: Jeffrey Morgan Date: Sun, 26 Nov 2023 15:59:04 -0500 Subject: [PATCH] fix readline history on linux --- readline/history.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/readline/history.go b/readline/history.go index 5a7c34e2..57fccb7c 100644 --- a/readline/history.go +++ b/readline/history.go @@ -43,9 +43,12 @@ func (h *History) Init() error { } path := filepath.Join(home, ".ollama", "history") + if err := os.MkdirAll(filepath.Dir(path), 0o755); err != nil { + return err + } + h.Filename = path - //todo check if the file exists f, err := os.OpenFile(path, os.O_CREATE|os.O_RDONLY, 0600) if err != nil { if errors.Is(err, os.ErrNotExist) {