(ctx context.Context, record capabilityRecord, provider pluginapi.ModelProvider, auth *coreauth.Auth)
| 490 | } |
| 491 | |
| 492 | func (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 | |
| 515 | func (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) { |
no test coverage detected