fix: react prompts (#2537)

This commit is contained in:
yetone
2025-07-26 16:06:56 +08:00
committed by GitHub
parent bd69ae14f6
commit 8bc149ccd8
14 changed files with 448 additions and 173 deletions

View File

@@ -53,6 +53,10 @@ M.returns = {
---@type AvanteLLMToolFunc<{ path: string, instructions: string, code_edit: string }>
M.func = vim.schedule_wrap(function(input, opts)
if opts.streaming then return false, "streaming not supported" end
if not input.path then return false, "path not provided" end
if not input.instructions then input.instructions = "" end
if not input.code_edit then return false, "code_edit not provided" end
local on_complete = opts.on_complete
if not on_complete then return false, "on_complete not provided" end
local provider = Providers["morph"]

View File

@@ -1274,7 +1274,7 @@ function M.process_tool_use(tools, tool_use, opts)
else
---@type AvanteLLMTool?
local tool = vim.iter(tools):find(function(tool) return tool.name == tool_use.name end) ---@param tool AvanteLLMTool
if tool == nil then return nil, "This tool is not provided: " .. tool_use.name end
if tool == nil then return nil, "This tool is not provided: " .. vim.inspect(tool_use.name) end
func = tool.func or M[tool.name]
end
local input_json = tool_use.input

View File

@@ -50,7 +50,7 @@ function M.func(input, opts)
local todos = sidebar.chat_history.todos
if not todos or #todos == 0 then return false, "No todos found" end
for _, todo in ipairs(todos) do
if todo.id == input.id then
if tostring(todo.id) == tostring(input.id) then
todo.status = input.status
break
end

View File

@@ -10,6 +10,8 @@ M.name = "write_to_file"
M.description =
"Request to write content to a file at the specified path. If the file exists, it will be overwritten with the provided content. If the file doesn't exist, it will be created. This tool will automatically create any directories needed to write the file."
M.support_streaming = false
function M.enabled()
return require("avante.config").mode == "agentic" and not require("avante.config").behaviour.enable_fastapply
end