diff --git a/core/models/models/llm_provider.go b/core/models/models/llm_provider.go index 5acbf6c7..2c74d8f6 100644 --- a/core/models/models/llm_provider.go +++ b/core/models/models/llm_provider.go @@ -11,4 +11,21 @@ type LLMProvider struct { ApiBaseUrl string `json:"api_base_url" bson:"api_base_url"` // API base URL for the provider ApiVersion string `json:"api_version" bson:"api_version"` // API version for the provider Models []string `json:"models" bson:"models"` // Models supported by this provider + Unset bool `json:"unset" bson:"-"` // Whether the provider is unset +} + +func (p *LLMProvider) IsUnset() bool { + if p.ApiKey == "" { + return true + } + if len(p.Models) == 0 { + return true + } + switch p.Key { + case "azure-openai": + return p.ApiBaseUrl == "" && p.ApiVersion == "" + case "openai-compatible": + return p.ApiBaseUrl == "" + } + return false }