fix: disable compact history messages for dispatch agent (#1954)
This commit is contained in:
@@ -290,7 +290,12 @@ function M.generate_prompts(opts)
|
||||
|
||||
local final_history_messages = {}
|
||||
if opts.history_messages then
|
||||
if Config.history.max_tokens > 0 then remaining_tokens = math.min(Config.history.max_tokens, remaining_tokens) end
|
||||
if opts.disable_compact_history_messages then
|
||||
final_history_messages = vim.list_extend(final_history_messages, opts.history_messages)
|
||||
else
|
||||
if Config.history.max_tokens > 0 then
|
||||
remaining_tokens = math.min(Config.history.max_tokens, remaining_tokens)
|
||||
end
|
||||
-- Traverse the history in reverse, keeping only the latest history until the remaining tokens are exhausted and the first message role is "user"
|
||||
local history_messages = {}
|
||||
for i = #opts.history_messages, 1, -1 do
|
||||
@@ -313,6 +318,7 @@ function M.generate_prompts(opts)
|
||||
-- prepend the history messages to the messages table
|
||||
vim.iter(history_messages):each(function(msg) table.insert(final_history_messages, msg) end)
|
||||
end
|
||||
end
|
||||
|
||||
-- Utils.debug("opts.history_messages", opts.history_messages)
|
||||
-- Utils.debug("final_history_messages", final_history_messages)
|
||||
|
||||
@@ -94,6 +94,7 @@ When you're done, provide a clear and concise summary of what you found.]]):gsub
|
||||
|
||||
local stream_options = {
|
||||
ask = true,
|
||||
disable_compact_history_messages = true,
|
||||
memory = memory_content,
|
||||
code_lang = "unknown",
|
||||
provider = Providers[Config.provider],
|
||||
|
||||
@@ -349,6 +349,7 @@ vim.g.avante_login = vim.g.avante_login
|
||||
---@field update_snippets? string[]
|
||||
---@field prompt_opts? AvantePromptOptions
|
||||
---@field session_ctx? table
|
||||
---@field disable_compact_history_messages? boolean
|
||||
---
|
||||
---@class AvanteLLMToolHistory
|
||||
---@field tool_result? AvanteLLMToolResult
|
||||
|
||||
Reference in New Issue
Block a user