Skip to content

Commit

Permalink
feat: configurable default agents (#85, #148)
Browse files Browse the repository at this point in the history
  • Loading branch information
Robitx committed Aug 4, 2024
1 parent 4cea5ae commit 49d1986
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lua/gp/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ local config = {
-- directory for persisting state dynamically changed by user (like model or persona)
state_dir = vim.fn.stdpath("data"):gsub("/$", "") .. "/gp/persisted",

-- default agent names set during startup, if nil last used agent is used
default_command_agent = nil,
default_chat_agent = nil,

-- default command agents (model + persona)
-- name, model and system_prompt are mandatory fields
-- to use agent for chat set chat = true, for command set command = true
Expand Down
8 changes: 8 additions & 0 deletions lua/gp/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,14 @@ M.setup = function(opts)

M.refresh_state()

if M.config.default_command_agent then
M.refresh_state({ command_agent = M.config.default_command_agent })
end

if M.config.default_chat_agent then
M.refresh_state({ chat_agent = M.config.default_chat_agent })
end

-- register user commands
for hook, _ in pairs(M.hooks) do
M.helpers.create_user_command(M.config.cmd_prefix .. hook, function(params)
Expand Down

0 comments on commit 49d1986

Please sign in to comment.