feat: add add_file_to_context tool (#1191)

This commit is contained in:
yetone
2025-02-06 16:00:14 +08:00
committed by GitHub
parent 4f41154e83
commit f2bd4adba4
4 changed files with 88 additions and 25 deletions

View File

@@ -344,7 +344,7 @@ end
---@param idx integer
---@return boolean
function FileSelector:remove_selected_filepaths(idx)
function FileSelector:remove_selected_filepaths_with_index(idx)
if idx > 0 and idx <= #self.selected_filepaths then
table.remove(self.selected_filepaths, idx)
self:emit("update")
@@ -353,6 +353,12 @@ function FileSelector:remove_selected_filepaths(idx)
return false
end
function FileSelector:remove_selected_file(rel_path)
local uniform_path = Utils.uniform_path(rel_path)
local idx = Utils.tbl_indexof(self.selected_filepaths, uniform_path)
if idx then self:remove_selected_filepaths_with_index(idx) end
end
---@return { path: string, content: string, file_type: string }[]
function FileSelector:get_selected_files_contents()
local contents = {}