fix: do not use str_replace_editor (#2428)
This commit is contained in:
@@ -575,6 +575,7 @@ function M.func(opts, on_log, on_complete, session_ctx)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function highlight_diff_blocks()
|
local function highlight_diff_blocks()
|
||||||
|
local line_count = vim.api.nvim_buf_line_count(bufnr)
|
||||||
vim.api.nvim_buf_clear_namespace(bufnr, NAMESPACE, 0, -1)
|
vim.api.nvim_buf_clear_namespace(bufnr, NAMESPACE, 0, -1)
|
||||||
local base_line_ = 0
|
local base_line_ = 0
|
||||||
local max_col = vim.o.columns
|
local max_col = vim.o.columns
|
||||||
@@ -591,17 +592,19 @@ function M.func(opts, on_log, on_complete, session_ctx)
|
|||||||
:totable()
|
:totable()
|
||||||
-- local extmark_line = math.max(0, start_line - 2)
|
-- local extmark_line = math.max(0, start_line - 2)
|
||||||
local end_row = start_line + #diff_block.new_lines - 1
|
local end_row = start_line + #diff_block.new_lines - 1
|
||||||
local delete_extmark_id = vim.api.nvim_buf_set_extmark(bufnr, NAMESPACE, end_row - 1, 0, {
|
local delete_extmark_id =
|
||||||
virt_lines = deleted_virt_lines,
|
vim.api.nvim_buf_set_extmark(bufnr, NAMESPACE, math.min(math.max(end_row - 1, 0), line_count - 1), 0, {
|
||||||
hl_eol = true,
|
virt_lines = deleted_virt_lines,
|
||||||
hl_mode = "combine",
|
hl_eol = true,
|
||||||
})
|
hl_mode = "combine",
|
||||||
local incoming_extmark_id = vim.api.nvim_buf_set_extmark(bufnr, NAMESPACE, start_line - 1, 0, {
|
})
|
||||||
hl_group = Highlights.INCOMING,
|
local incoming_extmark_id =
|
||||||
hl_eol = true,
|
vim.api.nvim_buf_set_extmark(bufnr, NAMESPACE, math.min(math.max(start_line - 1, 0), line_count - 1), 0, {
|
||||||
hl_mode = "combine",
|
hl_group = Highlights.INCOMING,
|
||||||
end_row = end_row,
|
hl_eol = true,
|
||||||
})
|
hl_mode = "combine",
|
||||||
|
end_row = end_row,
|
||||||
|
})
|
||||||
diff_block.delete_extmark_id = delete_extmark_id
|
diff_block.delete_extmark_id = delete_extmark_id
|
||||||
diff_block.incoming_extmark_id = incoming_extmark_id
|
diff_block.incoming_extmark_id = incoming_extmark_id
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
local Utils = require("avante.utils")
|
local Utils = require("avante.utils")
|
||||||
local Clipboard = require("avante.clipboard")
|
local Clipboard = require("avante.clipboard")
|
||||||
local P = require("avante.providers")
|
local P = require("avante.providers")
|
||||||
local Config = require("avante.config")
|
|
||||||
local HistoryMessage = require("avante.history_message")
|
local HistoryMessage = require("avante.history_message")
|
||||||
local JsonParser = require("avante.libs.jsonparser")
|
local JsonParser = require("avante.libs.jsonparser")
|
||||||
|
|
||||||
@@ -363,35 +362,7 @@ function M:parse_curl_args(prompt_opts)
|
|||||||
local tools = {}
|
local tools = {}
|
||||||
if not disable_tools and prompt_opts.tools then
|
if not disable_tools and prompt_opts.tools then
|
||||||
for _, tool in ipairs(prompt_opts.tools) do
|
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))
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user