feat(config): add support for disabling OpenAI compatibility providers

- Introduced a `Disabled` flag to OpenAI compatibility configurations.
- Updated routing, auth selection, and API handling logic to respect the `Disabled` state.
- Extended relevant APIs, YAML configurations, and data structures to include the `Disabled` field.
- Adjusted all relevant loops and filters to skip disabled providers.

Closes: #3060 #3059 #2977
This commit is contained in:
Luis Pater
2026-04-26 21:49:36 +08:00
parent 0a7c6b0a4a
commit 38573050aa
13 changed files with 40 additions and 0 deletions
@@ -464,6 +464,7 @@ func (h *Handler) PatchOpenAICompat(c *gin.Context) {
type openAICompatPatch struct {
Name *string `json:"name"`
Prefix *string `json:"prefix"`
Disabled *bool `json:"disabled"`
BaseURL *string `json:"base-url"`
APIKeyEntries *[]config.OpenAICompatibilityAPIKey `json:"api-key-entries"`
Models *[]config.OpenAICompatibilityModel `json:"models"`
@@ -506,6 +507,9 @@ func (h *Handler) PatchOpenAICompat(c *gin.Context) {
if body.Value.Prefix != nil {
entry.Prefix = strings.TrimSpace(*body.Value.Prefix)
}
if body.Value.Disabled != nil {
entry.Disabled = *body.Value.Disabled
}
if body.Value.BaseURL != nil {
trimmed := strings.TrimSpace(*body.Value.BaseURL)
if trimmed == "" {