Merge 86ff42b4fa into 56a060ff61
This commit is contained in:
commit
02bac74b11
2 changed files with 12 additions and 0 deletions
|
|
@ -263,6 +263,7 @@ type ProvidersConfig struct {
|
|||
ShengSuanYun ProviderConfig `json:"shengsuanyun"`
|
||||
DeepSeek ProviderConfig `json:"deepseek"`
|
||||
GitHubCopilot ProviderConfig `json:"github_copilot"`
|
||||
Custom ProviderConfig `json:"custom"`
|
||||
}
|
||||
|
||||
type ProviderConfig struct {
|
||||
|
|
@ -411,6 +412,7 @@ func DefaultConfig() *Config {
|
|||
Nvidia: ProviderConfig{},
|
||||
Moonshot: ProviderConfig{},
|
||||
ShengSuanYun: ProviderConfig{},
|
||||
Custom: ProviderConfig{},
|
||||
},
|
||||
Gateway: GatewayConfig{
|
||||
Host: "0.0.0.0",
|
||||
|
|
|
|||
|
|
@ -75,6 +75,12 @@ func resolveProviderSelection(cfg *config.Config) (providerSelection, error) {
|
|||
// First, prefer explicit provider configuration.
|
||||
if providerName != "" {
|
||||
switch providerName {
|
||||
case "custom":
|
||||
if cfg.Providers.Custom.APIBase != "" {
|
||||
sel.apiKey = cfg.Providers.Custom.APIKey
|
||||
sel.apiBase = cfg.Providers.Custom.APIBase
|
||||
sel.proxy = cfg.Providers.Custom.Proxy
|
||||
}
|
||||
case "groq":
|
||||
if cfg.Providers.Groq.APIKey != "" {
|
||||
sel.apiKey = cfg.Providers.Groq.APIKey
|
||||
|
|
@ -214,6 +220,10 @@ func resolveProviderSelection(cfg *config.Config) (providerSelection, error) {
|
|||
// Fallback: infer provider from model and configured keys.
|
||||
if sel.apiKey == "" && sel.apiBase == "" {
|
||||
switch {
|
||||
case cfg.Providers.Custom.APIBase != "":
|
||||
sel.apiKey = cfg.Providers.Custom.APIKey
|
||||
sel.apiBase = cfg.Providers.Custom.APIBase
|
||||
sel.proxy = cfg.Providers.Custom.Proxy
|
||||
case (strings.Contains(lowerModel, "kimi") || strings.Contains(lowerModel, "moonshot") || strings.HasPrefix(model, "moonshot/")) && cfg.Providers.Moonshot.APIKey != "":
|
||||
sel.apiKey = cfg.Providers.Moonshot.APIKey
|
||||
sel.apiBase = cfg.Providers.Moonshot.APIBase
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue