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

Method callModelsForAuth

internal/pluginhost/adapters.go:492–513  ·  view source on GitHub ↗
(ctx context.Context, record capabilityRecord, provider pluginapi.ModelProvider, auth *coreauth.Auth)

Source from the content-addressed store, hash-verified

490}
491
492func (h *Host) callModelsForAuth(ctx context.Context, record capabilityRecord, provider pluginapi.ModelProvider, auth *coreauth.Auth) (resp pluginapi.ModelResponse, err error) {
493 if h == nil || provider == nil || auth == nil || h.isPluginFused(record.id) || !h.recordCurrent(record) {
494 return pluginapi.ModelResponse{}, nil
495 }
496 defer func() {
497 if recovered := recover(); recovered != nil {
498 h.fusePlugin(record.id, "ModelProvider.ModelsForAuth", recovered)
499 resp = pluginapi.ModelResponse{}
500 err = fmt.Errorf("model provider per-auth models panic: %v", recovered)
501 }
502 }()
503 return provider.ModelsForAuth(ctx, pluginapi.AuthModelRequest{
504 Plugin: record.meta,
505 AuthID: auth.ID,
506 AuthProvider: auth.Provider,
507 StorageJSON: storageJSONFromAuth(auth),
508 Metadata: cloneAnyMap(auth.Metadata),
509 Attributes: cloneStringMap(auth.Attributes),
510 Host: h.hostConfigSummary(),
511 HTTPClient: h.newHTTPClient(auth),
512 })
513}
514
515func (h *Host) callRequestInterceptor(ctx context.Context, record capabilityRecord, method string, call func(context.Context, pluginapi.RequestInterceptRequest) (pluginapi.RequestInterceptResponse, error), req pluginapi.RequestInterceptRequest) (out pluginapi.RequestInterceptResponse, ok bool) {
516 if h == nil || call == nil || h.isPluginFused(record.id) || !h.recordCurrent(record) {

Callers 1

ModelsForAuthMethod · 0.95

Calls 9

isPluginFusedMethod · 0.95
recordCurrentMethod · 0.95
fusePluginMethod · 0.95
hostConfigSummaryMethod · 0.95
newHTTPClientMethod · 0.95
storageJSONFromAuthFunction · 0.85
cloneAnyMapFunction · 0.85
cloneStringMapFunction · 0.85
ModelsForAuthMethod · 0.65

Tested by

no test coverage detected