fix: clear useless parameters

This commit is contained in:
yetone
2025-07-17 13:48:15 +08:00
parent 2a16e7d4d9
commit 5ea24f59fa
7 changed files with 8 additions and 8 deletions

View File

@@ -830,12 +830,12 @@ function M._stream(opts)
---@type AvanteLLMToolFuncOpts
local tool_use_opts = {
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 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 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)
end
return

View File

@@ -3,7 +3,7 @@ local Config = require("avante.config")
local Highlights = require("avante.highlights")
local Line = require("avante.ui.line")
---@alias AttemptCompletionInput {result: string, command?: string, streaming?: boolean}
---@alias AttemptCompletionInput {result: string, command?: string}
---@class AvanteLLMTool
local M = setmetatable({}, Base)

View File

@@ -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)
local is_streaming = opts.streaming or false
if is_streaming then

View File

@@ -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)
local on_complete = opts.on_complete
if not on_complete then return false, "on_complete not provided" end

View File

@@ -31,7 +31,7 @@ function M.str_replace_editor(input, opts)
return M.str_replace_based_edit_tool(input, opts)
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)
local on_log = opts.on_log
local on_complete = opts.on_complete

View File

@@ -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)
local replace_in_file = require("avante.llm_tools.replace_in_file")
local diff = "------- SEARCH\n" .. input.old_str .. "\n=======\n" .. input.new_str

View File

@@ -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.
---@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)
if input.the_content ~= nil then
input.content = input.the_content