Skip to content

feat: use model name and versioning for model selection and switch to gpt-4o-2024-11-20 #1055

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ Below are all available configuration options with their default values:

system_prompt = 'COPILOT_INSTRUCTIONS', -- System prompt to use (can be specified manually in prompt via /).

model = 'gpt-4o', -- Default model to use, see ':CopilotChatModels' for available models (can be specified manually in prompt via $).
model = 'gpt-4o-2024-11-20', -- Default model to use, see ':CopilotChatModels' for available models (can be specified manually in prompt via $).
agent = 'copilot', -- Default agent to use, see ':CopilotChatAgents' for available agents (can be specified manually in prompt via @).
context = nil, -- Default context or array of contexts to use (can be specified manually in prompt via #).
sticky = nil, -- Default sticky prompt or array of sticky prompts to use at start of every new chat.
Expand Down
2 changes: 1 addition & 1 deletion lua/CopilotChat/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ return {

system_prompt = 'COPILOT_INSTRUCTIONS', -- System prompt to use (can be specified manually in prompt via /).

model = 'gpt-4o', -- Default model to use, see ':CopilotChatModels' for available models (can be specified manually in prompt via $).
model = 'gpt-4o-2024-11-20', -- Default model to use, see ':CopilotChatModels' for available models (can be specified manually in prompt via $).
agent = 'none', -- Default agent to use, see ':CopilotChatAgents' for available agents (can be specified manually in prompt via @).
context = nil, -- Default context or array of contexts to use (can be specified manually in prompt via #).
sticky = nil, -- Default sticky prompt or array of sticky prompts to use at start of every new chat.
Expand Down
12 changes: 4 additions & 8 deletions lua/CopilotChat/config/providers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -186,18 +186,14 @@ M.copilot = {
end)
:totable()

local version_map = {}
local name_map = {}
for _, model in ipairs(models) do
if not version_map[model.version] or #model.id < #version_map[model.version] then
version_map[model.version] = model.id
if not name_map[model.name] or model.version > name_map[model.name].version then
name_map[model.name] = model
end
end

models = vim.tbl_map(function(id)
return vim.tbl_filter(function(model)
return model.id == id
end, models)[1]
end, vim.tbl_values(version_map))
models = vim.tbl_values(name_map)

for _, model in ipairs(models) do
if not model.policy then
Expand Down
4 changes: 2 additions & 2 deletions lua/CopilotChat/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,7 @@ function M.select_model()
vim.ui.select(choices, {
prompt = 'Select a model> ',
format_item = function(item)
local out = string.format('%s (%s)', item.id, item.provider)
local out = string.format('%s (%s:%s)', item.name, item.provider, item.id)
if item.selected then
out = '* ' .. out
end
Expand Down Expand Up @@ -764,7 +764,7 @@ function M.select_agent()
vim.ui.select(choices, {
prompt = 'Select an agent> ',
format_item = function(item)
local out = string.format('%s (%s)', item.id, item.provider)
local out = string.format('%s (%s:%s)', item.name, item.provider, item.id)
if item.selected then
out = '* ' .. out
end
Expand Down
Loading