Skip to content

Commit d5fcd00

Browse files
committed
fix: agent refreshing for default commands
1 parent 4044c31 commit d5fcd00

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

lua/gp/init.lua

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ M.refresh_state = function()
224224
M._state.command_agent = M._command_agents[1]
225225
end
226226

227+
M.logger.debug("stored state: " .. vim.inspect(M._state))
227228
M.helpers.table_to_file(M._state, state_file)
228229

229230
M.prepare_commands()
@@ -274,13 +275,13 @@ M.prepare_commands = function()
274275
-- uppercase first letter
275276
local command = name:gsub("^%l", string.upper)
276277

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-
283278
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+
284285
-- template is chosen dynamically based on mode in which the command is called
285286
local template = M.config.template_command
286287
if params.range == 2 then
@@ -1521,6 +1522,7 @@ M.get_command_agent = function(name)
15211522
local model = M.agents[name].model
15221523
local system_prompt = M.agents[name].system_prompt
15231524
local provider = M.agents[name].provider
1525+
M.logger.debug("Getting command agent: " .. name)
15241526
return {
15251527
cmd_prefix = cmd_prefix,
15261528
name = name,
@@ -1543,6 +1545,7 @@ M.get_chat_agent = function(name)
15431545
local model = M.agents[name].model
15441546
local system_prompt = M.agents[name].system_prompt
15451547
local provider = M.agents[name].provider
1548+
M.logger.debug("Getting chat agent: " .. name)
15461549
return {
15471550
cmd_prefix = cmd_prefix,
15481551
name = name,

0 commit comments

Comments
 (0)