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

Function init

ai-provider/local/model.go:35–62  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

33}
34
35func init() {
36 data, err := modelsFs.ReadFile("models.json")
37 if err != nil {
38 log.Info("read models.json error: ", err)
39 return
40 }
41 var cfg ModelConfig
42 err = json.Unmarshal(data, &cfg)
43 if err != nil {
44 log.Info("unmarshal models.json error: ", err)
45 return
46 }
47 modelVersion = cfg.Version
48 modelCanInstall = make([]ModelDetail, 0, len(cfg.Models))
49 for _, model := range cfg.Models {
50 if _, ok := modelTags[model.Id]; !ok {
51 modelTags[model.Id] = make([]ModelDetail, 0)
52 }
53 names := strings.Split(model.Id, ":")
54
55 modelTags[names[0]] = append(modelTags[names[0]], model)
56 if !model.Latest {
57 continue
58 }
59 modelCanInstall = append(modelCanInstall, model)
60 }
61
62}
63
64func ModelsCanInstall() ([]ModelDetail, string) {
65 return modelCanInstall, modelVersion

Callers

nothing calls this directly

Calls 1

InfoMethod · 0.65

Tested by

no test coverage detected