SummarizeExcludedModels normalizes and hashes an excluded-model list.
(list []string)
| 13 | |
| 14 | // SummarizeExcludedModels normalizes and hashes an excluded-model list. |
| 15 | func SummarizeExcludedModels(list []string) ExcludedModelsSummary { |
| 16 | if len(list) == 0 { |
| 17 | return ExcludedModelsSummary{} |
| 18 | } |
| 19 | seen := make(map[string]struct{}, len(list)) |
| 20 | normalized := make([]string, 0, len(list)) |
| 21 | for _, entry := range list { |
| 22 | if trimmed := strings.ToLower(strings.TrimSpace(entry)); trimmed != "" { |
| 23 | if _, exists := seen[trimmed]; exists { |
| 24 | continue |
| 25 | } |
| 26 | seen[trimmed] = struct{}{} |
| 27 | normalized = append(normalized, trimmed) |
| 28 | } |
| 29 | } |
| 30 | sort.Strings(normalized) |
| 31 | return ExcludedModelsSummary{ |
| 32 | hash: ComputeExcludedModelsHash(normalized), |
| 33 | count: len(normalized), |
| 34 | } |
| 35 | } |
| 36 | |
| 37 | // SummarizeOAuthExcludedModels summarizes OAuth excluded models per provider. |
| 38 | func SummarizeOAuthExcludedModels(entries map[string][]string) map[string]ExcludedModelsSummary { |