refactor: llm tool parameters (#2449)
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
local Base = require("avante.llm_tools.base")
|
||||
local Config = require("avante.config")
|
||||
|
||||
---@class AvanteLLMTool
|
||||
local M = setmetatable({}, Base)
|
||||
@@ -55,17 +54,17 @@ M.returns = {
|
||||
}
|
||||
|
||||
---@type AvanteLLMToolFunc<{ path: string, old_str: string, new_str: string, streaming?: boolean, tool_use_id?: string }>
|
||||
function M.func(opts, on_log, on_complete, session_ctx)
|
||||
function M.func(input, opts)
|
||||
local replace_in_file = require("avante.llm_tools.replace_in_file")
|
||||
local diff = "------- SEARCH\n" .. opts.old_str .. "\n=======\n" .. opts.new_str
|
||||
if not opts.streaming then diff = diff .. "\n+++++++ REPLACE" end
|
||||
local new_opts = {
|
||||
path = opts.path,
|
||||
local diff = "------- SEARCH\n" .. input.old_str .. "\n=======\n" .. input.new_str
|
||||
if not input.streaming then diff = diff .. "\n+++++++ REPLACE" end
|
||||
local new_input = {
|
||||
path = input.path,
|
||||
diff = diff,
|
||||
streaming = opts.streaming,
|
||||
tool_use_id = opts.tool_use_id,
|
||||
streaming = input.streaming,
|
||||
tool_use_id = input.tool_use_id,
|
||||
}
|
||||
return replace_in_file.func(new_opts, on_log, on_complete, session_ctx)
|
||||
return replace_in_file.func(new_input, opts)
|
||||
end
|
||||
|
||||
return M
|
||||
|
||||
Reference in New Issue
Block a user