Fix lint errors

This commit is contained in:
世界
2026-05-13 22:37:05 +08:00
parent 429182a349
commit a47f39fa2b
79 changed files with 219 additions and 667 deletions

View File

@@ -556,8 +556,8 @@ func (s *Service) handleResponseWithTracking(writer http.ResponseWriter, respons
continue
}
if bytes.HasPrefix(line, []byte("data: ")) {
eventData := bytes.TrimPrefix(line, []byte("data: "))
if after, ok0 := bytes.CutPrefix(line, []byte("data: ")); ok0 {
eventData := after
if bytes.Equal(eventData, []byte("[DONE]")) {
continue
}

View File

@@ -851,10 +851,7 @@ func normalizeGPT5Model(model string) string {
func calculateCost(stats UsageStats, model string, serviceTier string, contextWindow int) float64 {
pricing := getPricing(model, serviceTier, contextWindow)
regularInputTokens := stats.InputTokens - stats.CachedTokens
if regularInputTokens < 0 {
regularInputTokens = 0
}
regularInputTokens := max(stats.InputTokens-stats.CachedTokens, 0)
cost := (float64(regularInputTokens)*pricing.InputPrice +
float64(stats.OutputTokens)*pricing.OutputPrice +