dotfiles/.config/nvim/lua/plugins/codecomapnion.lua

58 lines
1.4 KiB
Lua
Raw Normal View History

2025-01-25 08:10:58 -06:00
local OLLAMA_TOKEN = os.getenv("OLLAMA_TOKEN")
2025-04-01 05:57:21 -05:00
local LITELLM_TOKEN = os.getenv("LITELLM_TOKEN")
2025-01-25 08:10:58 -06:00
return {
{
"olimorris/codecompanion.nvim",
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-treesitter/nvim-treesitter",
},
config = true,
opts = {
strategies = {
2025-04-02 05:53:11 -05:00
chat = { adapter = "ollama" },
inline = { adapter = "ollama" },
2025-01-25 08:10:58 -06:00
},
adapters = {
2025-03-28 14:47:40 -05:00
opts = {
show_defaults = false,
},
openai = function()
return require("codecompanion.adapters").extend("openai", {
2025-04-02 05:53:11 -05:00
name = "openai",
2025-03-28 14:47:40 -05:00
schema = {
model = {
default = "gpt-4o-mini",
},
},
url = "https://litellm.durp.info",
env = {
2025-04-01 05:57:21 -05:00
api_key = LITELLM_TOKEN,
2025-03-28 14:47:40 -05:00
},
})
end,
2025-01-25 08:10:58 -06:00
ollama = function()
return require("codecompanion.adapters").extend("ollama", {
2025-04-02 05:53:11 -05:00
name = "ollama",
2025-01-25 08:10:58 -06:00
schema = {
model = {
2025-04-01 05:57:21 -05:00
default = "mistral:latest",
2025-01-25 08:10:58 -06:00
},
},
env = {
2025-04-01 05:57:21 -05:00
url = "https://ollama.durp.info",
2025-01-25 08:10:58 -06:00
},
headers = {
["Content-Type"] = "application/json",
["Authorization"] = OLLAMA_TOKEN,
},
parameters = {
sync = true,
},
})
end,
},
},
},
}