MCPcopy Index your code
hub / github.com/APIParkLab/APIPark / SimpleProviders

Method SimpleProviders

module/ai/iml.go:311–339  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

309}
310
311func (i *imlProviderModule) SimpleProviders(ctx context.Context) ([]*ai_dto.SimpleProviderItem, error) {
312 list, err := i.providerService.List(ctx)
313 if err != nil {
314 return nil, err
315 }
316 providers := model_runtime.Providers()
317
318 providerMap := utils.SliceToMap(list, func(e *ai.Provider) string {
319 return e.Id
320 })
321
322 items := make([]*ai_dto.SimpleProviderItem, 0, len(providers))
323 for _, v := range providers {
324 item := &ai_dto.SimpleProviderItem{
325 Id: v.ID(),
326 Name: v.Name(),
327 Logo: v.Logo(),
328 DefaultConfig: v.DefaultConfig(),
329 Status: ai_dto.ProviderDisabled,
330 }
331 if info, has := providerMap[v.ID()]; has {
332 item.Configured = true
333 item.Status = ai_dto.ToProviderStatus(info.Status)
334 }
335 items = append(items, item)
336 }
337
338 return items, nil
339}
340
341func (i *imlProviderModule) SimpleConfiguredProviders(ctx context.Context, all bool) ([]*ai_dto.SimpleProviderItem, *ai_dto.BackupProvider, error) {
342 list, err := i.providerService.List(ctx)

Callers

nothing calls this directly

Calls 5

ListMethod · 0.65
IDMethod · 0.65
NameMethod · 0.65
LogoMethod · 0.65
DefaultConfigMethod · 0.65

Tested by

no test coverage detected