mirror of
https://github.com/mudler/LocalAI.git
synced 2025-06-14 13:08:08 +00:00
feat: allow to preload models before startup via env var or configs (#391)
This commit is contained in:
committed by
GitHub
parent
835a20610b
commit
76c881043e
12
api/api.go
12
api/api.go
@ -69,6 +69,18 @@ func App(opts ...AppOption) *fiber.App {
|
||||
// Default middleware config
|
||||
app.Use(recover.New())
|
||||
|
||||
if options.preloadJSONModels != "" {
|
||||
if err := ApplyGalleryFromString(options.loader.ModelPath, options.preloadJSONModels, cm); err != nil {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
if options.preloadModelsFromPath != "" {
|
||||
if err := ApplyGalleryFromFile(options.loader.ModelPath, options.preloadModelsFromPath, cm); err != nil {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
if options.cors {
|
||||
if options.corsAllowOrigins == "" {
|
||||
app.Use(cors.New())
|
||||
|
Reference in New Issue
Block a user