che-astronvim-config/lua/plugins/avante-nvim.lua
root 0f73cbcb92 enhance: improve DeepSeek provider configuration in avante.nvim
Add timeout setting and restructure max_tokens into extra_request_body
for better API request handling and proper configuration structure.
2026-01-27 16:16:18 +00:00

57 lines
2.1 KiB
Lua

-- Configuration module for avante.nvim plugin with DeepSeek API support
-- Returns configuration only if THIRD_PARTY_AI_ASSISTANT environment variable is set
-- Check for the required environment variable containing the API key
-- If the key is not set, returns an empty table and the plugin won't load
local ai_enabled = os.getenv "THIRD_PARTY_AI_ASSISTANT"
if not ai_enabled or ai_enabled:lower() ~= "true" then return {} end
-- Main plugin configuration object
---@type LazyPluginSpec[]
return {
{
-- Plugin identifier in GitHub repository
"yetone/avante.nvim",
-- Plugin version for compatibility assurance
version = "0.0.27",
-- Plugin configuration options
-- Remove the type annotation if avante.Config is undefined
opts = {
-- Primary AI provider for code generation
provider = "deepseek",
-- Provider for automatic code suggestions (autocompletion)
auto_suggestions_provider = "deepseek",
-- Plugin operation mode (commented out, uses default value)
-- mode = "legacy",
-- Plugin behavior settings (commented out)
-- behaviour = {
-- auto_apply_diff_after_generation = false,
-- auto_focus_on_diff_view = true,
-- },
-- AI providers configuration
providers = {
-- Specific configuration for DeepSeek provider
deepseek = {
-- Inheritance of base configuration from OpenAI provider
__inherited_from = "openai",
-- Environment variable name containing the API key
api_key_name = "DEEPSEEK_API_KEY",
-- API endpoint for DeepSeek requests
endpoint = "https://api.deepseek.com",
-- AI model to use (specialized for programming)
model = "deepseek-coder",
timeout = 30000, -- Timeout in milliseconds
extra_request_body = {
temperature = 0.2,
max_tokens = 8192,
},
-- Maximum number of tokens in model response
-- max_tokens = 8192,
-- Tools disable flag (commented out)
-- disable_tools = true,
},
},
},
},
}