From 906c826dbd9f0d1a2545e04e7ce7e27b714cfa9a Mon Sep 17 00:00:00 2001 From: S4NKALP Date: Tue, 10 Jun 2025 13:12:32 +0545 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat(ai/avante):=20add=20dynamic=20?= =?UTF-8?q?provider=20configuration=20generation=20and=20extend=20copilot?= =?UTF-8?q?=20settings?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/plugins/ai/avante.lua | 46 ++++++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/lua/plugins/ai/avante.lua b/lua/plugins/ai/avante.lua index 7b66ad4..fb36dfc 100644 --- a/lua/plugins/ai/avante.lua +++ b/lua/plugins/ai/avante.lua @@ -13,32 +13,38 @@ local model_names = { 'o4-mini', } +-- Generate provider configurations for each model +local function generate_providers() + local providers_table = {} + for _, model_name in ipairs(model_names) do + local provider_key = 'copilot-' .. model_name + providers_table[provider_key] = { + __inherited_from = 'copilot', + model = model_name, + display_name = provider_key, + } + end + return providers_table +end + avante.setup({ mode = 'agentic', provider = 'copilot-claude-3.5-sonnet', -- cursor_applying_provider = 'copilot-o3-mini', -- auto_suggestions_provider = 'copilot-claude-3.7-sonnet', - copilot = { - endpoint = 'https://api.githubcopilot.com', - allow_insecure = false, - timeout = 10 * 60 * 1000, - temperature = 0, - max_completion_tokens = 1000000, - reasoning_effort = 'high', - }, - vendors = (function() - local vendors_table = {} - for _, model_name in ipairs(model_names) do - local vendor_key = 'copilot-' .. model_name - vendors_table[vendor_key] = { - __inherited_from = 'copilot', - model = model_name, - display_name = vendor_key, - } - end - return vendors_table - end)(), + providers = vim.tbl_extend('force', { + copilot = { + endpoint = 'https://api.githubcopilot.com', + allow_insecure = false, + timeout = 10 * 60 * 1000, + extra_request_body = { + temperature = 0, + }, + max_completion_tokens = 1000000, + reasoning_effort = 'high', + }, + }, generate_providers()), behaviour = { auto_suggestions = false,