From fa89b147db670b2e6173a833478b2097a13c2635 Mon Sep 17 00:00:00 2001 From: yetone Date: Fri, 21 Feb 2025 00:45:41 +0800 Subject: [PATCH] fix: custom prompts (#1328) --- lua/avante/path.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lua/avante/path.lua b/lua/avante/path.lua index d0ff1d0..2801269 100644 --- a/lua/avante/path.lua +++ b/lua/avante/path.lua @@ -107,14 +107,19 @@ Prompt.get = function(project_root) for _, entry in ipairs(scanner) do local file = Path:new(entry) if file:is_file() then + if not entry:match("%.avanterules$") then goto continue end if entry:find("planning") and Prompt.templates.planning == nil then + Utils.info(string.format("Using %s as planning system prompt", entry)) Prompt.templates.planning = file:read() elseif entry:find("editing") and Prompt.templates.editing == nil then + Utils.info(string.format("Using %s as editing system prompt", entry)) Prompt.templates.editing = file:read() elseif entry:find("suggesting") and Prompt.templates.suggesting == nil then + Utils.info(string.format("Using %s as suggesting system prompt", entry)) Prompt.templates.suggesting = file:read() end end + ::continue:: end Path:new(debug.getinfo(1).source:match("@?(.*/)"):gsub("/lua/avante/path.lua$", "") .. "templates")