浏览代码

fix readline history on linux

Jeffrey Morgan 1 年之前
父节点
当前提交
e9216ea459
共有 1 个文件被更改,包括 4 次插入1 次删除
  1. 4 1
      readline/history.go

+ 4 - 1
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) {