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

Function SummarizeVertexModels

internal/watcher/diff/models_summary.go:96–121  ·  view source on GitHub ↗

SummarizeVertexModels hashes Vertex-compatible model aliases for change detection.

(models []config.VertexCompatModel)

Source from the content-addressed store, hash-verified

94
95// SummarizeVertexModels hashes Vertex-compatible model aliases for change detection.
96func SummarizeVertexModels(models []config.VertexCompatModel) VertexModelsSummary {
97 if len(models) == 0 {
98 return VertexModelsSummary{}
99 }
100 names := make([]string, 0, len(models))
101 for _, model := range models {
102 name := strings.TrimSpace(model.Name)
103 alias := strings.TrimSpace(model.Alias)
104 if name == "" && alias == "" {
105 continue
106 }
107 if alias != "" {
108 name = alias
109 }
110 names = append(names, name)
111 }
112 if len(names) == 0 {
113 return VertexModelsSummary{}
114 }
115 sort.Strings(names)
116 sum := sha256.Sum256([]byte(strings.Join(names, "|")))
117 return VertexModelsSummary{
118 hash: hex.EncodeToString(sum[:]),
119 count: len(names),
120 }
121}

Callers 2

BuildConfigChangeDetailsFunction · 0.85

Calls

no outgoing calls

Tested by 1