@@ -224,6 +224,7 @@ M.refresh_state = function()
224
224
M ._state .command_agent = M ._command_agents [1 ]
225
225
end
226
226
227
+ M .logger .debug (" stored state: " .. vim .inspect (M ._state ))
227
228
M .helpers .table_to_file (M ._state , state_file )
228
229
229
230
M .prepare_commands ()
@@ -274,13 +275,13 @@ M.prepare_commands = function()
274
275
-- uppercase first letter
275
276
local command = name :gsub (" ^%l" , string.upper )
276
277
277
- local agent = M .get_command_agent ()
278
- -- popup is like ephemeral one off chat
279
- if target == M .Target .popup then
280
- agent = M .get_chat_agent ()
281
- end
282
-
283
278
local cmd = function (params , whisper )
279
+ local agent = M .get_command_agent ()
280
+ -- popup is like ephemeral one off chat
281
+ if target == M .Target .popup then
282
+ agent = M .get_chat_agent ()
283
+ end
284
+
284
285
-- template is chosen dynamically based on mode in which the command is called
285
286
local template = M .config .template_command
286
287
if params .range == 2 then
@@ -1521,6 +1522,7 @@ M.get_command_agent = function(name)
1521
1522
local model = M .agents [name ].model
1522
1523
local system_prompt = M .agents [name ].system_prompt
1523
1524
local provider = M .agents [name ].provider
1525
+ M .logger .debug (" Getting command agent: " .. name )
1524
1526
return {
1525
1527
cmd_prefix = cmd_prefix ,
1526
1528
name = name ,
@@ -1543,6 +1545,7 @@ M.get_chat_agent = function(name)
1543
1545
local model = M .agents [name ].model
1544
1546
local system_prompt = M .agents [name ].system_prompt
1545
1547
local provider = M .agents [name ].provider
1548
+ M .logger .debug (" Getting chat agent: " .. name )
1546
1549
return {
1547
1550
cmd_prefix = cmd_prefix ,
1548
1551
name = name ,
0 commit comments