Unverified Commit 53825eb0 authored by Wesley Liddick's avatar Wesley Liddick Committed by GitHub
Browse files

Merge pull request #903 from touwaeriol/fix/openai-responses-sse-max-line-size-v2

fix: use shared max_line_size config for OpenAI Responses SSE scanner
parents 1a7f4951 bcaae2eb
......@@ -279,7 +279,11 @@ func (s *OpenAIGatewayService) handleAnthropicBufferedStreamingResponse(
requestID := resp.Header.Get("x-request-id")
scanner := bufio.NewScanner(resp.Body)
scanner.Buffer(make([]byte, 0, 64*1024), 1024*1024)
maxLineSize := defaultMaxLineSize
if s.cfg != nil && s.cfg.Gateway.MaxLineSize > 0 {
maxLineSize = s.cfg.Gateway.MaxLineSize
}
scanner.Buffer(make([]byte, 0, 64*1024), maxLineSize)
var finalResponse *apicompat.ResponsesResponse
var usage OpenAIUsage
......@@ -378,7 +382,11 @@ func (s *OpenAIGatewayService) handleAnthropicStreamingResponse(
firstChunk := true
scanner := bufio.NewScanner(resp.Body)
scanner.Buffer(make([]byte, 0, 64*1024), 1024*1024)
maxLineSize := defaultMaxLineSize
if s.cfg != nil && s.cfg.Gateway.MaxLineSize > 0 {
maxLineSize = s.cfg.Gateway.MaxLineSize
}
scanner.Buffer(make([]byte, 0, 64*1024), maxLineSize)
// resultWithUsage builds the final result snapshot.
resultWithUsage := func() *OpenAIForwardResult {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment