diff --git a/llm-proxy.py b/llm-proxy.py index dd67468..f6f24e1 100644 --- a/llm-proxy.py +++ b/llm-proxy.py @@ -659,7 +659,11 @@ class Handler(http.server.BaseHTTPRequestHandler): bytes_out = 0 try: while True: - chunk = resp.read(65536) + # read1(): return as soon as ANY data is available (one underlying read), + # instead of read()'s "block until 64KB or EOF" -- otherwise a small + # streaming response (a few KB of SSE) only flushes at EOF, so reasoning + # + content land in one burst at the end instead of streaming through. + chunk = resp.read1(65536) if not chunk: break self.wfile.write(chunk)