Add extra headers for OpenAI (#1615)
This commit is contained in:
committed by
GitHub
parent
f761e83033
commit
3b86549485
@@ -557,6 +557,7 @@ end
|
|||||||
|
|
||||||
M.BASE_PROVIDER_KEYS = {
|
M.BASE_PROVIDER_KEYS = {
|
||||||
"endpoint",
|
"endpoint",
|
||||||
|
"extra_headers",
|
||||||
"model",
|
"model",
|
||||||
"deployment",
|
"deployment",
|
||||||
"api_version",
|
"api_version",
|
||||||
|
|||||||
@@ -278,6 +278,12 @@ function M:parse_curl_args(prompt_opts)
|
|||||||
["Content-Type"] = "application/json",
|
["Content-Type"] = "application/json",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if provider_conf.extra_headers then
|
||||||
|
for key, value in pairs(provider_conf.extra_headers) do
|
||||||
|
headers[key] = value
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if P.env.require_api_key(provider_conf) then
|
if P.env.require_api_key(provider_conf) then
|
||||||
local api_key = self.parse_api_key()
|
local api_key = self.parse_api_key()
|
||||||
if api_key == nil then
|
if api_key == nil then
|
||||||
|
|||||||
@@ -200,6 +200,7 @@ vim.g.avante_login = vim.g.avante_login
|
|||||||
---
|
---
|
||||||
---@class AvanteDefaultBaseProvider: table<string, any>
|
---@class AvanteDefaultBaseProvider: table<string, any>
|
||||||
---@field endpoint? string
|
---@field endpoint? string
|
||||||
|
---@field extra_headers? table<string, any>
|
||||||
---@field model? string
|
---@field model? string
|
||||||
---@field local? boolean
|
---@field local? boolean
|
||||||
---@field proxy? string
|
---@field proxy? string
|
||||||
|
|||||||
Reference in New Issue
Block a user