feat: get custom tools from a function (#1567)
This commit is contained in:
@@ -465,7 +465,7 @@ M._defaults = {
|
|||||||
throttle = 600,
|
throttle = 600,
|
||||||
},
|
},
|
||||||
disabled_tools = {}, ---@type string[]
|
disabled_tools = {}, ---@type string[]
|
||||||
---@type AvanteLLMToolPublic[]
|
---@type AvanteLLMToolPublic[] | fun(): AvanteLLMToolPublic[]
|
||||||
custom_tools = {},
|
custom_tools = {},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -605,8 +605,10 @@ end
|
|||||||
|
|
||||||
---@return AvanteLLMTool[]
|
---@return AvanteLLMTool[]
|
||||||
function M.get_tools()
|
function M.get_tools()
|
||||||
|
local custom_tools = Config.custom_tools
|
||||||
|
if type(custom_tools) == "function" then custom_tools = custom_tools() end
|
||||||
---@type AvanteLLMTool[]
|
---@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
|
return vim
|
||||||
.iter(unfiltered_tools)
|
.iter(unfiltered_tools)
|
||||||
:filter(function(tool) ---@param tool AvanteLLMTool
|
:filter(function(tool) ---@param tool AvanteLLMTool
|
||||||
|
|||||||
Reference in New Issue
Block a user