fix(file_selector): empty buffer and chat without file context. (#953)
This commit is contained in:
parent
dde035831a
commit
8067cb0240
@ -33,6 +33,8 @@ function FileSelector:reset()
|
||||
end
|
||||
|
||||
function FileSelector:add_selected_file(filepath)
|
||||
if not filepath or filepath == "" then return end
|
||||
|
||||
local uniform_path = Utils.uniform_path(filepath)
|
||||
-- Avoid duplicates
|
||||
if not vim.tbl_contains(self.selected_filepaths, uniform_path) then
|
||||
|
@ -70,8 +70,10 @@ M.generate_prompts = function(opts)
|
||||
if diagnostics ~= "" then table.insert(messages, { role = "user", content = diagnostics }) end
|
||||
end
|
||||
|
||||
local code_context = Path.prompts.render_file("_context.avanterules", template_opts)
|
||||
if code_context ~= "" then table.insert(messages, { role = "user", content = code_context }) end
|
||||
if #opts.selected_files > 0 or opts.selected_code ~= nil then
|
||||
local code_context = Path.prompts.render_file("_context.avanterules", template_opts)
|
||||
if code_context ~= "" then table.insert(messages, { role = "user", content = code_context }) end
|
||||
end
|
||||
|
||||
if opts.use_xml_format then
|
||||
table.insert(messages, { role = "user", content = string.format("<question>%s</question>", instructions) })
|
||||
|
Loading…
x
Reference in New Issue
Block a user