Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions lua/vectorcode/integrations/codecompanion/query_tool.lua
Original file line number Diff line number Diff line change
Expand Up @@ -269,20 +269,24 @@ return check_cli_wrap(function(opts)

job_runner.run_async(args, function(result, error)
if vim.islist(result) and #result > 0 and result[1].path ~= nil then ---@cast result VectorCode.QueryResult[]
if opts.no_duplicate then
local summary_opts = vim.deepcopy(opts.summarise) or {}
if type(summary_opts.enabled) == "function" then
summary_opts.enabled = summary_opts.enabled(agent.chat, result) --[[@as boolean]]
end

if opts.no_duplicate and not summary_opts.enabled then
-- NOTE: deduplication in summary mode prevents the model from requesting
-- the same content without summarysation.
result = filter_results(result, agent.chat)
end

local max_result = #result
if opts.max_num > 0 then
max_result = math.min(tonumber(opts.max_num) or 1, max_result)
end
while #result > max_result do
table.remove(result)
end
local summary_opts = vim.deepcopy(opts.summarise) or {}
if type(summary_opts.enabled) == "function" then
summary_opts.enabled = summary_opts.enabled(agent.chat, result)
end
generate_summary(result, summary_opts, action, function(s)
cb({
status = "success",
Expand Down