mirror of
https://github.com/mudler/LocalAI.git
synced 2026-01-07 19:20:04 -06:00
fix(paths): remove trailing slash from requests (#7451)
This removes any ambiguity from how paths are handled, and at the same time it uniforms the ui paths with the other paths that don't have a trailing slash Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
This commit is contained in:
committed by
GitHub
parent
8ca98c90ea
commit
03a17a2986
@@ -90,6 +90,8 @@ func API(application *application.Application) (*echo.Echo, error) {
|
||||
// Middleware - StripPathPrefix must be registered early as it uses Rewrite which runs before routing
|
||||
e.Pre(httpMiddleware.StripPathPrefix())
|
||||
|
||||
e.Pre(middleware.RemoveTrailingSlash())
|
||||
|
||||
if application.ApplicationConfig().MachineTag != "" {
|
||||
e.Use(func(next echo.HandlerFunc) echo.HandlerFunc {
|
||||
return func(c echo.Context) error {
|
||||
|
||||
@@ -89,7 +89,7 @@ func RegisterUIRoutes(app *echo.Echo,
|
||||
})
|
||||
|
||||
// P2P
|
||||
app.GET("/p2p/", func(c echo.Context) error {
|
||||
app.GET("/p2p", func(c echo.Context) error {
|
||||
summary := map[string]interface{}{
|
||||
"Title": "LocalAI - P2P dashboard",
|
||||
"BaseURL": middleware.BaseURL(c),
|
||||
@@ -115,7 +115,7 @@ func RegisterUIRoutes(app *echo.Echo,
|
||||
registerBackendGalleryRoutes(app, appConfig, galleryService, processingOps)
|
||||
}
|
||||
|
||||
app.GET("/talk/", func(c echo.Context) error {
|
||||
app.GET("/talk", func(c echo.Context) error {
|
||||
modelConfigs, _ := services.ListModels(cl, ml, config.NoFilterFn, services.SKIP_IF_CONFIGURED)
|
||||
|
||||
if len(modelConfigs) == 0 {
|
||||
@@ -136,7 +136,7 @@ func RegisterUIRoutes(app *echo.Echo,
|
||||
return c.Render(200, "views/talk", summary)
|
||||
})
|
||||
|
||||
app.GET("/chat/", func(c echo.Context) error {
|
||||
app.GET("/chat", func(c echo.Context) error {
|
||||
modelConfigs := cl.GetAllModelsConfigs()
|
||||
modelsWithoutConfig, _ := services.ListModels(cl, ml, config.NoFilterFn, services.LOOSE_ONLY)
|
||||
|
||||
@@ -236,7 +236,7 @@ func RegisterUIRoutes(app *echo.Echo,
|
||||
return c.Render(200, "views/text2image", summary)
|
||||
})
|
||||
|
||||
app.GET("/text2image/", func(c echo.Context) error {
|
||||
app.GET("/text2image", func(c echo.Context) error {
|
||||
modelConfigs := cl.GetAllModelsConfigs()
|
||||
modelsWithoutConfig, _ := services.ListModels(cl, ml, config.NoFilterFn, services.LOOSE_ONLY)
|
||||
|
||||
@@ -286,7 +286,7 @@ func RegisterUIRoutes(app *echo.Echo,
|
||||
return c.Render(200, "views/tts", summary)
|
||||
})
|
||||
|
||||
app.GET("/tts/", func(c echo.Context) error {
|
||||
app.GET("/tts", func(c echo.Context) error {
|
||||
modelConfigs := cl.GetAllModelsConfigs()
|
||||
modelsWithoutConfig, _ := services.ListModels(cl, ml, config.NoFilterFn, services.LOOSE_ONLY)
|
||||
|
||||
|
||||
@@ -9,8 +9,7 @@ import (
|
||||
)
|
||||
|
||||
func registerGalleryRoutes(app *echo.Echo, cl *config.ModelConfigLoader, appConfig *config.ApplicationConfig, galleryService *services.GalleryService, opcache *services.OpCache) {
|
||||
|
||||
app.GET("/browse/", func(c echo.Context) error {
|
||||
app.GET("/browse", func(c echo.Context) error {
|
||||
summary := map[string]interface{}{
|
||||
"Title": "LocalAI - Models",
|
||||
"BaseURL": middleware.BaseURL(c),
|
||||
|
||||
Reference in New Issue
Block a user