feat: add view_range parameter and remove read_file llm tool (#1690)
This commit is contained in:
@@ -6,7 +6,7 @@ local Utils = require("avante.utils")
|
||||
local ls = require("avante.llm_tools.ls")
|
||||
local grep = require("avante.llm_tools.grep")
|
||||
local glob = require("avante.llm_tools.glob")
|
||||
local read_file = require("avante.llm_tools.read_file")
|
||||
local view = require("avante.llm_tools.view")
|
||||
local bash = require("avante.llm_tools.bash")
|
||||
|
||||
LlmToolHelpers.confirm = function(msg, cb) return cb(true) end
|
||||
@@ -75,17 +75,27 @@ describe("llm_tools", function()
|
||||
end)
|
||||
end)
|
||||
|
||||
describe("read_file", function()
|
||||
describe("view", function()
|
||||
it("should read file content", function()
|
||||
local content, err = read_file({ rel_path = "test.txt" })
|
||||
assert.is_nil(err)
|
||||
assert.equals("test content", content)
|
||||
view({ path = "test.txt" }, nil, function(content, err)
|
||||
assert.is_nil(err)
|
||||
assert.equals("test content", content)
|
||||
end)
|
||||
end)
|
||||
|
||||
it("should return error for non-existent file", function()
|
||||
local content, err = read_file({ rel_path = "non_existent.txt" })
|
||||
assert.truthy(err)
|
||||
assert.equals("", content)
|
||||
view({ path = "non_existent.txt" }, nil, function(content, err)
|
||||
assert.truthy(err)
|
||||
assert.equals("", content)
|
||||
end)
|
||||
end)
|
||||
|
||||
it("should read directory content", function()
|
||||
view({ path = test_dir }, nil, function(content, err)
|
||||
assert.is_nil(err)
|
||||
assert.truthy(content:find("test.txt"))
|
||||
assert.truthy(content:find("test content"))
|
||||
end)
|
||||
end)
|
||||
end)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user