feat: add Bailian provider configuration and integration
This commit is contained in:
parent
91ac5bbcd8
commit
3a30c152c9
3 changed files with 16 additions and 4 deletions
|
|
@ -93,6 +93,10 @@
|
||||||
"api_key": "YOUR_ZHIPU_API_KEY",
|
"api_key": "YOUR_ZHIPU_API_KEY",
|
||||||
"api_base": ""
|
"api_base": ""
|
||||||
},
|
},
|
||||||
|
"bailian": {
|
||||||
|
"api_key": "YOUR_BAILIAN_API_KEY",
|
||||||
|
"api_base": ""
|
||||||
|
},
|
||||||
"gemini": {
|
"gemini": {
|
||||||
"api_key": "",
|
"api_key": "",
|
||||||
"api_base": ""
|
"api_base": ""
|
||||||
|
|
|
||||||
|
|
@ -172,6 +172,7 @@ type ProvidersConfig struct {
|
||||||
OpenRouter ProviderConfig `json:"openrouter"`
|
OpenRouter ProviderConfig `json:"openrouter"`
|
||||||
Groq ProviderConfig `json:"groq"`
|
Groq ProviderConfig `json:"groq"`
|
||||||
Zhipu ProviderConfig `json:"zhipu"`
|
Zhipu ProviderConfig `json:"zhipu"`
|
||||||
|
Bailian ProviderConfig `json:"bailian"`
|
||||||
VLLM ProviderConfig `json:"vllm"`
|
VLLM ProviderConfig `json:"vllm"`
|
||||||
Gemini ProviderConfig `json:"gemini"`
|
Gemini ProviderConfig `json:"gemini"`
|
||||||
Nvidia ProviderConfig `json:"nvidia"`
|
Nvidia ProviderConfig `json:"nvidia"`
|
||||||
|
|
@ -386,11 +387,11 @@ func SaveConfig(path string, cfg *Config) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
dir := filepath.Dir(path)
|
dir := filepath.Dir(path)
|
||||||
if err := os.MkdirAll(dir, 0755); err != nil {
|
if err := os.MkdirAll(dir, 0o755); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
return os.WriteFile(path, data, 0600)
|
return os.WriteFile(path, data, 0o600)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Config) WorkspacePath() string {
|
func (c *Config) WorkspacePath() string {
|
||||||
|
|
|
||||||
|
|
@ -280,6 +280,14 @@ func CreateProvider(cfg *config.Config) (LLMProvider, error) {
|
||||||
apiBase = "https://open.bigmodel.cn/api/paas/v4"
|
apiBase = "https://open.bigmodel.cn/api/paas/v4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
case "bailian", "dashscope", "aliyun":
|
||||||
|
if cfg.Providers.Bailian.APIKey != "" {
|
||||||
|
apiKey = cfg.Providers.Bailian.APIKey
|
||||||
|
apiBase = cfg.Providers.Bailian.APIBase
|
||||||
|
if apiBase == "" {
|
||||||
|
apiBase = "https://dashscope.aliyuncs.com/compatible-mode/v1"
|
||||||
|
}
|
||||||
|
}
|
||||||
case "gemini", "google":
|
case "gemini", "google":
|
||||||
if cfg.Providers.Gemini.APIKey != "" {
|
if cfg.Providers.Gemini.APIKey != "" {
|
||||||
apiKey = cfg.Providers.Gemini.APIKey
|
apiKey = cfg.Providers.Gemini.APIKey
|
||||||
|
|
@ -333,7 +341,6 @@ func CreateProvider(cfg *config.Config) (LLMProvider, error) {
|
||||||
return NewGitHubCopilotProvider(apiBase, cfg.Providers.GitHubCopilot.ConnectMode, model)
|
return NewGitHubCopilotProvider(apiBase, cfg.Providers.GitHubCopilot.ConnectMode, model)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fallback: detect provider from model name
|
// Fallback: detect provider from model name
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue