@@ -298,6 +298,7 @@ local on_done = Promise.async(function(session_obj)
298298 cleanup_session (session_info , session_obj .id , ' Failed to update file with quick chat response' ) -- Error cleanup
299299 end
300300
301+ -- @TODO: enable session deletion after testing
301302 -- Always delete ephemeral session
302303 -- state.api_client:delete_session(session_obj.id):catch(function(err)
303304 -- vim.notify('Error deleting ephemeral session: ' .. vim.inspect(err), vim.log.levels.WARN)
349350--- @param context_instance table Context instance
350351--- @param options table Options including model and agent
351352--- @return table params Message parameters
352- local function create_message_params (message , context_instance , options )
353- local quick_chat_config = config .values . quick_chat or {}
353+ local create_message = Promise . async ( function (message , context_instance , options )
354+ local quick_chat_config = config .quick_chat or {}
354355 local instructions = quick_chat_config .instructions
355356 or {
356357 ' You are an expert code assistant helping with code and text editing tasks.' ,
@@ -402,7 +403,7 @@ local function create_message_params(message, context_instance, options)
402403 end
403404
404405 return params
405- end
406+ end )
406407
407408--- Unified quick chat function
408409--- @param message string Optional custom message to use instead of default prompts
@@ -428,7 +429,6 @@ M.quick_chat = Promise.async(function(message, options, range)
428429 -- Setup context
429430 local context_config = vim .tbl_deep_extend (' force' , create_context_config (range ~= nil ), options .context_config or {})
430431 local context_instance = setup_quick_chat_context (buf , context_config , range )
431-
432432 -- Check prompt guard
433433 local allowed , err_msg = util .check_prompt_allowed (config .values .prompt_guard , context_instance :get_mentioned_files ())
434434 if not allowed then
@@ -456,7 +456,8 @@ M.quick_chat = Promise.async(function(message, options, range)
456456 }
457457
458458 -- Create and send message
459- local params = create_message_params (message , context_instance , options )
459+ local params = create_message (message , context_instance , options ):await ()
460+ spinner :stop ()
460461
461462 local success , err = pcall (function ()
462463 state .api_client :create_message (quick_chat_session .id , params ):await ()
0 commit comments