MCPcopy Create free account
hub / github.com/APIParkLab/APIPark / OnInit

Method OnInit

module/ai-api/iml.go:373–395  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

371}
372
373func (i *imlAPIModule) OnInit() {
374 ctx := context.Background()
375 list, err := i.aiAPIService.List(ctx)
376 if err != nil {
377 return
378 }
379 for _, item := range list {
380 if item.Provider == "" {
381 aiModel, err := ConvertStruct[ai_api_dto.AiModel](item.AdditionalConfig["ai_model"])
382 if err != nil {
383 log.Errorf("convert ai model error:%v", err)
384 continue
385 }
386 err = i.aiAPIService.Save(ctx, item.ID, &ai_api.Edit{
387 Provider: &aiModel.Provider,
388 })
389 if err != nil {
390 log.Errorf("update ai api provider error:%v", err)
391 continue
392 }
393 }
394 }
395}

Callers

nothing calls this directly

Calls 2

ListMethod · 0.65
SaveMethod · 0.65

Tested by

no test coverage detected