Spaces:
Running
Running
Wimmboo commited on
Commit ·
aae924a
1
Parent(s): bc1a768
fix(streaming): decompress upstream chunks for Google SSE
Browse filesGoogle sends gzip-compressed SSE streams; aiter_raw() passed raw bytes
through, causing Janitor AI to see binary garbage and fail with
'Failed to fetch'. Switch to aiter_bytes() so httpx decompresses
on the fly before yielding chunks.
- proxy/client.py +1 -1
proxy/client.py
CHANGED
|
@@ -78,7 +78,7 @@ async def _stream_response(provider: Provider, real_key: str, body: dict[str, An
|
|
| 78 |
content = await upstream.aread()
|
| 79 |
detail = _upstream_error_message(upstream.status_code, content)
|
| 80 |
raise HTTPException(status_code=upstream.status_code, detail=detail)
|
| 81 |
-
async for chunk in upstream.
|
| 82 |
yield chunk
|
| 83 |
|
| 84 |
|
|
|
|
| 78 |
content = await upstream.aread()
|
| 79 |
detail = _upstream_error_message(upstream.status_code, content)
|
| 80 |
raise HTTPException(status_code=upstream.status_code, detail=detail)
|
| 81 |
+
async for chunk in upstream.aiter_bytes():
|
| 82 |
yield chunk
|
| 83 |
|
| 84 |
|