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

Function errorEventModelStatusFrom

sdk/cliproxy/auth/error_events.go:102–119  ·  view source on GitHub ↗
(model string, authSnapshot *Auth)

Source from the content-addressed store, hash-verified

100}
101
102func errorEventModelStatusFrom(model string, authSnapshot *Auth) *errorEventModelStatus {
103 model = strings.TrimSpace(model)
104 if model == "" || authSnapshot == nil || authSnapshot.ModelStates == nil {
105 return nil
106 }
107 state := authSnapshot.ModelStates[model]
108 if state == nil {
109 return nil
110 }
111 return &errorEventModelStatus{
112 Name: model,
113 Status: state.Status,
114 StatusMessage: strings.TrimSpace(state.StatusMessage),
115 Unavailable: state.Unavailable,
116 NextRetryAfter: timePtrIfSet(state.NextRetryAfter),
117 Quota: errorEventQuotaStatusFrom(state.Quota),
118 }
119}
120
121func errorEventQuotaStatusFrom(quota QuotaState) *errorEventQuotaStatus {
122 if !quota.Exceeded && strings.TrimSpace(quota.Reason) == "" && quota.NextRecoverAt.IsZero() && quota.BackoffLevel == 0 {

Callers 1

Calls 2

timePtrIfSetFunction · 0.85

Tested by

no test coverage detected