fix: refine tools (#1706)

* fix: refine tools

* fix: missing break line

* fix: view a in-context file

* fix: remove create_file tests
This commit is contained in:
yetone
2025-03-25 11:17:48 +08:00
committed by GitHub
parent 3a75b7d36f
commit 976fb4177c
6 changed files with 34 additions and 61 deletions

View File

@@ -75,6 +75,10 @@ M.returns = {
---@type AvanteLLMToolFunc<{ path: string, view_range?: { start_line: integer, end_line: integer } }>
function M.func(opts, on_log, on_complete)
if not on_complete then return false, "on_complete not provided" end
if Helpers.already_in_context(opts.path) then
on_complete(nil, "Ooooops! This file is already in the context! Why you are trying to read it again?")
return
end
local abs_path = Helpers.get_abs_path(opts.path)
if not Helpers.has_permission_to_access(abs_path) then return false, "No permission to access path: " .. abs_path end
if on_log then on_log("path: " .. abs_path) end