fix: clear useless parameters
This commit is contained in:
@@ -830,12 +830,12 @@ function M._stream(opts)
|
|||||||
---@type AvanteLLMToolFuncOpts
|
---@type AvanteLLMToolFuncOpts
|
||||||
local tool_use_opts = {
|
local tool_use_opts = {
|
||||||
session_ctx = opts.session_ctx,
|
session_ctx = opts.session_ctx,
|
||||||
|
tool_use_id = partial_tool_use.id,
|
||||||
|
streaming = partial_tool_use.state == "generating",
|
||||||
}
|
}
|
||||||
if partial_tool_use.state == "generating" and not is_edit_tool_use and not support_streaming then return end
|
if partial_tool_use.state == "generating" and not is_edit_tool_use and not support_streaming then return end
|
||||||
if type(partial_tool_use.input) == "table" then tool_use_opts.tool_use_id = partial_tool_use.id end
|
|
||||||
if partial_tool_use.state == "generating" then
|
if partial_tool_use.state == "generating" then
|
||||||
if type(partial_tool_use.input) == "table" then
|
if type(partial_tool_use.input) == "table" then
|
||||||
tool_use_opts.streaming = true
|
|
||||||
LLMTools.process_tool_use(prompt_opts.tools, partial_tool_use, tool_use_opts)
|
LLMTools.process_tool_use(prompt_opts.tools, partial_tool_use, tool_use_opts)
|
||||||
end
|
end
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ local Config = require("avante.config")
|
|||||||
local Highlights = require("avante.highlights")
|
local Highlights = require("avante.highlights")
|
||||||
local Line = require("avante.ui.line")
|
local Line = require("avante.ui.line")
|
||||||
|
|
||||||
---@alias AttemptCompletionInput {result: string, command?: string, streaming?: boolean}
|
---@alias AttemptCompletionInput {result: string, command?: string}
|
||||||
|
|
||||||
---@class AvanteLLMTool
|
---@class AvanteLLMTool
|
||||||
local M = setmetatable({}, Base)
|
local M = setmetatable({}, Base)
|
||||||
|
|||||||
@@ -214,7 +214,7 @@ M.returns = {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
---@type AvanteLLMToolFunc<{ path: string, command: string, streaming?: boolean }>
|
---@type AvanteLLMToolFunc<{ path: string, command: string }>
|
||||||
function M.func(input, opts)
|
function M.func(input, opts)
|
||||||
local is_streaming = opts.streaming or false
|
local is_streaming = opts.streaming or false
|
||||||
if is_streaming then
|
if is_streaming then
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ M.returns = {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
---@type AvanteLLMToolFunc<{ target_file: string, instructions: string, code_edit: string, streaming?: boolean, tool_use_id?: string }>
|
---@type AvanteLLMToolFunc<{ target_file: string, instructions: string, code_edit: string }>
|
||||||
M.func = vim.schedule_wrap(function(input, opts)
|
M.func = vim.schedule_wrap(function(input, opts)
|
||||||
local on_complete = opts.on_complete
|
local on_complete = opts.on_complete
|
||||||
if not on_complete then return false, "on_complete not provided" end
|
if not on_complete then return false, "on_complete not provided" end
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ function M.str_replace_editor(input, opts)
|
|||||||
return M.str_replace_based_edit_tool(input, opts)
|
return M.str_replace_based_edit_tool(input, opts)
|
||||||
end
|
end
|
||||||
|
|
||||||
---@type AvanteLLMToolFunc<{ command: "view" | "str_replace" | "create" | "insert", path: string, old_str?: string, new_str?: string, file_text?: string, insert_line?: integer, new_str?: string, view_range?: integer[], streaming?: boolean }>
|
---@type AvanteLLMToolFunc<{ command: "view" | "str_replace" | "create" | "insert", path: string, old_str?: string, new_str?: string, file_text?: string, insert_line?: integer, new_str?: string, view_range?: integer[] }>
|
||||||
function M.str_replace_based_edit_tool(input, opts)
|
function M.str_replace_based_edit_tool(input, opts)
|
||||||
local on_log = opts.on_log
|
local on_log = opts.on_log
|
||||||
local on_complete = opts.on_complete
|
local on_complete = opts.on_complete
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ M.returns = {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
---@type AvanteLLMToolFunc<{ path: string, old_str: string, new_str: string, streaming?: boolean, tool_use_id?: string }>
|
---@type AvanteLLMToolFunc<{ path: string, old_str: string, new_str: string }>
|
||||||
function M.func(input, opts)
|
function M.func(input, opts)
|
||||||
local replace_in_file = require("avante.llm_tools.replace_in_file")
|
local replace_in_file = require("avante.llm_tools.replace_in_file")
|
||||||
local diff = "------- SEARCH\n" .. input.old_str .. "\n=======\n" .. input.new_str
|
local diff = "------- SEARCH\n" .. input.old_str .. "\n=======\n" .. input.new_str
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ M.returns = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
--- IMPORTANT: Using "the_content" instead of "content" is to avoid LLM streaming generating function parameters in alphabetical order, which would result in generating "path" after "content", making it impossible to achieve a stream diff view.
|
--- IMPORTANT: Using "the_content" instead of "content" is to avoid LLM streaming generating function parameters in alphabetical order, which would result in generating "path" after "content", making it impossible to achieve a stream diff view.
|
||||||
---@type AvanteLLMToolFunc<{ path: string, content: string, the_content?: string, streaming?: boolean, tool_use_id?: string }>
|
---@type AvanteLLMToolFunc<{ path: string, content: string, the_content?: string }>
|
||||||
function M.func(input, opts)
|
function M.func(input, opts)
|
||||||
if input.the_content ~= nil then
|
if input.the_content ~= nil then
|
||||||
input.content = input.the_content
|
input.content = input.the_content
|
||||||
|
|||||||
Reference in New Issue
Block a user