fix: do not pick tool use messages when use ReAct (#2333)
This commit is contained in:
@@ -5,7 +5,7 @@ local Split = require("nui.split")
|
||||
local event = require("nui.utils.autocmd").event
|
||||
|
||||
local PPath = require("plenary.path")
|
||||
local Provider = require("avante.providers")
|
||||
local Providers = require("avante.providers")
|
||||
local Path = require("avante.path")
|
||||
local Config = require("avante.config")
|
||||
local Diff = require("avante.diff")
|
||||
@@ -165,7 +165,7 @@ function Sidebar:open(opts)
|
||||
end
|
||||
|
||||
if not vim.g.avante_login or vim.g.avante_login == false then
|
||||
api.nvim_exec_autocmds("User", { pattern = Provider.env.REQUEST_LOGIN_PATTERN })
|
||||
api.nvim_exec_autocmds("User", { pattern = Providers.env.REQUEST_LOGIN_PATTERN })
|
||||
vim.g.avante_login = true
|
||||
end
|
||||
|
||||
@@ -2202,6 +2202,8 @@ function Sidebar:get_history_messages_for_api(opts)
|
||||
|
||||
if opts.all then return history_messages0 end
|
||||
|
||||
local use_ReAct_prompt = Providers[Config.provider].use_ReAct_prompt ~= nil
|
||||
|
||||
history_messages0 = vim
|
||||
.iter(history_messages0)
|
||||
:filter(function(message) return message.state ~= "generating" end)
|
||||
@@ -2411,6 +2413,7 @@ function Sidebar:get_history_messages_for_api(opts)
|
||||
end
|
||||
end
|
||||
|
||||
if not use_ReAct_prompt then
|
||||
local picked_messages = {}
|
||||
local max_tool_use_count = 25
|
||||
local tool_use_count = 0
|
||||
@@ -2466,6 +2469,7 @@ function Sidebar:get_history_messages_for_api(opts)
|
||||
end
|
||||
|
||||
history_messages = picked_messages
|
||||
end
|
||||
|
||||
local final_history_messages = {}
|
||||
for _, msg in ipairs(history_messages) do
|
||||
|
||||
Reference in New Issue
Block a user