refactor: llm tool parameters (#2449)

This commit is contained in:
yetone
2025-07-15 16:40:25 +08:00
committed by GitHub
parent 0c6a8f5688
commit b8bb0fd969
25 changed files with 627 additions and 381 deletions

View File

@@ -45,12 +45,14 @@ M.returns = {
}
---@type AvanteLLMToolFunc<{ path: string, pattern: string }>
function M.func(opts, on_log, on_complete, session_ctx)
local abs_path = Helpers.get_abs_path(opts.path)
function M.func(input, opts)
local on_log = opts.on_log
local on_complete = opts.on_complete
local abs_path = Helpers.get_abs_path(input.path)
if not Helpers.has_permission_to_access(abs_path) then return "", "No permission to access path: " .. abs_path end
if on_log then on_log("path: " .. abs_path) end
if on_log then on_log("pattern: " .. opts.pattern) end
local files = vim.fn.glob(abs_path .. "/" .. opts.pattern, true, true)
if on_log then on_log("pattern: " .. input.pattern) end
local files = vim.fn.glob(abs_path .. "/" .. input.pattern, true, true)
local truncated_files = {}
local is_truncated = false
local size = 0