fix: goimports — strip unused imports from all server files
This commit is contained in:
@@ -1,14 +1,12 @@
|
|||||||
package server
|
package server
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"database/sql"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"gophergate/internal/db"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type UsagePeriodFilter struct {
|
type UsagePeriodFilter struct {
|
||||||
@@ -372,4 +370,3 @@ func (s *Server) handleDetailedUsage(c *gin.Context) {
|
|||||||
|
|
||||||
c.JSON(http.StatusOK, SuccessResponse(results))
|
c.JSON(http.StatusOK, SuccessResponse(results))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,14 +2,13 @@ package server
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"database/sql"
|
"database/sql"
|
||||||
"fmt"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"gophergate/internal/db"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"gophergate/internal/db"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func (s *Server) handleGetClients(c *gin.Context) {
|
func (s *Server) handleGetClients(c *gin.Context) {
|
||||||
@@ -272,4 +271,3 @@ func (s *Server) handleDeleteClientToken(c *gin.Context) {
|
|||||||
|
|
||||||
c.JSON(http.StatusOK, SuccessResponse(gin.H{"message": "Token revoked"}))
|
c.JSON(http.StatusOK, SuccessResponse(gin.H{"message": "Token revoked"}))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,18 +1,14 @@
|
|||||||
package server
|
package server
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"database/sql"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
|
||||||
|
|
||||||
"log/slog"
|
"gophergate/internal/db"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"golang.org/x/crypto/bcrypt"
|
"golang.org/x/crypto/bcrypt"
|
||||||
"gophergate/internal/db"
|
|
||||||
"gophergate/internal/utils"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type ApiResponse struct {
|
type ApiResponse struct {
|
||||||
@@ -166,4 +162,3 @@ func (s *Server) handleLogout(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
c.JSON(http.StatusOK, SuccessResponse(gin.H{"message": "Logged out"}))
|
c.JSON(http.StatusOK, SuccessResponse(gin.H{"message": "Logged out"}))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ func (l *RequestLogger) processLog(entry RequestLog) {
|
|||||||
defer tx.Rollback()
|
defer tx.Rollback()
|
||||||
|
|
||||||
// Ensure client exists
|
// Ensure client exists
|
||||||
_, _ = tx.Exec("INSERT OR IGNORE INTO clients (client_id, name, description) VALUES (?, ?, 'Auto-created from request')",
|
_, _ = tx.Exec("INSERT OR IGNORE INTO clients (client_id, name, description) VALUES (?, ?, 'Auto-created from request')",
|
||||||
entry.ClientID, entry.ClientID)
|
entry.ClientID, entry.ClientID)
|
||||||
|
|
||||||
// Insert log
|
// Insert log
|
||||||
@@ -80,9 +80,9 @@ func (l *RequestLogger) processLog(entry RequestLog) {
|
|||||||
INSERT INTO llm_requests
|
INSERT INTO llm_requests
|
||||||
(timestamp, client_id, provider, model, prompt_tokens, completion_tokens, reasoning_tokens, total_tokens, cache_read_tokens, cache_write_tokens, cost, has_images, status, error_message, duration_ms)
|
(timestamp, client_id, provider, model, prompt_tokens, completion_tokens, reasoning_tokens, total_tokens, cache_read_tokens, cache_write_tokens, cost, has_images, status, error_message, duration_ms)
|
||||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||||
`, entry.Timestamp, entry.ClientID, entry.Provider, entry.Model,
|
`, entry.Timestamp, entry.ClientID, entry.Provider, entry.Model,
|
||||||
entry.PromptTokens, entry.CompletionTokens, entry.ReasoningTokens, entry.TotalTokens,
|
entry.PromptTokens, entry.CompletionTokens, entry.ReasoningTokens, entry.TotalTokens,
|
||||||
entry.CacheReadTokens, entry.CacheWriteTokens, entry.Cost, entry.HasImages,
|
entry.CacheReadTokens, entry.CacheWriteTokens, entry.Cost, entry.HasImages,
|
||||||
entry.Status, entry.ErrorMessage, entry.DurationMS)
|
entry.Status, entry.ErrorMessage, entry.DurationMS)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -3,16 +3,10 @@ package server
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
|
||||||
"time"
|
|
||||||
|
|
||||||
"log/slog"
|
"gophergate/internal/db"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/google/uuid"
|
|
||||||
"gophergate/internal/db"
|
|
||||||
"gophergate/internal/models"
|
|
||||||
"gophergate/internal/utils"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func (s *Server) handleGetModels(c *gin.Context) {
|
func (s *Server) handleGetModels(c *gin.Context) {
|
||||||
@@ -234,4 +228,3 @@ func (s *Server) handleUpdateModel(c *gin.Context) {
|
|||||||
|
|
||||||
c.JSON(http.StatusOK, SuccessResponse(gin.H{"message": "Model updated"}))
|
c.JSON(http.StatusOK, SuccessResponse(gin.H{"message": "Model updated"}))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,17 +1,17 @@
|
|||||||
package server
|
package server
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"database/sql"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"log/slog"
|
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
|
||||||
"gophergate/internal/db"
|
"gophergate/internal/db"
|
||||||
"gophergate/internal/models"
|
"gophergate/internal/models"
|
||||||
"gophergate/internal/utils"
|
"gophergate/internal/utils"
|
||||||
|
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (s *Server) handleGetProviders(c *gin.Context) {
|
func (s *Server) handleGetProviders(c *gin.Context) {
|
||||||
@@ -240,4 +240,3 @@ func (s *Server) handleTestProvider(c *gin.Context) {
|
|||||||
"latency": latency,
|
"latency": latency,
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ import (
|
|||||||
"gophergate/internal/config"
|
"gophergate/internal/config"
|
||||||
"gophergate/internal/db"
|
"gophergate/internal/db"
|
||||||
"gophergate/internal/middleware"
|
"gophergate/internal/middleware"
|
||||||
"log/slog"
|
|
||||||
"gophergate/internal/models"
|
"gophergate/internal/models"
|
||||||
"gophergate/internal/providers"
|
"gophergate/internal/providers"
|
||||||
"gophergate/internal/utils"
|
"gophergate/internal/utils"
|
||||||
|
|||||||
@@ -4,14 +4,11 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"log/slog"
|
"gophergate/internal/db"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"gophergate/internal/db"
|
|
||||||
"gophergate/internal/utils"
|
|
||||||
|
|
||||||
"github.com/shirou/gopsutil/v3/cpu"
|
"github.com/shirou/gopsutil/v3/cpu"
|
||||||
"github.com/shirou/gopsutil/v3/disk"
|
"github.com/shirou/gopsutil/v3/disk"
|
||||||
|
|||||||
@@ -1,14 +1,12 @@
|
|||||||
package server
|
package server
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
|
||||||
"time"
|
"gophergate/internal/db"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"golang.org/x/crypto/bcrypt"
|
"golang.org/x/crypto/bcrypt"
|
||||||
"gophergate/internal/db"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func (s *Server) handleGetUsers(c *gin.Context) {
|
func (s *Server) handleGetUsers(c *gin.Context) {
|
||||||
@@ -109,4 +107,3 @@ func (s *Server) handleDeleteUser(c *gin.Context) {
|
|||||||
|
|
||||||
c.JSON(http.StatusOK, SuccessResponse(gin.H{"message": "User deleted"}))
|
c.JSON(http.StatusOK, SuccessResponse(gin.H{"message": "User deleted"}))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user