diff --git a/core/http/middleware/trace.go b/core/http/middleware/trace.go index 71a12d97605c..ef3dd891d7f8 100644 --- a/core/http/middleware/trace.go +++ b/core/http/middleware/trace.go @@ -3,6 +3,7 @@ package middleware import ( "bytes" "io" + "mime" "net/http" "slices" "sync" @@ -94,7 +95,8 @@ func TraceMiddleware(app *application.Application) echo.MiddlewareFunc { initializeTracing(app.ApplicationConfig().TracingMaxItems) - if c.Request().Header.Get("Content-Type") != "application/json" { + ct, _, _ := mime.ParseMediaType(c.Request().Header.Get("Content-Type")) + if ct != "application/json" { return next(c) } diff --git a/core/http/routes/ui_api.go b/core/http/routes/ui_api.go index 8d089f8734fe..159b535f5ba9 100644 --- a/core/http/routes/ui_api.go +++ b/core/http/routes/ui_api.go @@ -23,7 +23,6 @@ import ( "github.com/mudler/LocalAI/core/gallery" "github.com/mudler/LocalAI/core/http/auth" "github.com/mudler/LocalAI/core/http/endpoints/localai" - "github.com/mudler/LocalAI/core/http/middleware" "github.com/mudler/LocalAI/core/p2p" "github.com/mudler/LocalAI/core/services/galleryop" "github.com/mudler/LocalAI/pkg/model" @@ -1458,24 +1457,5 @@ func RegisterUIAPIRoutes(app *echo.Echo, cl *config.ModelConfigLoader, ml *model app.POST("/api/settings", localai.UpdateSettingsEndpoint(applicationInstance), adminMiddleware) } - // Logs API (admin only) - app.GET("/api/traces", func(c echo.Context) error { - if !appConfig.EnableTracing { - return c.JSON(503, map[string]any{ - "error": "Tracing disabled", - }) - } - traces := middleware.GetTraces() - return c.JSON(200, map[string]any{ - "traces": traces, - }) - }, adminMiddleware) - - app.POST("/api/traces/clear", func(c echo.Context) error { - middleware.ClearTraces() - return c.JSON(200, map[string]any{ - "message": "Traces cleared", - }) - }, adminMiddleware) }