feat: get custom tools from a function (#1567)

This commit is contained in:
yetone
2025-03-12 17:57:09 +08:00
committed by GitHub
parent e635452389
commit 9e3e8d06a2
2 changed files with 4 additions and 2 deletions

View File

@@ -605,8 +605,10 @@ end
---@return AvanteLLMTool[]
function M.get_tools()
local custom_tools = Config.custom_tools
if type(custom_tools) == "function" then custom_tools = custom_tools() end
---@type AvanteLLMTool[]
local unfiltered_tools = vim.list_extend(vim.list_extend({}, M._tools), Config.custom_tools)
local unfiltered_tools = vim.list_extend(vim.list_extend({}, M._tools), custom_tools)
return vim
.iter(unfiltered_tools)
:filter(function(tool) ---@param tool AvanteLLMTool