From 13642a683f5c76a15bc03ca0aa4cbe7d73a95048 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20B=C3=B6hme?= Date: Sat, 26 Oct 2024 17:06:15 +0200 Subject: [PATCH] feat(nvim): add cheap openai provider for avante --- modules/programs/nvim/new_plugins/avante.nix | 22 ++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/modules/programs/nvim/new_plugins/avante.nix b/modules/programs/nvim/new_plugins/avante.nix index 1b807d2..3ad02e6 100644 --- a/modules/programs/nvim/new_plugins/avante.nix +++ b/modules/programs/nvim/new_plugins/avante.nix @@ -19,14 +19,28 @@ in require("avante_lib").load() require("avante").setup({ provider = "openai", - auto_suggestions_provider = "openai", + auto_suggestions_provider = "openai-cheap", behaviour = { - -- auto_suggestions = true, + auto_suggestions = false, }, openai = { model = "gpt-4o", - api_key_name = "cmd:cat /run/agenix/openai" - } + 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 + }, + }, }) ''; plugins.dressing.enable = true;