fix: health and stats

This commit is contained in:
tbphp
2025-07-15 21:44:51 +08:00
parent 06525f3857
commit 98d436d0f8
3 changed files with 11 additions and 28 deletions

View File

@@ -6,11 +6,11 @@ import (
"strings"
"time"
"gpt-load/internal/response"
"gpt-load/internal/types"
"gpt-load/internal/channel"
"gpt-load/internal/services"
app_errors "gpt-load/internal/errors"
"gpt-load/internal/response"
"gpt-load/internal/services"
"gpt-load/internal/types"
"github.com/gin-gonic/gin"
"github.com/sirupsen/logrus"
@@ -124,7 +124,7 @@ func Auth(
return func(c *gin.Context) {
path := c.Request.URL.Path
// Skip authentication for health/stats endpoints
// Skip authentication for health endpoints
if isMonitoringEndpoint(path) {
c.Next()
return
@@ -223,7 +223,7 @@ func ErrorHandler() gin.HandlerFunc {
// isMonitoringEndpoint checks if the path is a monitoring endpoint
func isMonitoringEndpoint(path string) bool {
monitoringPaths := []string{"/health", "/stats"}
monitoringPaths := []string{"/health"}
for _, monitoringPath := range monitoringPaths {
if path == monitoringPath {
return true