initial change to tools logic
This commit is contained in:
17
lua/chatgpt_nvim/tools/read_file.lua
Normal file
17
lua/chatgpt_nvim/tools/read_file.lua
Normal file
@@ -0,0 +1,17 @@
|
||||
local uv = vim.loop
|
||||
local M = {}
|
||||
|
||||
M.run = function(tool_call, conf, prompt_user_tool_accept, is_subpath, read_file)
|
||||
local path = tool_call.path
|
||||
if not path then
|
||||
return "[read_file] Missing 'path'."
|
||||
end
|
||||
local file_data = read_file(path)
|
||||
if file_data then
|
||||
return string.format("Tool [read_file for '%s'] Result:\n\n%s", path, file_data)
|
||||
else
|
||||
return string.format("Tool [read_file for '%s'] FAILED. File not found or not readable.", path)
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
Reference in New Issue
Block a user