add baidu bce platform support

This commit is contained in:
zhangkun9038@dingtalk.com 2025-02-09 01:47:25 +08:00
parent d407caa8c5
commit 3f61df6373
4 changed files with 89 additions and 0 deletions

View File

@ -1,4 +1,9 @@
forked
## 变更:
支持config里加入 bce_appid字段, 用于支持百度云千帆大模型服务, 它需要提供一个appid, 除了已有的api_key以外
---------
<div align="center">
<img alt="logo" width="120" src="https://github.com/user-attachments/assets/2e2f2a58-2b28-4d11-afd1-87b65612b2de" />
<h1>avante.nvim</h1>

View File

@ -424,6 +424,7 @@ M.BASE_PROVIDER_KEYS = {
"proxy",
"allow_insecure",
"api_key_name",
"bce_appid",
"timeout",
-- internal
"local",

View File

@ -282,6 +282,20 @@ M.parse_curl_args = function(provider, prompt_opts)
["Content-Type"] = "application/json",
}
-- Add appid header if configured
if base.bce_appid then headers["appid"] = base.bce_appid end
if P.env.require_api_key(base) then
local api_key = provider.parse_api_key()
if api_key == nil then
error(Config.provider .. " API key is not set, please set it in your environment variable or config file")
end
headers["Authorization"] = "Bearer " .. api_key
end
local headers = {
["Content-Type"] = "application/json",
}
if P.env.require_api_key(base) then
local api_key = provider.parse_api_key()
if api_key == nil then

69
tree.txt Normal file
View File

@ -0,0 +1,69 @@
.
├── autoload
│   └── avante.vim
├── Build.ps1
├── build.sh
├── Cargo.lock
├── Cargo.toml
├── crates
│   ├── avante-html2md
│   │   ├── Cargo.toml
│   │   └── src
│   ├── avante-repo-map
│   │   ├── Cargo.toml
│   │   ├── queries
│   │   └── src
│   ├── avante-templates
│   │   ├── Cargo.toml
│   │   └── src
│   └── avante-tokenizers
│   ├── Cargo.lock
│   ├── Cargo.toml
│   ├── README.md
│   └── src
├── LICENSE
├── lua
│   ├── avante
│   │   ├── api.lua
│   │   ├── clipboard.lua
│   │   ├── config.lua
│   │   ├── diff.lua
│   │   ├── file_selector.lua
│   │   ├── health.lua
│   │   ├── highlights.lua
│   │   ├── html2md.lua
│   │   ├── init.lua
│   │   ├── llm.lua
│   │   ├── llm_tools.lua
│   │   ├── path.lua
│   │   ├── prompt_input.lua
│   │   ├── providers
│   │   ├── range.lua
│   │   ├── repo_map.lua
│   │   ├── selection.lua
│   │   ├── selection_result.lua
│   │   ├── sidebar.lua
│   │   ├── suggestion.lua
│   │   ├── templates
│   │   ├── tokenizers.lua
│   │   ├── types.lua
│   │   └── utils
│   ├── avante_lib.lua
│   └── cmp_avante
│   ├── commands.lua
│   └── mentions.lua
├── Makefile
├── plugin
│   └── avante.lua
├── README.md
├── stylua.toml
├── syntax
│   └── jinja.vim
├── tests
│   ├── llm_tools_spec.lua
│   └── utils
│   ├── file_spec.lua
│   └── init_spec.lua
└── tree.txt
21 directories, 45 files