MCPcopy Create free account
hub / github.com/chainreactors/EvilProxy / registerResolvedModelsForAuth

Method registerResolvedModelsForAuth

sdk/cliproxy/service.go:1104–1131  ·  view source on GitHub ↗
(a *coreauth.Auth, providerKey string, models []*ModelInfo)

Source from the content-addressed store, hash-verified

1102}
1103
1104func (s *Service) registerResolvedModelsForAuth(a *coreauth.Auth, providerKey string, models []*ModelInfo) {
1105 if a == nil || a.ID == "" {
1106 return
1107 }
1108 providerKey = strings.ToLower(strings.TrimSpace(providerKey))
1109 if providerKey == "" {
1110 GlobalModelRegistry().UnregisterClient(a.ID)
1111 return
1112 }
1113 normalizedModels := make([]*ModelInfo, 0, len(models))
1114 for _, model := range models {
1115 if model == nil {
1116 continue
1117 }
1118 modelID := strings.TrimSpace(model.ID)
1119 if modelID == "" {
1120 continue
1121 }
1122 clone := *model
1123 clone.ID = modelID
1124 normalizedModels = append(normalizedModels, &clone)
1125 }
1126 if len(normalizedModels) == 0 {
1127 GlobalModelRegistry().UnregisterClient(a.ID)
1128 return
1129 }
1130 GlobalModelRegistry().RegisterClient(a.ID, providerKey, normalizedModels)
1131}
1132
1133func (s *Service) pluginModelsForProvider(providerKey string) []*ModelInfo {
1134 if s == nil || s.pluginHost == nil {

Calls 3

GlobalModelRegistryFunction · 0.85
UnregisterClientMethod · 0.65
RegisterClientMethod · 0.65

Tested by

no test coverage detected