feat: disable tools with config (#1459)
* chore: use missing generic for AvanteLLMToolFunc * feat: add disabled_tools config
This commit is contained in:
@@ -408,6 +408,7 @@ M._defaults = {
|
||||
debounce = 600,
|
||||
throttle = 600,
|
||||
},
|
||||
disabled_tools = {}, ---@type string[]
|
||||
}
|
||||
|
||||
---@type avante.Config
|
||||
|
||||
@@ -569,7 +569,9 @@ end
|
||||
function M.get_tools()
|
||||
return vim
|
||||
.iter(M._tools)
|
||||
:filter(function(tool)
|
||||
:filter(function(tool) ---@param tool AvanteLLMTool
|
||||
-- Always disable tools that are explicitly disabled
|
||||
if vim.tbl_contains(Config.disabled_tools, tool.name) then return false end
|
||||
if tool.enabled == nil then
|
||||
return true
|
||||
else
|
||||
|
||||
@@ -2317,8 +2317,7 @@ function Sidebar:create_input_container(opts)
|
||||
table.insert(tools, {
|
||||
name = "remove_file_from_context",
|
||||
description = "Remove a file from the context",
|
||||
---@param input { rel_path: string }
|
||||
---@type AvanteLLMToolFunc
|
||||
---@type AvanteLLMToolFunc<{ rel_path: string }>
|
||||
func = function(input)
|
||||
self.file_selector:remove_selected_file(input.rel_path)
|
||||
return "Removed file from context", nil
|
||||
|
||||
Reference in New Issue
Block a user