fix(openai_compat): avoid predeclared identifier in preview

This commit is contained in:
amagi 2026-03-04 23:57:26 +08:00
parent 4946a8b449
commit a305c0a479

View file

@ -230,15 +230,15 @@ func looksLikeHTML(body []byte, contentType string) bool {
strings.HasPrefix(trimmed, "<body") strings.HasPrefix(trimmed, "<body")
} }
func responsePreview(body []byte, max int) string { func responsePreview(body []byte, maxLen int) string {
preview := strings.TrimSpace(string(body)) preview := strings.TrimSpace(string(body))
if preview == "" { if preview == "" {
return "<empty>" return "<empty>"
} }
if len(preview) <= max { if len(preview) <= maxLen {
return preview return preview
} }
return preview[:max] + "..." return preview[:maxLen] + "..."
} }
func parseResponse(body []byte) (*LLMResponse, error) { func parseResponse(body []byte) (*LLMResponse, error) {