mirror of
https://github.com/mudler/LocalAI.git
synced 2026-07-31 02:18:50 -04:00
fix(distributed): backend discovery hid worker-installed backends Backend discovery endpoints filter on installed-state, which on a distributed controller derives from the controller's own filesystem. A backend lives on the worker node that runs it, so every backend an admin installed on a GPU worker read as "not installed" and vanished from the listing. #10947 fixed the sibling capability filter on the same endpoints, so a fine-tuning-capable GPU worker now made the backend listable while the installed-state filter still dropped it: the dropdown stayed empty. The controller cannot derive this locally, but it already aggregates the per-node view that GET /backends renders, so discovery reuses the active BackendManager rather than growing a second path. Three surfaces shared the root cause and route through the same helper now: - GET /backends/available (Installed is now cluster-wide) - GET /api/fine-tuning/backends - GET /api/quantization/backends The response stays a boolean rather than an installed-on-N-of-M count: per-node install state is already served by GET /backends nodes[], and per-node control by POST /api/nodes/:id/backends/install, so a summary is all these dropdowns need. A nil provider (single-node) leaves the local filesystem as the only source and reproduces today's listing exactly, and a registry error degrades to that same listing instead of blanking the catalog. Assisted-by: Claude:claude-opus-4-8 golangci-lint Signed-off-by: Ettore Di Giacinto <mudler@localai.io> Co-authored-by: Ettore Di Giacinto <mudler@localai.io>
44 lines
1.7 KiB
Go
44 lines
1.7 KiB
Go
package routes
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/labstack/echo/v4"
|
|
"github.com/mudler/LocalAI/core/application"
|
|
"github.com/mudler/LocalAI/core/config"
|
|
"github.com/mudler/LocalAI/core/http/endpoints/localai"
|
|
"github.com/mudler/LocalAI/core/services/finetune"
|
|
)
|
|
|
|
// RegisterFineTuningRoutes registers fine-tuning API routes.
|
|
func RegisterFineTuningRoutes(e *echo.Echo, ftService *finetune.FineTuneService, appConfig *config.ApplicationConfig, app *application.Application, fineTuningMw echo.MiddlewareFunc) {
|
|
if ftService == nil {
|
|
return
|
|
}
|
|
|
|
// Service readiness middleware
|
|
readyMw := func(next echo.HandlerFunc) echo.HandlerFunc {
|
|
return func(c echo.Context) error {
|
|
if ftService == nil {
|
|
return c.JSON(http.StatusServiceUnavailable, map[string]string{
|
|
"error": "fine-tuning service is not available",
|
|
})
|
|
}
|
|
return next(c)
|
|
}
|
|
}
|
|
|
|
ft := e.Group("/api/fine-tuning", readyMw, fineTuningMw)
|
|
ft.GET("/backends", localai.ListFineTuneBackendsEndpoint(appConfig, ClusterCapabilityProviderFor(app), ClusterInstalledProviderFor(app)))
|
|
ft.POST("/jobs", localai.StartFineTuneJobEndpoint(ftService))
|
|
ft.GET("/jobs", localai.ListFineTuneJobsEndpoint(ftService))
|
|
ft.GET("/jobs/:id", localai.GetFineTuneJobEndpoint(ftService))
|
|
ft.POST("/jobs/:id/stop", localai.StopFineTuneJobEndpoint(ftService))
|
|
ft.DELETE("/jobs/:id", localai.DeleteFineTuneJobEndpoint(ftService))
|
|
ft.GET("/jobs/:id/progress", localai.FineTuneProgressEndpoint(ftService))
|
|
ft.GET("/jobs/:id/checkpoints", localai.ListCheckpointsEndpoint(ftService))
|
|
ft.POST("/jobs/:id/export", localai.ExportModelEndpoint(ftService))
|
|
ft.GET("/jobs/:id/download", localai.DownloadExportedModelEndpoint(ftService))
|
|
ft.POST("/datasets", localai.UploadDatasetEndpoint(ftService))
|
|
}
|