2024-10-24 20:32:29 +02:00
|
|
|
{ config, lib, pkgs, ... }:
|
2024-09-15 15:31:39 +02:00
|
|
|
|
|
|
|
let
|
2024-10-24 20:32:29 +02:00
|
|
|
inherit (lib) mkIf;
|
|
|
|
|
|
|
|
cfg = config.my.ai;
|
2024-09-15 15:31:39 +02:00
|
|
|
in
|
|
|
|
{
|
2024-10-24 20:32:29 +02:00
|
|
|
config = mkIf cfg.enable {
|
|
|
|
home-manager.users.moritz.programs.nixvim = {
|
|
|
|
extraPlugins = with pkgs.vimPlugins; [
|
|
|
|
nui-nvim
|
|
|
|
render-markdown-nvim
|
|
|
|
avante-nvim
|
|
|
|
];
|
|
|
|
extraConfigLuaPost = ''
|
|
|
|
require("render-markdown").setup({ file_types = {"markdown", "Avante"} })
|
2024-10-08 09:42:32 +02:00
|
|
|
|
2024-10-24 20:32:29 +02:00
|
|
|
require("avante_lib").load()
|
|
|
|
require("avante").setup({
|
|
|
|
provider = "openai",
|
2024-10-26 17:06:15 +02:00
|
|
|
auto_suggestions_provider = "openai-cheap",
|
2024-10-24 20:32:29 +02:00
|
|
|
behaviour = {
|
2024-10-26 17:06:15 +02:00
|
|
|
auto_suggestions = false,
|
2024-10-24 20:32:29 +02:00
|
|
|
},
|
|
|
|
openai = {
|
|
|
|
model = "gpt-4o",
|
2024-10-26 17:06:15 +02:00
|
|
|
api_key_name = "cmd:cat /run/agenix/openai",
|
|
|
|
},
|
|
|
|
vendors = {
|
|
|
|
---@type AvanteProvider
|
|
|
|
["openai-cheap"] = {
|
|
|
|
model = "gpt-4o-mini",
|
|
|
|
api_key_name = "cmd:cat /run/agenix/openai",
|
|
|
|
endpoint = "https://api.openai.com/v1",
|
|
|
|
parse_curl_args = function(opts, code_opts)
|
|
|
|
return require("avante.providers").openai.parse_curl_args(opts, code_opts)
|
|
|
|
end,
|
|
|
|
parse_response_data = function(data_stream, event_state, opts)
|
|
|
|
return require("avante.providers").openai.parse_response(data_stream, event_state, opts)
|
|
|
|
end
|
|
|
|
},
|
|
|
|
},
|
2024-10-24 20:32:29 +02:00
|
|
|
})
|
|
|
|
'';
|
|
|
|
plugins.dressing.enable = true;
|
|
|
|
};
|
|
|
|
age.secrets = {
|
|
|
|
"openai".file = ../../../../secrets/openai.age;
|
|
|
|
"openai".owner = "moritz";
|
|
|
|
anthropic.file = ../../../../secrets/anthropic.age;
|
|
|
|
anthropic.owner = "moritz";
|
|
|
|
};
|
2024-09-15 15:31:39 +02:00
|
|
|
};
|
|
|
|
}
|