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

Function buildConfigModels

sdk/cliproxy/service.go:2485–2528  ·  view source on GitHub ↗
(models []T, ownedBy, modelType string)

Source from the content-addressed store, hash-verified

2483}
2484
2485func buildConfigModels[T modelEntry](models []T, ownedBy, modelType string) []*ModelInfo {
2486 if len(models) == 0 {
2487 return nil
2488 }
2489 now := time.Now().Unix()
2490 out := make([]*ModelInfo, 0, len(models))
2491 seen := make(map[string]struct{}, len(models))
2492 for i := range models {
2493 model := models[i]
2494 name := strings.TrimSpace(model.GetName())
2495 alias := strings.TrimSpace(model.GetAlias())
2496 if alias == "" {
2497 alias = name
2498 }
2499 if alias == "" {
2500 continue
2501 }
2502 key := strings.ToLower(alias)
2503 if _, exists := seen[key]; exists {
2504 continue
2505 }
2506 seen[key] = struct{}{}
2507 display := name
2508 if display == "" {
2509 display = alias
2510 }
2511 info := &ModelInfo{
2512 ID: alias,
2513 Object: "model",
2514 Created: now,
2515 OwnedBy: ownedBy,
2516 Type: modelType,
2517 DisplayName: display,
2518 UserDefined: true,
2519 }
2520 if name != "" {
2521 if upstream := registry.LookupStaticModelInfo(name); upstream != nil && upstream.Thinking != nil {
2522 info.Thinking = upstream.Thinking
2523 }
2524 }
2525 out = append(out, info)
2526 }
2527 return out
2528}
2529
2530func buildVertexCompatConfigModels(entry *config.VertexCompatKey) []*ModelInfo {
2531 if entry == nil {

Callers 4

buildGeminiConfigModelsFunction · 0.85
buildClaudeConfigModelsFunction · 0.85
buildCodexConfigModelsFunction · 0.85

Calls 3

LookupStaticModelInfoFunction · 0.92
GetNameMethod · 0.65
GetAliasMethod · 0.65

Tested by

no test coverage detected