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

Method Search

module/ai-local/iml.go:101–125  ·  view source on GitHub ↗
(ctx context.Context, keyword string)

Source from the content-addressed store, hash-verified

99}
100
101func (i *imlLocalModel) Search(ctx context.Context, keyword string) ([]*ai_local_dto.LocalModelItem, error) {
102 list, err := i.localModelService.Search(ctx, keyword, nil, "update_at desc")
103 if err != nil {
104 return nil, err
105 }
106 apiCountMap, err := i.aiAPIService.CountMapByModel(ctx, "", map[string]interface{}{
107 "type": 1,
108 })
109 if err != nil {
110 return nil, err
111 }
112
113 return utils.SliceToSlice(list, func(s *ai_local.LocalModel) *ai_local_dto.LocalModelItem {
114 count := apiCountMap[s.Id]
115 return &ai_local_dto.LocalModelItem{
116 Id: s.Id,
117 Name: s.Name,
118 State: ai_local_dto.FromLocalModelState(s.State),
119 APICount: count,
120 CanDelete: count < 1 && s.State != ai_local_dto.LocalModelStateDeploying.Int(),
121 UpdateTime: auto.TimeLabel(s.UpdateAt),
122 Provider: ai_provider_local.ProviderLocal,
123 }
124 }), nil
125}
126
127func (i *imlLocalModel) ListCanInstall(ctx context.Context, keyword string) ([]*ai_local_dto.LocalModelPackageItem, error) {
128

Callers

nothing calls this directly

Calls 3

SearchMethod · 0.65
CountMapByModelMethod · 0.65
IntMethod · 0.45

Tested by

no test coverage detected