| 125 | } |
| 126 | |
| 127 | func intersectModelNames(base []string, allowed []string) []string { |
| 128 | allowedSet := make(map[string]struct{}, len(allowed)) |
| 129 | for _, model := range normalizeModelNames(allowed) { |
| 130 | allowedSet[model] = struct{}{} |
| 131 | } |
| 132 | return lo.Filter(normalizeModelNames(base), func(model string, _ int) bool { |
| 133 | _, ok := allowedSet[model] |
| 134 | return ok |
| 135 | }) |
| 136 | } |
| 137 | |
| 138 | func applySelectedModelChanges(originModels []string, addModels []string, removeModels []string) []string { |
| 139 | // Add wins when the same model appears in both selected lists. |