Merge pull request #29 from qistchan/fix-#1982

fix: resolve "bufio.Scanner: token too long" error by increasing buff…
This commit is contained in:
Laisky.Cai 2025-02-25 09:21:39 +08:00 committed by GitHub
commit c2a0318e7b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -29,6 +29,8 @@ func StreamHandler(c *gin.Context, resp *http.Response, relayMode int) (*model.E
responseText := "" responseText := ""
reasoningText := "" reasoningText := ""
scanner := bufio.NewScanner(resp.Body) scanner := bufio.NewScanner(resp.Body)
buffer := make([]byte, 256*1024)
scanner.Buffer(buffer, len(buffer))
scanner.Split(bufio.ScanLines) scanner.Split(bufio.ScanLines)
var usage *model.Usage var usage *model.Usage