Replace Avante with Bifrost-backed AI tools

This commit is contained in:
2026-08-14 19:17:13 -04:00
parent a68370f98b
commit 9c3c6834e0
6 changed files with 141 additions and 74 deletions

1
.gitignore vendored
View File

@@ -1 +1,2 @@
nvim-pack-lock.json
.worktrees/

View File

@@ -16,7 +16,8 @@ require("coc") -- ./lua/coc.lua
require("treesitter") -- ./lua/treesitter.lua
require("autocmds") -- ./lua/autocmds.lua
require("diagnostics") -- ./lua/diagnostics.lua
require("avante_settings") -- ./lua/avante_settings.lua
require("codecompanion_settings") -- ./lua/codecompanion_settings.lua
require("corridor_settings") -- ./lua/corridor_settings.lua
require('telescope_configuration') -- ./lua/telescope_configuration.lua
require("mail") -- ./lua/mail.lua (no-op unless NEOMUTT=1)
@@ -264,4 +265,3 @@ vim.api.nvim_create_autocmd("VimEnter", {
end
end,
})

View File

@@ -1,69 +0,0 @@
require('avante').setup({
instructions_file = "avante.md",
provider = "ollama",
providers = {
ollama = {
endpoint = "http://localhost:11434",
model = "codellama:latest",
},
},
behavior = {
auto_focus_sidebar = true,
auto_suggestions = true, -- Experimental.
jump_result_buffer_on_finish = false,
},
windows = {
position = "right",
fillchars = "eob: ",
wrap = true,
width = 30,
height = 30,
sidebar_header = {
enabled = true,
align = "center",
rounded = true,
},
spinner = {
editing = {
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
},
generating = { "·", "", "", "", "", "" },
thinking = { "🤯", "🙄" },
},
},
})

View File

@@ -0,0 +1,89 @@
local adapters = require("codecompanion.adapters")
require("codecompanion").setup({
adapters = {
http = {
bifrost = function()
return adapters.extend("openai_compatible", {
name = "bifrost",
formatted_name = "Bifrost",
env = {
url = vim.env.BIFROST_BASE_URL or "https://bifrost.th3r00t.net",
api_key = vim.env.BIFROST_API_KEY
and "BIFROST_API_KEY"
or "file:~/.config/bifrost/api-key",
chat_url = "/v1/chat/completions",
models_endpoint = "/v1/models",
},
schema = {
model = {
default = vim.env.CODECOMPANION_MODEL
or "OllamaMSI/qwen3:30b-a3b",
},
},
})
end,
},
},
interactions = {
chat = {
adapter = "bifrost",
},
inline = {
adapter = "bifrost",
},
background = {
adapter = "bifrost",
},
},
display = {
action_palette = {
provider = "snacks",
},
chat = {
window = {
layout = "vertical",
position = "right",
width = 0.42,
border = "rounded",
},
start_in_insert_mode = false,
show_token_count = true,
},
diff = {
enabled = true,
},
},
opts = {
log_level = "ERROR",
language = "English",
send_code = true,
},
})
local map = vim.keymap.set
map({ "n", "v" }, "<leader>aa", "<cmd>CodeCompanionActions<cr>", {
desc = "AI actions",
})
map("n", "<leader>ac", "<cmd>CodeCompanionChat Toggle<cr>", {
desc = "Toggle AI chat",
})
map("n", "<leader>an", "<cmd>CodeCompanionChat<cr>", {
desc = "New AI chat",
})
map({ "n", "v" }, "<leader>ai", "<cmd>CodeCompanion<cr>", {
desc = "AI inline prompt",
})
map({ "n", "v" }, "<leader>ab", "<cmd>CodeCompanionChat Add<cr>", {
desc = "Add buffer/selection to AI chat",
})
local which_key = require("which-key")
which_key.add({
{ "<leader>a", group = "AI" },
{ "<leader>aa", desc = "Actions" },
{ "<leader>ab", desc = "Add buffer/selection" },
{ "<leader>ac", desc = "Toggle chat" },
{ "<leader>ai", desc = "Inline prompt" },
{ "<leader>an", desc = "New chat" },
})

47
lua/corridor_settings.lua Normal file
View File

@@ -0,0 +1,47 @@
local bifrost_endpoint = vim.env.BIFROST_COMPLETIONS_URL
or "https://bifrost.th3r00t.net/v1/completions"
local key_path = vim.fn.expand("~/.config/bifrost/api-key")
local key_file = io.open(key_path, "r")
local bifrost_api_key = key_file and vim.trim(key_file:read("*a")) or nil
if key_file then
key_file:close()
end
require("corridor").setup({
enabled = true,
provider = "lmstudio", -- OpenAI-compatible completions (Bifrost)
endpoint = bifrost_endpoint,
model = vim.env.CORRIDOR_MODEL or "OllamaMSI/qwen2.5-coder:7b",
api_key = vim.env.BIFROST_API_KEY or bifrost_api_key,
debounce_ms = 400,
max_tokens = 64,
temperature = 0.1,
-- CoC owns <Tab>; keep Corridor's mappings out of its way.
accept_keymap = "<C-l>",
dismiss_keymap = "<C-h>",
max_context_lines = 256,
cross_file_context = true,
max_cross_file_lines = 100,
max_cross_file_count = 5,
exclude_filetypes = {
"Avante",
"TelescopePrompt",
"help",
"lazy",
"mason",
"neo-tree",
"snacks_picker_input",
"terminal",
},
-- qwen2.5-coder FIM token order.
fim = {
prefix = "<|fim_prefix|>",
suffix = "<|fim_suffix|>",
middle = "<|fim_middle|>",
},
})

View File

@@ -61,7 +61,8 @@ vim.pack.add({
{ src = "https://github.com/francoiscabrol/ranger.vim" },
{ src = "https://github.com/folke/snacks.nvim" },
{ src = "https://github.com/coder/claudecode.nvim" },
{ src = "https://github.com/yetone/avante.nvim" },
{ src = "https://github.com/olimorris/codecompanion.nvim" },
{ src = "https://github.com/orellazri/corridor.nvim" },
{ src = "https://github.com/alaviss/nim.nvim" },
{ src = "https://github.com/glebzlat/arduino-nvim" },
{ src = "https://github.com/norcalli/nvim-colorizer.lua" },
@@ -422,5 +423,3 @@ require("remote-nvim").setup({
max_size = 1024 * 1024 * 2, -- 2MB
},
})