31 lines
1.3 KiB
Go
31 lines
1.3 KiB
Go
package galleryop
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/mudler/LocalAI/core/gallery"
|
|
)
|
|
|
|
// ProgressCallback reports download progress for model/backend installations.
|
|
type ProgressCallback func(fileName, current, total string, percentage float64)
|
|
|
|
// ModelManager handles model install and delete lifecycle.
|
|
type ModelManager interface {
|
|
InstallModel(ctx context.Context, op *ManagementOp[gallery.GalleryModel, gallery.ModelConfig], progressCb ProgressCallback) error
|
|
DeleteModel(name string) error
|
|
}
|
|
|
|
// BackendManager handles backend install, delete, upgrade, and listing lifecycle.
|
|
type BackendManager interface {
|
|
InstallBackend(ctx context.Context, op *ManagementOp[gallery.GalleryBackend, any], progressCb ProgressCallback) error
|
|
DeleteBackend(name string) error
|
|
ListBackends() (gallery.SystemBackends, error)
|
|
UpgradeBackend(ctx context.Context, opID, name string, progressCb ProgressCallback) error
|
|
CheckUpgrades(ctx context.Context) (map[string]gallery.UpgradeInfo, error)
|
|
// IsDistributed reports whether installs fan out across worker nodes.
|
|
// The HTTP layer uses this to refuse hardware-specific (non-meta) installs
|
|
// on /api/backends/apply in distributed mode — a CPU build silently
|
|
// landing on every GPU node is the footgun this guards against.
|
|
IsDistributed() bool
|
|
}
|