From 8a64d454ef8cfaef2c6280efc9a09ba94fec2c42 Mon Sep 17 00:00:00 2001 From: Bryan Vaz <9157498+bryanvaz@users.noreply.github.com> Date: Wed, 11 Jun 2025 23:29:00 -0400 Subject: [PATCH] fix: fixed Clear (#2199) Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com> --- lua/avante/sidebar.lua | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lua/avante/sidebar.lua b/lua/avante/sidebar.lua index 16ce341..d9cb841 100644 --- a/lua/avante/sidebar.lua +++ b/lua/avante/sidebar.lua @@ -1847,10 +1847,13 @@ end function Sidebar:clear_history(args, cb) self.current_state = nil - local chat_history = Path.history.load(self.code.bufnr) - if next(chat_history) ~= nil then - chat_history.messages = {} - Path.history.save(self.code.bufnr, chat_history) + if next(self.chat_history) ~= nil then + self.chat_history.messages = {} + self.chat_history.entries = {} + Path.history.save(self.code.bufnr, self.chat_history) + self._history_cache_invalidated = true + self:reload_chat_history() + self:update_content_with_history() self:update_content( "Chat history cleared", { focus = false, scroll = false, callback = function() self:focus_input() end }