From b93026d83a8da573f4871c8a483287d2ea8c02d6 Mon Sep 17 00:00:00 2001 From: RGBadmin Date: Wed, 11 Feb 2026 15:21:15 +0800 Subject: [PATCH] feat: merge per-account excluded_models with global config --- internal/watcher/synthesizer/helpers.go | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/internal/watcher/synthesizer/helpers.go b/internal/watcher/synthesizer/helpers.go index 621f3600..102dc77e 100644 --- a/internal/watcher/synthesizer/helpers.go +++ b/internal/watcher/synthesizer/helpers.go @@ -53,6 +53,8 @@ func (g *StableIDGenerator) Next(kind string, parts ...string) (string, string) // ApplyAuthExcludedModelsMeta applies excluded models metadata to an auth entry. // It computes a hash of excluded models and sets the auth_kind attribute. +// For OAuth entries, perKey (from the JSON file's excluded-models field) is merged +// with the global oauth-excluded-models config for the provider. func ApplyAuthExcludedModelsMeta(auth *coreauth.Auth, cfg *config.Config, perKey []string, authKind string) { if auth == nil || cfg == nil { return @@ -72,9 +74,13 @@ func ApplyAuthExcludedModelsMeta(auth *coreauth.Auth, cfg *config.Config, perKey } if authKindKey == "apikey" { add(perKey) - } else if cfg.OAuthExcludedModels != nil { - providerKey := strings.ToLower(strings.TrimSpace(auth.Provider)) - add(cfg.OAuthExcludedModels[providerKey]) + } else { + // For OAuth: merge per-account excluded models with global provider-level exclusions + add(perKey) + if cfg.OAuthExcludedModels != nil { + providerKey := strings.ToLower(strings.TrimSpace(auth.Provider)) + add(cfg.OAuthExcludedModels[providerKey]) + } } combined := make([]string, 0, len(seen)) for k := range seen { @@ -88,6 +94,10 @@ func ApplyAuthExcludedModelsMeta(auth *coreauth.Auth, cfg *config.Config, perKey if hash != "" { auth.Attributes["excluded_models_hash"] = hash } + // Store the combined excluded models list so that routing can read it at runtime + if len(combined) > 0 { + auth.Attributes["excluded_models"] = strings.Join(combined, ",") + } if authKind != "" { auth.Attributes["auth_kind"] = authKind }