NormalizeOAuthExcludedModels cleans provider -> excluded models mappings by normalizing provider keys and applying model exclusion normalization to each entry.
(entries map[string][]string)
| 1150 | // NormalizeOAuthExcludedModels cleans provider -> excluded models mappings by normalizing provider keys |
| 1151 | // and applying model exclusion normalization to each entry. |
| 1152 | func NormalizeOAuthExcludedModels(entries map[string][]string) map[string][]string { |
| 1153 | if len(entries) == 0 { |
| 1154 | return nil |
| 1155 | } |
| 1156 | out := make(map[string][]string, len(entries)) |
| 1157 | for provider, models := range entries { |
| 1158 | key := strings.ToLower(strings.TrimSpace(provider)) |
| 1159 | if key == "" { |
| 1160 | continue |
| 1161 | } |
| 1162 | normalized := NormalizeExcludedModels(models) |
| 1163 | if len(normalized) == 0 { |
| 1164 | continue |
| 1165 | } |
| 1166 | out[key] = normalized |
| 1167 | } |
| 1168 | if len(out) == 0 { |
| 1169 | return nil |
| 1170 | } |
| 1171 | return out |
| 1172 | } |
| 1173 | |
| 1174 | // hashSecret hashes the given secret using bcrypt. |
| 1175 | func hashSecret(secret string) (string, error) { |
no test coverage detected