Skip to content

Select model and behavior#47

Merged
joaopluigi merged 10 commits intomainfrom
select-model-and-behavior
Oct 9, 2025
Merged

Select model and behavior#47
joaopluigi merged 10 commits intomainfrom
select-model-and-behavior

Conversation

@ericdallo
Copy link
Copy Markdown
Member

@ericdallo ericdallo commented Oct 5, 2025

Paired with @joaopluigi

@ericdallo
Copy link
Copy Markdown
Member Author

@joaopluigi feel free to change anything we did

@joaopluigi joaopluigi changed the base branch from main to async-server-download October 6, 2025 17:28
Base automatically changed from async-server-download to main October 8, 2025 11:30
@joaopluigi joaopluigi marked this pull request as ready for review October 8, 2025 11:31
Copilot AI review requested due to automatic review settings October 8, 2025 11:31
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 EcaChatSelectModel and EcaChatSelectBehavior with 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.

Comment thread lua/eca/commands.lua Outdated
Comment on lines +346 to +377
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",
})
Copy link

Copilot AI Oct 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
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

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch

Comment thread lua/eca/commands.lua Outdated
end
end)
end, {
desc = "Select Current ECA Chat model",
Copy link

Copilot AI Oct 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent capitalization in command description. Should be 'Select current ECA Chat model' to match the pattern used in the behavior command description.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense

Comment thread lua/eca/commands.lua Outdated
@joaopluigi joaopluigi marked this pull request as draft October 8, 2025 12:08
@joaopluigi joaopluigi marked this pull request as ready for review October 8, 2025 12:21
@ericdallo
Copy link
Copy Markdown
Member Author

Feel free to merge @joaopluigi when you think its good

@joaopluigi joaopluigi merged commit 9c90bad into main Oct 9, 2025
3 checks passed
@joaopluigi joaopluigi deleted the select-model-and-behavior branch October 9, 2025 13:21
joaopluigi added a commit that referenced this pull request Oct 9, 2025
…l-and-behavior"

This reverts commit 9c90bad, reversing
changes made to 8ae1e0a.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants