fix(openai_compat): avoid predeclared identifier in preview
This commit is contained in:
parent
4946a8b449
commit
a305c0a479
1 changed files with 3 additions and 3 deletions
|
|
@ -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) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue