updated configuration
This commit is contained in:
@@ -1,10 +1,14 @@
|
||||
-- AI Chat Integration using avante.nvim
|
||||
-- Supports: Anthropic Claude, OpenAI, Google Gemini, Copilot, and more
|
||||
-- API keys via environment variables:
|
||||
-- ANTHROPIC_API_KEY, OPENAI_API_KEY, GEMINI_API_KEY
|
||||
-- Or scoped: AVANTE_ANTHROPIC_API_KEY, AVANTE_OPENAI_API_KEY, etc.
|
||||
|
||||
return {
|
||||
-- Avante: Cursor-like AI assistant
|
||||
{
|
||||
"yetone/avante.nvim",
|
||||
event = "VeryLazy",
|
||||
lazy = false,
|
||||
version = false,
|
||||
version = false, -- Never set to "*"
|
||||
build = "make",
|
||||
dependencies = {
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
@@ -12,49 +16,180 @@ return {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"MunifTanjim/nui.nvim",
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
"zbirenbaum/copilot.lua", -- Optional for copilot suggestions
|
||||
{
|
||||
-- Image support (optional)
|
||||
"HakonHarnes/img-clip.nvim",
|
||||
event = "VeryLazy",
|
||||
opts = {
|
||||
default = {
|
||||
embed_image_as_base64 = false,
|
||||
prompt_for_file_name = false,
|
||||
drag_and_drop = { insert_mode = true },
|
||||
drag_and_drop = {
|
||||
insert_mode = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
-- Markdown rendering in Avante
|
||||
"MeanderingProgrammer/render-markdown.nvim",
|
||||
opts = { file_types = { "markdown", "Avante" } },
|
||||
opts = {
|
||||
file_types = { "markdown", "Avante" },
|
||||
},
|
||||
ft = { "markdown", "Avante" },
|
||||
},
|
||||
},
|
||||
---@module 'avante'
|
||||
---@type avante.Config
|
||||
opts = {
|
||||
debug = true,
|
||||
-- Default provider (switch with :AvanteProvider command)
|
||||
-- Options: "claude", "openai", "azure", "gemini", "copilot", "cohere"
|
||||
provider = "claude",
|
||||
mode = "agentic",
|
||||
auto_suggestions_provider = "copilot",
|
||||
|
||||
-- Provider configurations
|
||||
providers = {
|
||||
claude = {
|
||||
model = "claude-sonnet-4-5",
|
||||
endpoint = "https://api.anthropic.com",
|
||||
model = "claude-sonnet-4-5-20250929",
|
||||
timeout = 30000,
|
||||
extra_request_body = {
|
||||
temperature = 0.75,
|
||||
max_tokens = 20480,
|
||||
},
|
||||
},
|
||||
openai = {
|
||||
endpoint = "https://api.openai.com/v1",
|
||||
model = "gpt-4o",
|
||||
timeout = 30000,
|
||||
extra_request_body = {
|
||||
temperature = 0.75,
|
||||
max_completion_tokens = 16384,
|
||||
},
|
||||
},
|
||||
azure = {
|
||||
endpoint = "", -- e.g., "https://<resource>.openai.azure.com"
|
||||
deployment = "", -- Azure deployment name
|
||||
api_version = "2024-12-01-preview",
|
||||
timeout = 30000,
|
||||
extra_request_body = {
|
||||
temperature = 0.75,
|
||||
max_completion_tokens = 16384,
|
||||
},
|
||||
},
|
||||
gemini = {
|
||||
endpoint = "https://generativelanguage.googleapis.com/v1beta/models",
|
||||
model = "gemini-2.0-flash",
|
||||
timeout = 30000,
|
||||
extra_request_body = {
|
||||
generationConfig = {
|
||||
temperature = 0.75,
|
||||
},
|
||||
},
|
||||
},
|
||||
copilot = {
|
||||
endpoint = "https://api.githubcopilot.com",
|
||||
model = "gpt-4o-2024-08-06",
|
||||
timeout = 30000,
|
||||
extra_request_body = {
|
||||
temperature = 0.75,
|
||||
max_tokens = 20480,
|
||||
},
|
||||
},
|
||||
-- Custom provider example for Ollama (local models)
|
||||
-- Uncomment and configure if using local LLMs
|
||||
-- ollama = {
|
||||
-- __inherited_from = "openai",
|
||||
-- endpoint = "http://localhost:11434/v1",
|
||||
-- model = "llama3.2",
|
||||
-- api_key_name = "",
|
||||
-- },
|
||||
},
|
||||
|
||||
-- Behavior settings
|
||||
behaviour = {
|
||||
auto_seggestions = true,
|
||||
auto_suggestions = false, -- Set true for copilot-like suggestions
|
||||
auto_set_highlight_group = true,
|
||||
auto_set_keymaps = true,
|
||||
auto_apply_diff_after_generation = false,
|
||||
support_paste_from_clipboard = false,
|
||||
minimize_diff = true,
|
||||
enable_token_counting = true,
|
||||
},
|
||||
|
||||
-- Mappings
|
||||
mappings = {
|
||||
ask = "<leader>aa",
|
||||
edit = "<leader>ae",
|
||||
refresh = "<leader>ar",
|
||||
toggle = {
|
||||
default = "<leader>at",
|
||||
debug = "<leader>ad",
|
||||
hint = "<leader>ah",
|
||||
diff = {
|
||||
ours = "co",
|
||||
theirs = "ct",
|
||||
all_theirs = "ca",
|
||||
both = "cb",
|
||||
cursor = "cc",
|
||||
next = "]x",
|
||||
prev = "[x",
|
||||
},
|
||||
suggestion = {
|
||||
accept = "<M-l>",
|
||||
next = "<M-]>",
|
||||
prev = "<M-[>",
|
||||
dismiss = "<C-]>",
|
||||
},
|
||||
jump = {
|
||||
next = "]]",
|
||||
prev = "[[",
|
||||
},
|
||||
submit = {
|
||||
normal = "<CR>",
|
||||
insert = "<C-s>",
|
||||
},
|
||||
sidebar = {
|
||||
apply_all = "A",
|
||||
apply_cursor = "a",
|
||||
switch_windows = "<Tab>",
|
||||
reverse_switch_windows = "<S-Tab>",
|
||||
},
|
||||
},
|
||||
|
||||
-- Hints shown in the UI
|
||||
hints = { enabled = true },
|
||||
|
||||
-- Window configuration
|
||||
windows = {
|
||||
position = "right",
|
||||
wrap = true,
|
||||
width = 30,
|
||||
sidebar_header = {
|
||||
enabled = true,
|
||||
align = "center",
|
||||
rounded = true,
|
||||
},
|
||||
input = {
|
||||
prefix = "> ",
|
||||
height = 8,
|
||||
},
|
||||
edit = {
|
||||
border = "rounded",
|
||||
start_insert = true,
|
||||
},
|
||||
ask = {
|
||||
floating = false,
|
||||
start_insert = true,
|
||||
border = "rounded",
|
||||
},
|
||||
},
|
||||
|
||||
-- Highlight groups
|
||||
highlights = {
|
||||
diff = {
|
||||
current = "DiffText",
|
||||
incoming = "DiffAdd",
|
||||
},
|
||||
},
|
||||
|
||||
-- Diff settings
|
||||
diff = {
|
||||
autojump = true,
|
||||
list_opener = "copen",
|
||||
override_timeoutlen = 500,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user