refactor(routes): split routes registration (#2077)

Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
This commit is contained in:
Ettore Di Giacinto 2024-04-21 01:19:57 +02:00 committed by GitHub
parent afa1bca1e3
commit 284ad026b1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 227 additions and 167 deletions

View file

@ -0,0 +1,23 @@
package routes
import (
"github.com/go-skynet/LocalAI/core/config"
"github.com/go-skynet/LocalAI/core/http/endpoints/localai"
"github.com/go-skynet/LocalAI/pkg/model"
"github.com/gofiber/fiber/v2"
)
func RegisterPagesRoutes(app *fiber.App,
cl *config.BackendConfigLoader,
ml *model.ModelLoader,
appConfig *config.ApplicationConfig,
auth func(*fiber.Ctx) error) {
models, _ := ml.ListModels()
backendConfigs := cl.GetAllBackendConfigs()
if !appConfig.DisableWelcomePage {
app.Get("/", auth, localai.WelcomeEndpoint(appConfig, models, backendConfigs))
}
}