feat: claude text editor tool (#1631)
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
local Utils = require("avante.utils")
|
||||
local Clipboard = require("avante.clipboard")
|
||||
local P = require("avante.providers")
|
||||
local Config = require("avante.config")
|
||||
|
||||
---@class AvanteProviderFunctor
|
||||
local M = {}
|
||||
@@ -343,6 +344,20 @@ function M:parse_curl_args(prompt_opts)
|
||||
end
|
||||
end
|
||||
|
||||
if prompt_opts.tools and Config.behaviour.enable_claude_text_editor_tool_mode then
|
||||
if 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%-instruct") then
|
||||
table.insert(tools, {
|
||||
type = "text_editor_20241022",
|
||||
name = "str_replace_editor",
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
if self.support_prompt_caching and #tools > 0 then
|
||||
local last_tool = vim.deepcopy(tools[#tools])
|
||||
last_tool.cache_control = { type = "ephemeral" }
|
||||
|
||||
Reference in New Issue
Block a user