From 96ccb8e96cc7fb6e39e4a285fbd171ec847168d8 Mon Sep 17 00:00:00 2001 From: mudler-agent Date: Sat, 19 Sep 2026 23:39:44 +0200 Subject: [PATCH] fix: correct stale symbol names in doc comments (#12139) Fixes 7 doc comments whose names no longer match their function: - ToggleStateModelEndpoint (was ToggleModelEndpoint) - Messages.ToProto (was MessagesToProto) - NewUserCancellableContext (was newUserCancellableContext) - CalculateRMS16 (was calculateRMS16) - NewLocalAIMetricsService + Shutdown TODO (was copied setupOTelSDK) Supersedes #12084 and #12085 (DCO not signed by contributors). Assisted-by: MAKI:regolo/glm5.2 Signed-off-by: Ettore Di Giacinto Co-authored-by: Ettore Di Giacinto --- core/http/endpoints/localai/toggle_model.go | 2 +- core/schema/message.go | 2 +- core/services/galleryop/service.go | 2 +- core/services/monitoring/metrics.go | 4 ++-- pkg/sound/int16.go | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/core/http/endpoints/localai/toggle_model.go b/core/http/endpoints/localai/toggle_model.go index 8b988c77a..e45c4b3c1 100644 --- a/core/http/endpoints/localai/toggle_model.go +++ b/core/http/endpoints/localai/toggle_model.go @@ -11,7 +11,7 @@ import ( "github.com/mudler/LocalAI/core/services/modeladmin" ) -// ToggleModelEndpoint handles enabling or disabling a model from being loaded on demand. +// ToggleStateModelEndpoint handles enabling or disabling a model from being loaded on demand. // When disabled, the model remains in the collection but will not be loaded when requested. // // @Summary Toggle model enabled/disabled status diff --git a/core/schema/message.go b/core/schema/message.go index 27e5b72aa..1e3f08d3e 100644 --- a/core/schema/message.go +++ b/core/schema/message.go @@ -71,7 +71,7 @@ type FunctionCall struct { type Messages []Message -// MessagesToProto converts schema.Message slice to proto.Message slice +// ToProto converts schema.Message slice to proto.Message slice // It handles content conversion, tool_calls serialization, and optional fields func (messages Messages) ToProto() []*proto.Message { protoMessages := make([]*proto.Message, len(messages)) diff --git a/core/services/galleryop/service.go b/core/services/galleryop/service.go index 2a7410ab3..6d6da5d1e 100644 --- a/core/services/galleryop/service.go +++ b/core/services/galleryop/service.go @@ -522,7 +522,7 @@ func (g *GalleryService) applyCancel(id string, pause bool) { } } -// newUserCancellableContext returns a child context whose CancelFunc cancels +// NewUserCancellableContext returns a child context whose CancelFunc cancels // with the downloader.ErrUserCancelled cause. This lets the download layer // distinguish a deliberate user cancel (discard the half-downloaded .partial) // from an incidental cancellation such as process shutdown (keep the .partial diff --git a/core/services/monitoring/metrics.go b/core/services/monitoring/metrics.go index f9644698e..a5d8d9a06 100644 --- a/core/services/monitoring/metrics.go +++ b/core/services/monitoring/metrics.go @@ -25,7 +25,7 @@ func (m *LocalAIMetricsService) ObserveAPICall(method string, path string, durat m.ApiTimeMetric.Record(context.Background(), duration, opts) } -// setupOTelSDK bootstraps the OpenTelemetry pipeline. +// NewLocalAIMetricsService bootstraps the OpenTelemetry metrics pipeline. // If it does not return an error, make sure to call shutdown for proper cleanup. func NewLocalAIMetricsService() (*LocalAIMetricsService, error) { exporter, err := prometheus.New() @@ -56,7 +56,7 @@ func NewLocalAIMetricsService() (*LocalAIMetricsService, error) { func (lams LocalAIMetricsService) Shutdown() error { // TODO: Not sure how to actually do this: - //// setupOTelSDK bootstraps the OpenTelemetry pipeline. + //// NewLocalAIMetricsService bootstraps the OpenTelemetry metrics pipeline. //// If it does not return an error, make sure to call shutdown for proper cleanup. xlog.Warn("LocalAIMetricsService Shutdown called, but OTelSDK proper shutdown not yet implemented?") diff --git a/pkg/sound/int16.go b/pkg/sound/int16.go index 6acb59b97..ded2308fb 100644 --- a/pkg/sound/int16.go +++ b/pkg/sound/int16.go @@ -13,7 +13,7 @@ Copyright (c) 2024 Xbozon */ -// calculateRMS16 calculates the root mean square of the audio buffer for int16 samples. +// CalculateRMS16 calculates the root mean square of the audio buffer for int16 samples. func CalculateRMS16(buffer []int16) float64 { var sumSquares float64 for _, sample := range buffer {