nixvim: add codecompanion
All checks were successful
Check flake / build-amd64-linux (push) Successful in 1m19s

This commit is contained in:
2025-09-08 23:24:23 +01:00
parent 2659ebe5f7
commit 10f78d3698

View File

@@ -1,4 +1,5 @@
{
osConfig,
...
}:
@@ -82,6 +83,57 @@
};
};
plugins.codecompanion = {
enable = true;
settings = {
adapters = {
http.opts.show_defaults = false;
openwebui.__raw = ''
function()
return require("codecompanion.adapters").extend("openai_compatible", {
name = "openwebui",
formatted_name = "Open WebUI",
opts = {
stream = true,
tools = true,
vision = false,
},
url = "''${url}''${chat_endpoint}",
env = {
api_key = "cmd:cat ${osConfig.age.secrets.open-webui-api-key.path}",
url = "https://chat.ai.vimium.com",
chat_endpoint = "/api/chat/completions",
models_endpoint = "/api/models",
},
headers = {
["Content-Type"] = "application/json",
Authorization = "Bearer ''${api_key}",
},
schema = {
model = {
default = "openai/gpt-5-chat",
},
},
})
end
'';
};
strategies = {
chat = {
adapter = "openwebui";
};
inline = {
adapter = "openwebui";
};
cmd = {
adapter = "openwebui";
};
};
};
};
plugins.telescope = {
enable = true;
keymaps = {
@@ -126,6 +178,8 @@
# plugins.none-ls.enable = true;
# plugins.nvim-tree.enable = true;
# plugins.oil.enable = true;
# plugins.persisted.enable = true;
# plugins.precognition.enable = true;
# plugins.project-nvim.enable = true;
};