Select model and behavior#47
Conversation
|
@joaopluigi feel free to change anything we did |
There was a problem hiding this comment.
Pull Request Overview
This PR adds functionality to select and configure AI model and behavior settings for the ECA chat system. The implementation provides user commands to dynamically switch between available models and behaviors during runtime.
- Adds state management methods for updating selected model and behavior
- Creates new user commands
EcaChatSelectModelandEcaChatSelectBehaviorwith interactive selection - Updates message sending to include current model and behavior context
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| lua/eca/state.lua | Adds update methods for selected model/behavior and fixes usage limit field name |
| lua/eca/commands.lua | Implements interactive selection commands using vim.ui.select |
| lua/eca/sidebar.lua | Updates message sending to include model and behavior context |
| tests/test_state.lua | Adds comprehensive tests for state update methods and fixes usage test data |
| tests/test_select_commands.lua | Full test coverage for the new selection commands |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| Logger.debug("ECA commands registered") | ||
| end | ||
|
|
||
| vim.api.nvim_create_user_command("EcaChatSelectModel", function() | ||
| local state = require("eca.state"):new() | ||
| local models = state.config.models.list | ||
|
|
||
| vim.ui.select(models, { | ||
| prompt = "Select ECA Chat Model:", | ||
| }, function(choice) | ||
| if choice then | ||
| state:update_selected_model(choice) | ||
| end | ||
| end) | ||
| end, { | ||
| desc = "Select Current ECA Chat model", | ||
| }) | ||
|
|
||
| vim.api.nvim_create_user_command("EcaChatSelectBehavior", function() | ||
| local state = require("eca.state"):new() | ||
| local behaviors = state.config.behaviors.list | ||
|
|
||
| vim.ui.select(behaviors, { | ||
| prompt = "Select ECA Chat Behavior:", | ||
| }, function(choice) | ||
| if choice then | ||
| state:update_selected_behavior(choice) | ||
| end | ||
| end) | ||
| end, { | ||
| desc = "Select Current ECA Chat behavior", | ||
| }) |
There was a problem hiding this comment.
These command definitions are placed outside the M.setup() function, which means they will be executed immediately when the module is loaded rather than when setup() is called. This creates inconsistent behavior with other commands in the module and could lead to registration issues if the module is required multiple times.
| Logger.debug("ECA commands registered") | |
| end | |
| vim.api.nvim_create_user_command("EcaChatSelectModel", function() | |
| local state = require("eca.state"):new() | |
| local models = state.config.models.list | |
| vim.ui.select(models, { | |
| prompt = "Select ECA Chat Model:", | |
| }, function(choice) | |
| if choice then | |
| state:update_selected_model(choice) | |
| end | |
| end) | |
| end, { | |
| desc = "Select Current ECA Chat model", | |
| }) | |
| vim.api.nvim_create_user_command("EcaChatSelectBehavior", function() | |
| local state = require("eca.state"):new() | |
| local behaviors = state.config.behaviors.list | |
| vim.ui.select(behaviors, { | |
| prompt = "Select ECA Chat Behavior:", | |
| }, function(choice) | |
| if choice then | |
| state:update_selected_behavior(choice) | |
| end | |
| end) | |
| end, { | |
| desc = "Select Current ECA Chat behavior", | |
| }) | |
| vim.api.nvim_create_user_command("EcaChatSelectModel", function() | |
| local state = require("eca.state"):new() | |
| local models = state.config.models.list | |
| vim.ui.select(models, { | |
| prompt = "Select ECA Chat Model:", | |
| }, function(choice) | |
| if choice then | |
| state:update_selected_model(choice) | |
| end | |
| end) | |
| end, { | |
| desc = "Select Current ECA Chat model", | |
| }) | |
| vim.api.nvim_create_user_command("EcaChatSelectBehavior", function() | |
| local state = require("eca.state"):new() | |
| local behaviors = state.config.behaviors.list | |
| vim.ui.select(behaviors, { | |
| prompt = "Select ECA Chat Behavior:", | |
| }, function(choice) | |
| if choice then | |
| state:update_selected_behavior(choice) | |
| end | |
| end) | |
| end, { | |
| desc = "Select Current ECA Chat behavior", | |
| }) | |
| Logger.debug("ECA commands registered") | |
| end |
| end | ||
| end) | ||
| end, { | ||
| desc = "Select Current ECA Chat model", |
There was a problem hiding this comment.
Inconsistent capitalization in command description. Should be 'Select current ECA Chat model' to match the pattern used in the behavior command description.
|
Feel free to merge @joaopluigi when you think its good |
Paired with @joaopluigi