fix: tool calling (#2297)

This commit is contained in:
yetone
2025-06-22 21:50:26 +08:00
committed by GitHub
parent db39f5fe1b
commit 3033556d5b
12 changed files with 127 additions and 99 deletions

View File

@@ -58,7 +58,10 @@ M.returns = {
--- IMPORTANT: Using "the_content" instead of "content" is to avoid LLM streaming generating function parameters in alphabetical order, which would result in generating "path" after "content", making it impossible to achieve a stream diff view.
---@type AvanteLLMToolFunc<{ path: string, content: string, the_content?: string, streaming?: boolean, tool_use_id?: string }>
function M.func(opts, on_log, on_complete, session_ctx)
if opts.the_content ~= nil then opts.content = opts.the_content end
if opts.the_content ~= nil then
opts.content = opts.the_content
opts.the_content = nil
end
if not on_complete then return false, "on_complete not provided" 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