Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

fix(channel): add limit check to qqbot response (#21859)

cielf1a2fa5dacbb
diff --git a/internal/channels/qqbot.go b/internal/channels/qqbot.go
index e0c60edfb8..4370f869a0 100644
--- a/internal/channels/qqbot.go
+++ b/internal/channels/qqbot.go
@@ -497,12 +497,12 @@ func (c *qqBotChannel) requestJSON(
return err
}
defer resp.Body.Close()
- payload, err := io.ReadAll(resp.Body)
+ payload, err := io.ReadAll(io.LimitReader(resp.Body, 1024*1024))
if err != nil {
return err
}
if resp.StatusCode >= http.StatusBadRequest {
- return fmt.Errorf("status: %d, response: %s", resp.StatusCode, payload)
+ return fmt.Errorf("status: %d, response: %.200s", resp.StatusCode, payload)
}
if len(bytes.TrimSpace(payload)) == 0 {
return nil