MCPcopy
hub / github.com/mudler/LocalAI / Run

Method Run

core/cli/backends.go:57–99  ·  view source on GitHub ↗
(ctx *cliContext.Context)

Source from the content-addressed store, hash-verified

55}
56
57func (bl *BackendsList) Run(ctx *cliContext.Context) error {
58 var galleries []config.Gallery
59 if err := json.Unmarshal([]byte(bl.BackendGalleries), &galleries); err != nil {
60 xlog.Error("unable to load galleries", "error", err)
61 }
62
63 systemState, err := system.GetSystemState(
64 system.WithBackendSystemPath(bl.BackendsSystemPath),
65 system.WithBackendPath(bl.BackendsPath),
66 )
67 if err != nil {
68 return err
69 }
70
71 backends, err := gallery.AvailableBackends(galleries, systemState)
72 if err != nil {
73 return err
74 }
75
76 // Check for upgrades
77 upgrades, _ := gallery.CheckBackendUpgrades(context.Background(), galleries, systemState)
78
79 for _, backend := range backends {
80 versionStr := ""
81 if backend.Version != "" {
82 versionStr = " v" + backend.Version
83 }
84 if backend.Installed {
85 if info, ok := upgrades[backend.Name]; ok {
86 upgradeStr := info.AvailableVersion
87 if upgradeStr == "" {
88 upgradeStr = "new build"
89 }
90 fmt.Printf(" * %s@%s%s (installed, upgrade available: %s)\n", backend.Gallery.Name, backend.Name, versionStr, upgradeStr)
91 } else {
92 fmt.Printf(" * %s@%s%s (installed)\n", backend.Gallery.Name, backend.Name, versionStr)
93 }
94 } else {
95 fmt.Printf(" - %s@%s%s\n", backend.Gallery.Name, backend.Name, versionStr)
96 }
97 }
98 return nil
99}
100
101func (bi *BackendsInstall) Run(ctx *cliContext.Context) error {
102 var galleries []config.Gallery

Callers

nothing calls this directly

Calls 6

GetSystemStateFunction · 0.92
WithBackendSystemPathFunction · 0.92
WithBackendPathFunction · 0.92
AvailableBackendsFunction · 0.92
CheckBackendUpgradesFunction · 0.92
ErrorMethod · 0.45

Tested by

no test coverage detected