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

Method GetModelInfo

internal/registry/model_registry.go:1098–1116  ·  view source on GitHub ↗

GetModelInfo returns ModelInfo, prioritizing provider-specific definition if available.

(modelID, provider string)

Source from the content-addressed store, hash-verified

1096
1097// GetModelInfo returns ModelInfo, prioritizing provider-specific definition if available.
1098func (r *ModelRegistry) GetModelInfo(modelID, provider string) *ModelInfo {
1099 r.mutex.RLock()
1100 defer r.mutex.RUnlock()
1101 if reg, ok := r.models[modelID]; ok && reg != nil {
1102 // Try provider specific definition first
1103 if provider != "" && reg.InfoByProvider != nil {
1104 if reg.Providers != nil {
1105 if count, ok := reg.Providers[provider]; ok && count > 0 {
1106 if info, ok := reg.InfoByProvider[provider]; ok && info != nil {
1107 return cloneModelInfo(info)
1108 }
1109 }
1110 }
1111 }
1112 // Fallback to global info (last registered)
1113 return cloneModelInfo(reg.Info)
1114 }
1115 return nil
1116}
1117
1118// convertModelToMap converts ModelInfo to the appropriate format for different handler types
1119func (r *ModelRegistry) convertModelToMap(model *ModelInfo, handlerType string) map[string]any {

Callers 3

LookupModelInfoFunction · 0.80
ensureModelMaxTokensFunction · 0.80

Calls 1

cloneModelInfoFunction · 0.85

Tested by 1