From 58d08bf0cc5e169f2aa9a793c36f388e3df13364 Mon Sep 17 00:00:00 2001 From: yetone Date: Thu, 5 Jun 2025 00:26:02 +0800 Subject: [PATCH] fix: history storage path and delete clear memory (#2153) --- lua/avante/config.lua | 2 +- lua/avante/path.lua | 4 ++-- plugin/avante.lua | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lua/avante/config.lua b/lua/avante/config.lua index f42405f..7f5bff5 100644 --- a/lua/avante/config.lua +++ b/lua/avante/config.lua @@ -419,7 +419,7 @@ M._defaults = { history = { max_tokens = 4096, carried_entry_count = nil, - storage_path = vim.fn.stdpath("state") .. "/avante", + storage_path = Utils.join_paths(vim.fn.stdpath("state"), "avante"), paste = { extension = "png", filename = "pasted-%Y-%m-%d-%H-%M-%S", diff --git a/lua/avante/path.lua b/lua/avante/path.lua index b573540..76c46cc 100644 --- a/lua/avante/path.lua +++ b/lua/avante/path.lua @@ -298,11 +298,11 @@ function P.setup() if not history_path:exists() then history_path:mkdir({ parents = true }) end P.history_path = history_path - local cache_path = Path:new(vim.fn.stdpath("cache") .. "/avante") + local cache_path = Path:new(Utils.join_paths(vim.fn.stdpath("cache"), "avante")) if not cache_path:exists() then cache_path:mkdir({ parents = true }) end P.cache_path = cache_path - local data_path = Path:new(vim.fn.stdpath("data") .. "/avante") + local data_path = Path:new(Utils.join_paths(vim.fn.stdpath("data"), "avante")) if not data_path:exists() then data_path:mkdir({ parents = true }) end P.data_path = data_path diff --git a/plugin/avante.lua b/plugin/avante.lua index c93ce1e..c5690b8 100644 --- a/plugin/avante.lua +++ b/plugin/avante.lua @@ -152,7 +152,7 @@ cmd("Clear", function(opts) end, { desc = "avante: clear history, memory or cache", nargs = "?", - complete = function(_, _, _) return { "history", "memory", "cache" } end, + complete = function(_, _, _) return { "history", "cache" } end, }) cmd("ShowRepoMap", function() require("avante.repo_map").show() end, { desc = "avante: show repo map" }) cmd("Models", function() require("avante.model_selector").open() end, { desc = "avante: show models" })