try add baidu

This commit is contained in:
zhangkun9038@dingtalk.com 2025-02-10 11:58:06 +08:00
parent 676e1194b1
commit 56cf5b5bee
2 changed files with 6 additions and 3 deletions

View File

@ -1,3 +1,4 @@
-- FILEPATH: avante.nvim/lua/avante/providers/baidu.lua
local Utils = require("avante.utils")
local Config = require("avante.config")
local P = require("avante.providers")
@ -44,12 +45,12 @@ local Log = require("avante.utils.log")
M.parse_curl_args = function(provider, prompt_opts)
local base, body_opts = P.parse_config(provider)
-- Validate required appid
-- 验证 appid 是否存在
if not base.appid or base.appid == "" then error("Baidu provider requires appid to be set in config") end
local headers = {
["Content-Type"] = "application/json",
["appid"] = base.appid,
["appid"] = base.appid, -- 将 appid 加入请求头
}
if P.env.require_api_key(base) then
@ -73,7 +74,7 @@ M.parse_curl_args = function(provider, prompt_opts)
}, body_opts),
}
-- Log the request details
-- 记录请求详细信息
Log.log_request(request.url, request.headers, request.body)
return request

View File

@ -136,6 +136,8 @@ local DressingState = { winid = nil, input_winid = nil, input_bufnr = nil }
---@field gemini AvanteProviderFunctor
---@field cohere AvanteProviderFunctor
---@field bedrock AvanteBedrockProviderFunctor
---@field baidu AvanteProviderFunctor -- 新增百度 provider
local M = {}
---@class EnvironmentHandler