ComputeExcludedModelsHash returns a normalized hash for excluded model lists.
(excluded []string)
| 89 | |
| 90 | // ComputeExcludedModelsHash returns a normalized hash for excluded model lists. |
| 91 | func ComputeExcludedModelsHash(excluded []string) string { |
| 92 | if len(excluded) == 0 { |
| 93 | return "" |
| 94 | } |
| 95 | normalized := make([]string, 0, len(excluded)) |
| 96 | for _, entry := range excluded { |
| 97 | if trimmed := strings.TrimSpace(entry); trimmed != "" { |
| 98 | normalized = append(normalized, strings.ToLower(trimmed)) |
| 99 | } |
| 100 | } |
| 101 | if len(normalized) == 0 { |
| 102 | return "" |
| 103 | } |
| 104 | sort.Strings(normalized) |
| 105 | data, _ := json.Marshal(normalized) |
| 106 | sum := sha256.Sum256(data) |
| 107 | return hex.EncodeToString(sum[:]) |
| 108 | } |
| 109 | |
| 110 | func normalizeModelPairs(collect func(out func(key string))) []string { |
| 111 | seen := make(map[string]struct{}) |
no outgoing calls