From 8c4244b940e89dc42acc7b3b6b801f1767cf6665 Mon Sep 17 00:00:00 2001 From: yetone Date: Tue, 25 Mar 2025 16:07:45 +0800 Subject: [PATCH] fix: decrease history max tokens (#1709) --- lua/avante/config.lua | 2 +- lua/avante/sidebar.lua | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lua/avante/config.lua b/lua/avante/config.lua index d8a31c1..99f9e6b 100644 --- a/lua/avante/config.lua +++ b/lua/avante/config.lua @@ -344,7 +344,7 @@ M._defaults = { use_cwd_as_project_root = false, }, history = { - max_tokens = 8192, + max_tokens = 4096, storage_path = vim.fn.stdpath("state") .. "/avante", paste = { extension = "png", diff --git a/lua/avante/sidebar.lua b/lua/avante/sidebar.lua index 8f2a1b4..04917cd 100644 --- a/lua/avante/sidebar.lua +++ b/lua/avante/sidebar.lua @@ -2576,12 +2576,12 @@ function Sidebar:create_input_container(opts) if self.chat_history.memory then prompts_opts.memory = self.chat_history.memory.content end - if not summarize_memory or #history_messages < 12 then + if not summarize_memory or #history_messages < 8 then cb(prompts_opts) return end - prompts_opts.history_messages = vim.list_slice(prompts_opts.history_messages, 7) + prompts_opts.history_messages = vim.list_slice(prompts_opts.history_messages, 5) Llm.summarize_memory(self.code.bufnr, self.chat_history, function(memory) if memory then prompts_opts.memory = memory.content end