fix: preset vendors missing many fields (#851)
This commit is contained in:
parent
7bab283616
commit
a3e5053d55
@ -8,7 +8,7 @@ local M = {}
|
|||||||
---@class avante.Config
|
---@class avante.Config
|
||||||
M.defaults = {
|
M.defaults = {
|
||||||
debug = false,
|
debug = false,
|
||||||
---@alias Provider "claude" | "openai" | "azure" | "gemini" | "vertex" | "cohere" | "copilot" | [string]
|
---@alias Provider "claude" | "openai" | "azure" | "gemini" | "vertex" | "cohere" | "copilot" | string
|
||||||
provider = "claude", -- Only recommend using Claude
|
provider = "claude", -- Only recommend using Claude
|
||||||
auto_suggestions_provider = "claude",
|
auto_suggestions_provider = "claude",
|
||||||
---@alias Tokenizer "tiktoken" | "hf"
|
---@alias Tokenizer "tiktoken" | "hf"
|
||||||
@ -88,7 +88,7 @@ M.defaults = {
|
|||||||
vendors = {
|
vendors = {
|
||||||
---@type AvanteSupportedProvider
|
---@type AvanteSupportedProvider
|
||||||
["claude-haiku"] = {
|
["claude-haiku"] = {
|
||||||
endpoint = "https://api.anthropic.com",
|
__inherited_from = "claude",
|
||||||
model = "claude-3-5-haiku-20241022",
|
model = "claude-3-5-haiku-20241022",
|
||||||
timeout = 30000, -- Timeout in milliseconds
|
timeout = 30000, -- Timeout in milliseconds
|
||||||
temperature = 0,
|
temperature = 0,
|
||||||
@ -97,7 +97,7 @@ M.defaults = {
|
|||||||
},
|
},
|
||||||
---@type AvanteSupportedProvider
|
---@type AvanteSupportedProvider
|
||||||
["claude-opus"] = {
|
["claude-opus"] = {
|
||||||
endpoint = "https://api.anthropic.com",
|
__inherited_from = "claude",
|
||||||
model = "claude-3-opus-20240229",
|
model = "claude-3-opus-20240229",
|
||||||
timeout = 30000, -- Timeout in milliseconds
|
timeout = 30000, -- Timeout in milliseconds
|
||||||
temperature = 0,
|
temperature = 0,
|
||||||
@ -340,6 +340,7 @@ M.BASE_PROVIDER_KEYS = {
|
|||||||
"tokenizer_id",
|
"tokenizer_id",
|
||||||
"use_xml_format",
|
"use_xml_format",
|
||||||
"role_map",
|
"role_map",
|
||||||
|
"__inherited_from",
|
||||||
}
|
}
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
@ -50,6 +50,7 @@ local DressingState = { winid = nil, input_winid = nil, input_bufnr = nil }
|
|||||||
---@field _shellenv? string
|
---@field _shellenv? string
|
||||||
---
|
---
|
||||||
---@class AvanteSupportedProvider: AvanteDefaultBaseProvider
|
---@class AvanteSupportedProvider: AvanteDefaultBaseProvider
|
||||||
|
---@field __inherited_from? string
|
||||||
---@field temperature? number
|
---@field temperature? number
|
||||||
---@field max_tokens? number
|
---@field max_tokens? number
|
||||||
---
|
---
|
||||||
@ -267,7 +268,15 @@ M = setmetatable(M, {
|
|||||||
---@diagnostic disable: undefined-field,no-unknown,inject-field
|
---@diagnostic disable: undefined-field,no-unknown,inject-field
|
||||||
if Config.vendors[k] ~= nil then
|
if Config.vendors[k] ~= nil then
|
||||||
Opts.parse_response = Opts.parse_response_data
|
Opts.parse_response = Opts.parse_response_data
|
||||||
|
if Opts.__inherited_from ~= nil then
|
||||||
|
local BaseOpts = M.get_config(Opts.__inherited_from)
|
||||||
|
local ok, module = pcall(require, "avante.providers." .. Opts.__inherited_from)
|
||||||
|
if not ok then error("Failed to load provider: " .. Opts.__inherited_from) end
|
||||||
|
Opts._shellenv = module.api_key_name ~= M.AVANTE_INTERNAL_KEY and module.api_key_name or nil
|
||||||
|
t[k] = vim.tbl_deep_extend("keep", BaseOpts, Opts, module)
|
||||||
|
else
|
||||||
t[k] = Opts
|
t[k] = Opts
|
||||||
|
end
|
||||||
else
|
else
|
||||||
local ok, module = pcall(require, "avante.providers." .. k)
|
local ok, module = pcall(require, "avante.providers." .. k)
|
||||||
if not ok then error("Failed to load provider: " .. k) end
|
if not ok then error("Failed to load provider: " .. k) end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user