openai config

This commit is contained in:
Adrian Bakke 2024-08-26 14:12:25 +02:00
parent 3d12120b3c
commit 0f06649da3

View File

@ -42,22 +42,21 @@ return {
ft = { 'markdown', 'Avante' }, ft = { 'markdown', 'Avante' },
}, },
}, },
config = function() config = {
local provider = 'openai' provider = 'openai',
---@type AvanteSupportedProvider
-- Configuration specific to Claude (replace with OpenAI if necessary) openai = {
local openai = {
endpoint = 'https://api.openai.com/v1', 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, temperature = 0.7,
max_tokens = 4096, max_tokens = 4096,
} },
mappings = {
-- Key mappings
local mappings = {
ask = '<leader>aa', ask = '<leader>aa',
edit = '<leader>ae', edit = '<leader>ae',
refresh = '<leader>ar', refresh = '<leader>ar',
---@class AvanteConflictMappings
diff = { diff = {
ours = 'co', ours = 'co',
theirs = 'ct', theirs = 'ct',
@ -78,43 +77,30 @@ return {
debug = '<leader>ad', debug = '<leader>ad',
hint = '<leader>ah', hint = '<leader>ah',
}, },
} },
hints = { enabled = true },
-- UI and window settings windows = {
local windows = {
wrap = true, -- similar to vim.o.wrap wrap = true, -- similar to vim.o.wrap
width = 30, -- default % based on available width width = 30, -- default % based on available width
sidebar_header = { sidebar_header = {
align = 'center', -- left, center, right for title align = 'center', -- left, center, right for title
rounded = true, rounded = true,
}, },
} },
highlights = {
-- Highlights for diffs ---@type AvanteConflictHighlights
local highlights = {
diff = { diff = {
current = 'DiffText', current = 'DiffText',
incoming = 'DiffAdd', incoming = 'DiffAdd',
}, },
} },
--- @class AvanteConflictUserConfig
-- Diff configuration diff = {
local diff = {
debug = false, debug = false,
autojump = true, autojump = true,
---@type string | fun(): any
list_opener = 'copen', 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,
}, },
} }