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

Method resolveConfigCodexKey

sdk/cliproxy/service.go:2283–2307  ·  view source on GitHub ↗
(auth *coreauth.Auth)

Source from the content-addressed store, hash-verified

2281}
2282
2283func (s *Service) resolveConfigCodexKey(auth *coreauth.Auth) *config.CodexKey {
2284 if auth == nil || s.cfg == nil {
2285 return nil
2286 }
2287 var attrKey, attrBase string
2288 if auth.Attributes != nil {
2289 attrKey = strings.TrimSpace(auth.Attributes["api_key"])
2290 attrBase = strings.TrimSpace(auth.Attributes["base_url"])
2291 }
2292 for i := range s.cfg.CodexKey {
2293 entry := &s.cfg.CodexKey[i]
2294 cfgKey := strings.TrimSpace(entry.APIKey)
2295 cfgBase := strings.TrimSpace(entry.BaseURL)
2296 if attrKey != "" && strings.EqualFold(cfgKey, attrKey) {
2297 if cfgBase == "" || strings.EqualFold(cfgBase, attrBase) {
2298 return entry
2299 }
2300 continue
2301 }
2302 if attrKey == "" && attrBase != "" && strings.EqualFold(cfgBase, attrBase) {
2303 return entry
2304 }
2305 }
2306 return nil
2307}
2308
2309func (s *Service) oauthExcludedModels(provider, authKind string) []string {
2310 cfg := s.cfg

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected