From 794c6430334f0a422507ac44e3e8cf63ca1b41b7 Mon Sep 17 00:00:00 2001 From: Yang Jun Date: Thu, 9 Jan 2025 00:14:14 +0800 Subject: [PATCH] fix: cannot apply changes if model is gemini-2.0-flash-thinking-exp-1219 (#1052) --- lua/avante/sidebar.lua | 3 ++- lua/avante/templates/planning.avanterules | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lua/avante/sidebar.lua b/lua/avante/sidebar.lua index 525f848..1d22efe 100644 --- a/lua/avante/sidebar.lua +++ b/lua/avante/sidebar.lua @@ -224,8 +224,9 @@ local function transform_result_content(selected_files, result_content, prev_fil local start_line = 0 local end_line = 0 local match_filetype = nil + local filepath = current_filepath or prev_filepath or "" for _, file in ipairs(selected_files) do - if not Utils.is_same_file(file.path, prev_filepath or "") then goto continue1 end + if not Utils.is_same_file(file.path, filepath) then goto continue1 end local file_content = vim.split(file.content, "\n") if start_line ~= 0 or end_line ~= 0 then break end for j = 1, #file_content - (search_end - search_start) + 1 do diff --git a/lua/avante/templates/planning.avanterules b/lua/avante/templates/planning.avanterules index 8de118f..9e76666 100644 --- a/lua/avante/templates/planning.avanterules +++ b/lua/avante/templates/planning.avanterules @@ -116,6 +116,7 @@ Every *SEARCH/REPLACE block* must use this format: 5. The start of replace block: 6. The lines to replace into the source code 7. The end of the replace block: +8. Please *DO NOT* put *SEARCH/REPLACE block* inside three backticks: {%raw%}```{%endraw%} Use the *FULL* file path, as shown to you by the user.