fix: do not use str_replace_editor (#2428)

This commit is contained in:
yetone
2025-07-10 10:17:48 +08:00
committed by GitHub
parent 6a9424a63b
commit 14cfccdba9
2 changed files with 14 additions and 40 deletions

View File

@@ -1,7 +1,6 @@
local Utils = require("avante.utils")
local Clipboard = require("avante.clipboard")
local P = require("avante.providers")
local Config = require("avante.config")
local HistoryMessage = require("avante.history_message")
local JsonParser = require("avante.libs.jsonparser")
@@ -363,35 +362,7 @@ function M:parse_curl_args(prompt_opts)
local tools = {}
if not disable_tools and prompt_opts.tools then
for _, tool in ipairs(prompt_opts.tools) do
if Config.mode == "agentic" then
if tool.name == "create_file" then goto continue end
if tool.name == "view" then goto continue end
if tool.name == "str_replace" then goto continue end
if tool.name == "create" then goto continue end
if tool.name == "insert" then goto continue end
if tool.name == "undo_edit" then goto continue end
end
table.insert(tools, self:transform_tool(tool))
::continue::
end
end
if prompt_opts.tools and #prompt_opts.tools > 0 and Config.mode == "agentic" then
if provider_conf.model:match("claude%-sonnet%-4") then
table.insert(tools, {
type = "text_editor_20250429",
name = "str_replace_based_edit_tool",
})
elseif provider_conf.model:match("claude%-3%-7%-sonnet") then
table.insert(tools, {
type = "text_editor_20250124",
name = "str_replace_editor",
})
elseif provider_conf.model:match("claude%-3%-5%-sonnet") then
table.insert(tools, {
type = "text_editor_20250124",
name = "str_replace_editor",
})
end
end