diff --git a/doc/configuration/adapters-acp.md b/doc/configuration/adapters-acp.md index 7bb476435..7f5fdf3d8 100644 --- a/doc/configuration/adapters-acp.md +++ b/doc/configuration/adapters-acp.md @@ -208,6 +208,24 @@ require("codecompanion").setup({ }) ``` +## Controlling Model Choices + +When switching between adapters, the plugin typically displays all available model choices for the selected adapter. If you want to simplify the interface and have the default model automatically chosen (without showing any model selection UI), you can set the `show_model_choices` option to `false`: + +```lua +require("codecompanion").setup({ + adapters = { + acp = { + opts = { + show_model_choices = false, + }, + }, + }, +}) +``` + +With `show_model_choices = false`, the default model (as reported by the ACP agent) will be automatically selected when changing adapters, and no model selection will be shown to the user. + ## Setup: Auggie CLI from Augment Code To use [Auggie CLI](https://docs.augmentcode.com/cli/overview) within CodeCompanion, you simply need to follow their [Getting Started](https://docs.augmentcode.com/cli/overview#getting-started) guide. diff --git a/lua/codecompanion/config.lua b/lua/codecompanion/config.lua index e3f660fd5..a1ef88c6d 100644 --- a/lua/codecompanion/config.lua +++ b/lua/codecompanion/config.lua @@ -51,6 +51,7 @@ local defaults = { opencode = "opencode", opts = { show_presets = true, + show_model_choices = true, -- Show model choices when changing adapter }, }, opts = { diff --git a/lua/codecompanion/interactions/chat/keymaps/change_adapter.lua b/lua/codecompanion/interactions/chat/keymaps/change_adapter.lua index 4c55c341a..60c85f9a2 100644 --- a/lua/codecompanion/interactions/chat/keymaps/change_adapter.lua +++ b/lua/codecompanion/interactions/chat/keymaps/change_adapter.lua @@ -125,6 +125,15 @@ end ---@param connection CodeCompanion.ACP.Connection ---@return table|nil function M.list_acp_models(connection) + local show_choices = config.adapters + and config.adapters.acp + and config.adapters.acp.opts + and config.adapters.acp.opts.show_model_choices + + if not show_choices then + return nil + end + local models = connection:get_models() if not models or vim.tbl_count(models.availableModels) < 2 then return nil