summaryrefslogtreecommitdiff
path: root/bot.go
diff options
context:
space:
mode:
authorGrail Finder <wohilas@gmail.com>2026-03-03 14:26:06 +0300
committerGrail Finder <wohilas@gmail.com>2026-03-03 14:26:06 +0300
commit6b0d03f2d632597a75e63d03a9932d189d354a2b (patch)
treec5c5509e49395b5a571b5c7be38f8077abac7456 /bot.go
parentfb4deb1161cca50d1affea850f842c7683647ecd (diff)
Fix: decompres before notify
Diffstat (limited to 'bot.go')
-rw-r--r--bot.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/bot.go b/bot.go
index 75444e4..60d8f22 100644
--- a/bot.go
+++ b/bot.go
@@ -3,6 +3,7 @@ package main
import (
"bufio"
"bytes"
+ "compress/gzip"
"context"
"encoding/json"
"fmt"
@@ -495,6 +496,17 @@ func monitorModelLoad(modelID string) {
// extractDetailedErrorFromBytes extracts detailed error information from response body bytes
func extractDetailedErrorFromBytes(body []byte, statusCode int) string {
+ // Try to decompress gzip if the response is compressed
+ if len(body) >= 2 && body[0] == 0x1f && body[1] == 0x8b {
+ reader, err := gzip.NewReader(bytes.NewReader(body))
+ if err == nil {
+ decompressed, err := io.ReadAll(reader)
+ reader.Close()
+ if err == nil {
+ body = decompressed
+ }
+ }
+ }
// Try to parse as JSON to extract detailed error information
var errorResponse map[string]any
if err := json.Unmarshal(body, &errorResponse); err == nil {