From b3289ff51a27f44f1221d027f82942d3b722ab30 Mon Sep 17 00:00:00 2001 From: brook hong Date: Sun, 24 Aug 2025 15:47:30 +0800 Subject: [PATCH] fix: wrap user input in task only in agentic mode (#2636) --- lua/avante/llm.lua | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/lua/avante/llm.lua b/lua/avante/llm.lua index 029142a..87e4309 100644 --- a/lua/avante/llm.lua +++ b/lua/avante/llm.lua @@ -404,16 +404,18 @@ function M.generate_prompts(opts) if msg.is_user_submission then message = vim.deepcopy(message) local content = message.content - if type(content) == "string" then - message.content = "" .. content .. "" - elseif type(content) == "table" then - for idx, item in ipairs(content) do - if type(item) == "string" then - item = "" .. item .. "" - content[idx] = item - elseif type(item) == "table" and item.type == "text" then - item.content = "" .. item.content .. "" - content[idx] = item + if Config.mode == "agentic" then + if type(content) == "string" then + message.content = "" .. content .. "" + elseif type(content) == "table" then + for idx, item in ipairs(content) do + if type(item) == "string" then + item = "" .. item .. "" + content[idx] = item + elseif type(item) == "table" and item.type == "text" then + item.content = "" .. item.content .. "" + content[idx] = item + end end end end