2024-03-22 20:14:04 +00:00
|
|
|
package backend
|
|
|
|
|
|
|
|
import (
|
2024-06-23 08:24:36 +00:00
|
|
|
"github.com/mudler/LocalAI/core/config"
|
2024-03-22 20:14:04 +00:00
|
|
|
|
2024-06-23 08:24:36 +00:00
|
|
|
"github.com/mudler/LocalAI/pkg/grpc"
|
|
|
|
"github.com/mudler/LocalAI/pkg/model"
|
2024-03-22 20:14:04 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func StoreBackend(sl *model.ModelLoader, appConfig *config.ApplicationConfig, storeName string) (grpc.Backend, error) {
|
2024-11-08 20:54:25 +00:00
|
|
|
if storeName == "" {
|
|
|
|
storeName = "default"
|
|
|
|
}
|
2024-03-22 20:14:04 +00:00
|
|
|
|
2024-11-08 20:54:25 +00:00
|
|
|
sc := []model.Option{
|
|
|
|
model.WithBackendString(model.LocalStoreBackend),
|
|
|
|
model.WithAssetDir(appConfig.AssetsDestination),
|
|
|
|
model.WithModel(storeName),
|
|
|
|
}
|
2024-03-22 20:14:04 +00:00
|
|
|
|
2024-11-08 20:54:25 +00:00
|
|
|
return sl.Load(sc...)
|
2024-03-22 20:14:04 +00:00
|
|
|
}
|