From 0f06649da309542cc6f671b05763cd4440e81407 Mon Sep 17 00:00:00 2001 From: Adrian Bakke Date: Mon, 26 Aug 2024 14:12:25 +0200 Subject: [PATCH] openai config --- lua/custom/plugins/init.lua | 56 ++++++++++++++----------------------- 1 file changed, 21 insertions(+), 35 deletions(-) diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua index 200dc172..60925f7d 100644 --- a/lua/custom/plugins/init.lua +++ b/lua/custom/plugins/init.lua @@ -42,22 +42,21 @@ return { ft = { 'markdown', 'Avante' }, }, }, - config = function() - local provider = 'openai' - - -- Configuration specific to Claude (replace with OpenAI if necessary) - local openai = { + config = { + provider = 'openai', + ---@type AvanteSupportedProvider + openai = { endpoint = 'https://api.openai.com/v1', - model = 'gpt-4o', -- Replace with the desired OpenAI model + model = 'gpt-4o-mini', -- Replace with the desired OpenAI model + timeout = 30000, temperature = 0.7, max_tokens = 4096, - } - - -- Key mappings - local mappings = { + }, + mappings = { ask = 'aa', edit = 'ae', refresh = 'ar', + ---@class AvanteConflictMappings diff = { ours = 'co', theirs = 'ct', @@ -78,43 +77,30 @@ return { debug = 'ad', hint = 'ah', }, - } - - -- UI and window settings - local windows = { + }, + hints = { enabled = true }, + windows = { wrap = true, -- similar to vim.o.wrap width = 30, -- default % based on available width sidebar_header = { align = 'center', -- left, center, right for title rounded = true, }, - } - - -- Highlights for diffs - local highlights = { + }, + highlights = { + ---@type AvanteConflictHighlights diff = { current = 'DiffText', incoming = 'DiffAdd', }, - } - - -- Diff configuration - local diff = { + }, + --- @class AvanteConflictUserConfig + diff = { debug = false, autojump = true, + ---@type string | fun(): any list_opener = 'copen', - } - - -- Set up Avante.nvim with the OpenAI provider and custom configurations - require('avante').setup { - provider = provider, - openai = openai, - mappings = mappings, - hints = { enabled = true }, - windows = windows, - highlights = highlights, - diff = diff, - } - end, + }, + }, }, }