diff --git a/lua/avante/llm_tools/str_replace.lua b/lua/avante/llm_tools/str_replace.lua index 358b9e8..572a04a 100644 --- a/lua/avante/llm_tools/str_replace.lua +++ b/lua/avante/llm_tools/str_replace.lua @@ -59,6 +59,10 @@ function M.func(input, opts) local replace_in_file = require("avante.llm_tools.replace_in_file") local Utils = require("avante.utils") + if input.new_str == nil then input.new_str = "" end + + if input.old_str == nil then input.old_str = "" end + -- Remove trailing spaces from the new string input.new_str = Utils.remove_trailing_spaces(input.new_str)