feat: add view_range parameter and remove read_file llm tool (#1690)

This commit is contained in:
yetone
2025-03-24 15:07:14 +08:00
committed by GitHub
parent 4749e4ea1a
commit 49ae3c84fd
10 changed files with 179 additions and 113 deletions

View File

@@ -34,15 +34,7 @@ end
---@param tool AvanteLLMTool
---@return AvanteClaudeTool
function M:transform_tool(tool)
local input_schema_properties = {}
local required = {}
for _, field in ipairs(tool.param.fields) do
input_schema_properties[field.name] = {
type = field.type,
description = field.description,
}
if not field.optional then table.insert(required, field.name) end
end
local input_schema_properties, required = Utils.llm_tool_param_fields_to_json_schema(tool.param.fields)
return {
name = tool.name,
description = tool.description,
@@ -340,7 +332,10 @@ 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 tool.name == "create_file" then goto continue end
if Config.behaviour.enable_claude_text_editor_tool_mode then
if tool.name == "create_file" then goto continue end
if tool.name == "view" then goto continue end
end
table.insert(tools, self:transform_tool(tool))
::continue::
end

View File

@@ -18,15 +18,7 @@ function M:is_disable_stream() return false end
---@param tool AvanteLLMTool
---@return AvanteOpenAITool
function M:transform_tool(tool)
local input_schema_properties = {}
local required = {}
for _, field in ipairs(tool.param.fields) do
input_schema_properties[field.name] = {
type = field.type,
description = field.description,
}
if not field.optional then table.insert(required, field.name) end
end
local input_schema_properties, required = Utils.llm_tool_param_fields_to_json_schema(tool.param.fields)
---@type AvanteOpenAIToolFunctionParameters
local parameters = nil
if not vim.tbl_isempty(input_schema_properties) then