fix: reuse stream scanner buffer in channel handlers (#5225)

This commit is contained in:
xujiantop-crypto
2026-06-05 12:18:57 +08:00
committed by GitHub
parent 01c2128e23
commit 32805849d6
9 changed files with 38 additions and 12 deletions
+1 -1
View File
@@ -30,7 +30,7 @@ func convertCf2CompletionsRequest(textRequest dto.GeneralOpenAIRequest) *CfReque
}
func cfStreamHandler(c *gin.Context, info *relaycommon.RelayInfo, resp *http.Response) (*types.NewAPIError, *dto.Usage) {
scanner := bufio.NewScanner(resp.Body)
scanner := helper.NewStreamScanner(resp.Body)
scanner.Split(bufio.ScanLines)
helper.SetEventStreamHeaders(c)