nixos-combined-flake/modules/nixvim/plugins/avante.nix

40 lines
1.2 KiB
Nix

{ lib, ... }: {
plugins.avante = {
enable = true;
settings = {
provider = "ollama";
vendors = {
ollama = {
endpoint = "http://10.0.20.10:11434/v1";
model = "gemma2:2b";
temperature = 0;
max_tokens = 4096;
api_key_name = "";
parse_curl_args = lib.nixvim.mkRaw ''
function(opts, code_opts)
return {
url = opts.endpoint .. "/chat/completions",
headers = {
["Accept"] = "application/json",
["Content-Type"] = "application/json",
},
body = {
model = opts.model,
messages = require("avante.providers").copilot.parse_message(code_opts), -- you can make your own message, but this is very advanced
max_tokens = 2048,
stream = true,
},
}
end
'';
parse_response_data = lib.nixvim.mkRaw ''
function(data_stream, event_state, opts)
require("avante.providers").openai.parse_response(data_stream, event_state, opts)
end
'';
};
};
};
};
}