- Replace DEEPSEEK_API_KEY check with THIRD_PARTY_AI_ASSISTANT for more flexible AI integration - Add comprehensive code comments and documentation for better maintainability - Improve configuration structure and readability
52 lines
1.9 KiB
Lua
52 lines
1.9 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",
|
|
-- Maximum number of tokens in model response
|
|
max_tokens = 8192,
|
|
-- Tools disable flag (commented out)
|
|
-- disable_tools = true,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
}
|