From f1d39594dedba910fd7cd4a157e7217f75db06f2 Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Tue, 16 Sep 2025 16:52:28 +0200 Subject: [PATCH] fix(chat): ensure user prompt is wrapped in a list Previously, the user prompt was not wrapped in a table when initializing the chat history, which could cause issues when the code expects a list of messages. This change ensures the prompt is always provided as a list with the correct structure. Closes #1426 --- lua/CopilotChat/init.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lua/CopilotChat/init.lua b/lua/CopilotChat/init.lua index d8a3e378..98c1c1e6 100644 --- a/lua/CopilotChat/init.lua +++ b/lua/CopilotChat/init.lua @@ -894,8 +894,10 @@ function M.ask(prompt, config) history = M.chat:get_messages() else history = { - content = prompt, - role = constants.ROLE.USER, + { + content = prompt, + role = constants.ROLE.USER, + }, } end