Skip to content

Commit 03a7020

Browse files
committed
refactor(nvim): disable deduplication for summary mode
1 parent 99709a9 commit 03a7020

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

lua/vectorcode/integrations/codecompanion/query_tool.lua

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -269,20 +269,24 @@ return check_cli_wrap(function(opts)
269269

270270
job_runner.run_async(args, function(result, error)
271271
if vim.islist(result) and #result > 0 and result[1].path ~= nil then ---@cast result VectorCode.QueryResult[]
272-
if opts.no_duplicate then
272+
local summary_opts = vim.deepcopy(opts.summarise) or {}
273+
if type(summary_opts.enabled) == "function" then
274+
summary_opts.enabled = summary_opts.enabled(agent.chat, result) --[[@as boolean]]
275+
end
276+
277+
if opts.no_duplicate and not summary_opts.enabled then
278+
-- NOTE: deduplication in summary mode prevents the model from requesting
279+
-- the same content without summarysation.
273280
result = filter_results(result, agent.chat)
274281
end
282+
275283
local max_result = #result
276284
if opts.max_num > 0 then
277285
max_result = math.min(tonumber(opts.max_num) or 1, max_result)
278286
end
279287
while #result > max_result do
280288
table.remove(result)
281289
end
282-
local summary_opts = vim.deepcopy(opts.summarise) or {}
283-
if type(summary_opts.enabled) == "function" then
284-
summary_opts.enabled = summary_opts.enabled(agent.chat, result)
285-
end
286290
generate_summary(result, summary_opts, action, function(s)
287291
cb({
288292
status = "success",

0 commit comments

Comments
 (0)