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

191 lines
4.5 KiB
Lua
Raw Normal View History

2025-01-25 08:10:58 -06:00
local OLLAMA_TOKEN = os.getenv("OLLAMA_TOKEN")
2025-04-05 07:00:35 -05:00
local OPENAI_TOKEN = os.getenv("OPENAI_TOKEN")
2025-05-02 06:09:07 -05:00
local GEMINI_TOKEN = os.getenv("GEMINI_TOKEN")
2025-09-27 07:13:57 -05:00
local ANTHROPIC_TOKEN = os.getenv("ANTHROPIC_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 = {
2026-03-06 05:30:26 -06:00
interactions = {
chat = {
adapter = {
name = "ollama",
model = "llama3.1:8b",
},
},
inline = {
adapter = {
name = "ollama",
model = "llama3.1:8b",
},
},
cmd = {
adapter = {
name = "ollama",
model = "llama3.1:8b",
},
},
2025-01-25 08:10:58 -06:00
},
adapters = {
2026-03-06 05:30:26 -06:00
http = {
ollama = function()
return require("codecompanion.adapters").extend(
"ollama",
{
env = {
url = "https://ollama.durp.info",
2025-09-27 07:13:57 -05:00
},
2026-03-06 05:30:26 -06:00
headers = {
["Content-Type"] = "application/json",
["Authorization"] = OLLAMA_TOKEN,
},
parameters = {
sync = true,
},
}
)
end,
anthropic = function()
return require("codecompanion.adapters").extend(
"anthropic",
{
--schema = {
-- model = {
-- default = "claude-3-5-haiku",
-- },
--},
env = {
api_key = "ANTHROPIC_TOKEN",
},
}
)
end,
gemini = function()
return require("codecompanion.adapters").extend(
"gemini",
{
--schema = {
-- model = {
-- default = "claude-3-5-haiku",
-- },
--},
env = {
api_key = "GEMINI_TOKEN",
},
}
)
end,
openai = function()
return require("codecompanion.adapters").extend(
"openai",
{
--schema = {
-- model = {
-- default = "claude-3-5-haiku",
-- },
--},
env = {
api_key = "OPENAI_TOKEN",
},
}
)
end,
},
2025-01-25 08:10:58 -06:00
},
},
},
}
2026-03-06 05:30:26 -06:00
--adapters = {
-- http = {
-- ollama = function()
-- return require("codecompanion.adapters").extend("ollama", {
-- env = {
-- url = "https://ollama.durp.info",
-- api_key = "OLLAMA_TOKEN",
-- },
-- headers = {
-- ["Content-Type"] = "application/json",
-- ["Authorization"] = "Bearer ${api_key}",
-- },
-- parameters = {
-- sync = true,
-- },
-- })
-- end,
-- },
-- },
--opts = {
-- show_defaults = false,
--},
--strategies = {
-- chat = { adapter = "ollama", model = "mistral:latest" },
--},
--gemini = function()
-- return require("codecompanion.adapters").extend("gemini", {
-- name = "gemini",
-- schema = {
-- model = {
-- default = "gemini-2.0-flash",
-- },
-- },
-- env = {
-- api_key = GEMINI_TOKEN,
-- },
-- })
--end,
--anthropic = function()
-- return require("codecompanion.adapters").extend(
-- "anthropic",
-- {
-- name = "anthropic",
-- schema = {
-- model = {
-- default = "claude-3-haiku-20240307",
-- },
-- },
-- env = {
-- api_key = ANTHROPIC_TOKEN,
-- },
-- }
-- )
--end,
--openai = function()
-- return require("codecompanion.adapters").extend("openai", {
-- name = "openai",
-- schema = {
-- model = {
-- default = "gpt-4o-mini",
-- },
-- },
-- env = {
-- api_key = OPENAI_TOKEN,
-- },
-- })
--end,
--ollama = function()
-- return require("codecompanion.adapters").extend("ollama", {
-- name = "ollama",
-- schema = {
-- model = {
-- default = "llama3.1:8b",
-- },
-- },
-- env = {
-- url = "https://ollama.durp.info",
-- },
-- headers = {
-- ["Content-Type"] = "application/json",
-- ["Authorization"] = OLLAMA_TOKEN,
-- },
-- parameters = {
-- sync = true,
-- },
-- })
--end,