From a4a037cec18073d36482d2010dff4c101668b1eb Mon Sep 17 00:00:00 2001 From: GNITOAHC Date: Wed, 4 Sep 2024 19:38:59 +0800 Subject: [PATCH] feat(cmd): `AvanteClear` (#518) Remove all cache/history path. Co-authored-by: Aaron Pham --- lua/avante/init.lua | 1 + lua/avante/path.lua | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lua/avante/init.lua b/lua/avante/init.lua index 86cd4ff..cf882b9 100644 --- a/lua/avante/init.lua +++ b/lua/avante/init.lua @@ -67,6 +67,7 @@ H.commands = function() return vim.tbl_filter(function(key) return key:find(prefix, 1, true) == 1 end, Config.providers) end, }) + cmd("Clear", function() require("avante.path").clear() end, { desc = "avante: clear all chat history" }) end H.keymaps = function() diff --git a/lua/avante/path.lua b/lua/avante/path.lua index ba21939..82c4f7d 100644 --- a/lua/avante/path.lua +++ b/lua/avante/path.lua @@ -143,6 +143,9 @@ end P.available = function() return templates ~= nil end -P.clear = function() P.cache_path:rm({ recursive = true }) end +P.clear = function() + P.cache_path:rm({ recursive = true }) + P.history_path:rm({ recursive = true }) +end return P