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

Function openAICompatKey

internal/watcher/diff/openai_compat.go:110–137  ·  view source on GitHub ↗
(entry config.OpenAICompatibility, index int)

Source from the content-addressed store, hash-verified

108}
109
110func openAICompatKey(entry config.OpenAICompatibility, index int) (string, string) {
111 name := strings.TrimSpace(entry.Name)
112 if name != "" {
113 return "name:" + name, name
114 }
115 base := strings.TrimSpace(entry.BaseURL)
116 if base != "" {
117 return "base:" + base, base
118 }
119 for _, model := range entry.Models {
120 alias := strings.TrimSpace(model.Alias)
121 if alias == "" {
122 alias = strings.TrimSpace(model.Name)
123 }
124 if alias != "" {
125 return "alias:" + alias, alias
126 }
127 }
128 sig := openAICompatSignature(entry)
129 if sig == "" {
130 return fmt.Sprintf("index:%d", index), fmt.Sprintf("entry-%d", index+1)
131 }
132 short := sig
133 if len(short) > 8 {
134 short = short[:8]
135 }
136 return "sig:" + sig, "compat-" + short
137}
138
139func openAICompatSignature(entry config.OpenAICompatibility) string {
140 var parts []string

Calls 1

openAICompatSignatureFunction · 0.85