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

@@ -1193,4 +1193,30 @@ function M.should_hidden_border(win_a, win_b)
return M.is_left_adjacent(win_a, win_b) or M.is_top_adjacent(win_a, win_b)
end
---@param fields AvanteLLMToolParamField[]
---@return table[] properties
---@return string[] required
function M.llm_tool_param_fields_to_json_schema(fields)
local properties = {}
local required = {}
for _, field in ipairs(fields) do
if field.type == "object" and field.fields then
local properties_, required_ = M.llm_tool_param_fields_to_json_schema(field.fields)
properties[field.name] = {
type = field.type,
description = field.description,
properties = properties_,
required = required_,
}
else
properties[field.name] = {
type = field.type,
description = field.description,
}
end
if not field.optional then table.insert(required, field.name) end
end
return properties, required
end
return M