feat: accept all (#1764)
This commit is contained in:
@@ -45,7 +45,7 @@ M.returns = {
|
||||
}
|
||||
|
||||
---@type AvanteLLMToolFunc<{ path: string, file_text: string }>
|
||||
function M.func(opts, on_log, on_complete)
|
||||
function M.func(opts, on_log, on_complete, session_ctx)
|
||||
if not on_complete then return false, "on_complete not provided" end
|
||||
if on_log then on_log("path: " .. opts.path) end
|
||||
if Helpers.already_in_context(opts.path) then
|
||||
@@ -60,11 +60,11 @@ function M.func(opts, on_log, on_complete)
|
||||
local bufnr, err = Helpers.get_bufnr(abs_path)
|
||||
if err then return false, err end
|
||||
vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, lines)
|
||||
Helpers.confirm("Are you sure you want to create this file?", function(ok)
|
||||
Helpers.confirm("Are you sure you want to create this file?", function(ok, reason)
|
||||
if not ok then
|
||||
-- close the buffer
|
||||
vim.api.nvim_buf_delete(bufnr, { force = true })
|
||||
on_complete(false, "User canceled")
|
||||
on_complete(false, "User declined, reason: " .. (reason or "unknown"))
|
||||
return
|
||||
end
|
||||
-- save the file
|
||||
@@ -75,7 +75,7 @@ function M.func(opts, on_log, on_complete)
|
||||
vim.cmd("write")
|
||||
vim.api.nvim_set_current_win(current_winid)
|
||||
on_complete(true, nil)
|
||||
end)
|
||||
end, { focus = true }, session_ctx)
|
||||
end
|
||||
|
||||
return M
|
||||
|
||||
Reference in New Issue
Block a user