local avante = require('avante') local model_names = { 'claude-3.5-sonnet', 'claude-3.7-sonnet', 'claude-3.7-sonnet-thought', 'gemini-2.0-flash-001', 'gemini-2.5-pro', 'gpt-4.1', 'gpt-4o-2024-11-20', 'o1', 'o3-mini', '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', 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, auto_set_highlight_group = true, auto_set_keymaps = true, auto_apply_diff_after_generation = false, support_paste_from_clipboard = false, minimize_diff = true, -- Whether to remove unchanged lines when applying a code block enable_token_counting = true, }, hints = { enabled = false }, mappings = { ---@class AvanteConflictMappings diff = { ours = 'co', theirs = 'ct', all_theirs = 'ca', both = 'cb', cursor = 'cc', next = ']x', prev = '[x', }, suggestion = { accept = '', next = '', prev = '', dismiss = '', }, jump = { next = ']]', prev = '[[', }, submit = { normal = '', insert = '', }, cancel = { normal = { '', '', 'q' }, insert = { '' }, }, ask = 'aa', edit = 'ae', refresh = 'ar', focus = 'af', stop = 'as', select_model = 'aM', select_history = 'ah', files = { add_current = 'ac', add_all_buffers = 'ab', }, toggle = { default = 'at', debug = 'ad', hint = 'aH', suggestion = 'aS', repomap = 'aR', }, sidebar = { apply_all = 'A', apply_cursor = 'a', retry_user_request = 'r', edit_user_request = 'e', switch_windows = '', reverse_switch_windows = '', remove_file = 'd', add_file = 'a', close = { 'q' }, close_from_input = nil, -- e.g., { normal = "", insert = "" } }, }, windows = { ---@type "right" | "left" | "top" | "bottom" position = 'right', wrap = true, width = 40, sidebar_header = { enabled = true, align = 'center', rounded = true, }, input = { prefix = '> ', height = 32, }, edit = { border = 'rounded', start_insert = true, }, ask = { floating = false, start_insert = true, border = 'rounded', ---@type "ours" | "theirs" focus_on_apply = 'ours', }, }, highlights = { diff = { current = 'DiffText', incoming = 'DiffAdd', }, }, --- @class AvanteConflictUserConfig diff = { autojump = true, ---@type string | fun(): any list_opener = 'copen', override_timeoutlen = 500, }, suggestion = { debounce = 600, throttle = 600, }, system_prompt = function() local hub = require('mcphub').get_hub_instance() return hub:get_active_servers_prompt() end, custom_tools = function() return { require('mcphub.extensions.avante').mcp_tool(), } end, disabled_tools = {}, slash_commands = {}, })