MCPcopy
hub / github.com/QuantumNous/new-api / intersectModelNames

Function intersectModelNames

controller/channel_upstream_update.go:127–136  ·  view source on GitHub ↗
(base []string, allowed []string)

Source from the content-addressed store, hash-verified

125}
126
127func 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
138func applySelectedModelChanges(originModels []string, addModels []string, removeModels []string) []string {
139 // Add wins when the same model appears in both selected lists.

Calls 1

normalizeModelNamesFunction · 0.85

Tested by 1

TestIntersectModelNamesFunction · 0.68