MCPcopy Create free account
hub / github.com/1Panel-dev/1Panel / Search

Method Search

agent/app/service/ai.go:48–70  ·  view source on GitHub ↗
(req dto.SearchWithPage)

Source from the content-addressed store, hash-verified

46}
47
48func (u *AIToolService) Search(req dto.SearchWithPage) (int64, []dto.OllamaModelInfo, error) {
49 var options []repo.DBOption
50 if len(req.Info) != 0 {
51 options = append(options, repo.WithByLikeName(req.Info))
52 }
53 total, list, err := aiRepo.Page(req.Page, req.PageSize, options...)
54 if err != nil {
55 return 0, nil, err
56 }
57 var dtoLists []dto.OllamaModelInfo
58 for _, itemModel := range list {
59 var item dto.OllamaModelInfo
60 if err := copier.Copy(&item, &itemModel); err != nil {
61 return 0, nil, buserr.WithDetail("ErrStructTransform", err.Error(), nil)
62 }
63 taskModel, _ := taskRepo.GetFirst(taskRepo.WithResourceID(item.ID), repo.WithByType(task.TaskScopeAI))
64 if len(taskModel.ID) != 0 {
65 item.LogFileExist = true
66 }
67 dtoLists = append(dtoLists, item)
68 }
69 return total, dtoLists, err
70}
71
72func (u *AIToolService) LoadDetail(name string) (string, error) {
73 if cmd.CheckIllegal(name) {

Callers

nothing calls this directly

Calls 7

CopyMethod · 0.80
WithByLikeNameMethod · 0.65
PageMethod · 0.65
GetFirstMethod · 0.65
WithResourceIDMethod · 0.65
WithByTypeMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected