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,
|
debounce = 600,
|
||||||
throttle = 600,
|
throttle = 600,
|
||||||
},
|
},
|
||||||
|
disabled_tools = {}, ---@type string[]
|
||||||
}
|
}
|
||||||
|
|
||||||
---@type avante.Config
|
---@type avante.Config
|
||||||
|
|||||||
@@ -569,7 +569,9 @@ end
|
|||||||
function M.get_tools()
|
function M.get_tools()
|
||||||
return vim
|
return vim
|
||||||
.iter(M._tools)
|
.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
|
if tool.enabled == nil then
|
||||||
return true
|
return true
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -2317,8 +2317,7 @@ function Sidebar:create_input_container(opts)
|
|||||||
table.insert(tools, {
|
table.insert(tools, {
|
||||||
name = "remove_file_from_context",
|
name = "remove_file_from_context",
|
||||||
description = "Remove a file from the context",
|
description = "Remove a file from the context",
|
||||||
---@param input { rel_path: string }
|
---@type AvanteLLMToolFunc<{ rel_path: string }>
|
||||||
---@type AvanteLLMToolFunc
|
|
||||||
func = function(input)
|
func = function(input)
|
||||||
self.file_selector:remove_selected_file(input.rel_path)
|
self.file_selector:remove_selected_file(input.rel_path)
|
||||||
return "Removed file from context", nil
|
return "Removed file from context", nil
|
||||||
|
|||||||
Reference in New Issue
Block a user