307307local create_message = Promise .async (function (message , buf , range , context_instance , options )
308308 local quick_chat_config = config .quick_chat or {}
309309
310- -- Generate instructions (allow user override)
311310 local instructions
312311 if quick_chat_config .instructions then
313312 instructions = quick_chat_config .instructions
@@ -323,12 +322,11 @@ local create_message = Promise.async(function(message, buf, range, context_insta
323322 local result = context .format_message_plain_text (message , context_instance , format_opts ):await ()
324323
325324 local parts = {
326- { type = ' text' , text = instructions_text },
327- { type = ' text' , text = ' \n\n ' .. string.rep ( ' = ' , 80 ) .. ' \n\n ' .. ' # USER REQUEST \n\n ' .. result .text },
325+ { type = ' text' , text = table.concat ( instructions , ' \n ' ) },
326+ { type = ' text' , text = result .text },
328327 }
329328
330- -- Use instructions as system prompt for models that support it
331- local params = { parts = parts , system = instructions_text }
329+ local params = { parts = parts }
332330
333331 local current_model = core .initialize_current_model ():await ()
334332 local target_model = options .model or quick_chat_config .default_model or current_model
@@ -339,13 +337,9 @@ local create_message = Promise.async(function(message, buf, range, context_insta
339337 end
340338 end
341339
342- -- Set agent if specified
343- local target_mode = options .agent
344- or quick_chat_config .default_agent
345- or state .current_mode
346- or config .values .default_mode
347- if target_mode then
348- params .agent = target_mode
340+ local target_agent = options .agent or quick_chat_config .default_agent or state .current_mode or config .default_mode
341+ if target_agent then
342+ params .agent = target_agent
349343 end
350344
351345 return params
0 commit comments