refactor: improve avante.nvim configuration with better environment variable handling and documentation
- 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
This commit is contained in:
parent
508ebdb0c0
commit
7f725c6530
@ -1,25 +1,48 @@
|
|||||||
if not os.getenv "DEEPSEEK_API_KEY" then return {} end
|
-- 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 {
|
return {
|
||||||
{ -- further customize the options set by the community
|
{
|
||||||
|
-- Plugin identifier in GitHub repository
|
||||||
"yetone/avante.nvim",
|
"yetone/avante.nvim",
|
||||||
|
-- Plugin version for compatibility assurance
|
||||||
version = "0.0.27",
|
version = "0.0.27",
|
||||||
---@type avante.Config
|
-- Plugin configuration options
|
||||||
|
-- Remove the type annotation if avante.Config is undefined
|
||||||
opts = {
|
opts = {
|
||||||
|
-- Primary AI provider for code generation
|
||||||
provider = "deepseek",
|
provider = "deepseek",
|
||||||
|
-- Provider for automatic code suggestions (autocompletion)
|
||||||
auto_suggestions_provider = "deepseek",
|
auto_suggestions_provider = "deepseek",
|
||||||
|
-- Plugin operation mode (commented out, uses default value)
|
||||||
-- mode = "legacy",
|
-- mode = "legacy",
|
||||||
|
-- Plugin behavior settings (commented out)
|
||||||
-- behaviour = {
|
-- behaviour = {
|
||||||
-- auto_apply_diff_after_generation = false,
|
-- auto_apply_diff_after_generation = false,
|
||||||
-- auto_focus_on_diff_view = true,
|
-- auto_focus_on_diff_view = true,
|
||||||
-- },
|
-- },
|
||||||
|
-- AI providers configuration
|
||||||
providers = {
|
providers = {
|
||||||
|
-- Specific configuration for DeepSeek provider
|
||||||
deepseek = {
|
deepseek = {
|
||||||
|
-- Inheritance of base configuration from OpenAI provider
|
||||||
__inherited_from = "openai",
|
__inherited_from = "openai",
|
||||||
|
-- Environment variable name containing the API key
|
||||||
api_key_name = "DEEPSEEK_API_KEY",
|
api_key_name = "DEEPSEEK_API_KEY",
|
||||||
|
-- API endpoint for DeepSeek requests
|
||||||
endpoint = "https://api.deepseek.com",
|
endpoint = "https://api.deepseek.com",
|
||||||
|
-- AI model to use (specialized for programming)
|
||||||
model = "deepseek-coder",
|
model = "deepseek-coder",
|
||||||
|
-- Maximum number of tokens in model response
|
||||||
max_tokens = 8192,
|
max_tokens = 8192,
|
||||||
|
-- Tools disable flag (commented out)
|
||||||
-- disable_tools = true,
|
-- disable_tools = true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user