Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -143,9 +143,11 @@ async def proxy_openai_api(request: Request):
|
|
| 143 |
headers_to_forward = {k: v for k, v in headers.items() if k.lower() not in {'content-length', 'content-encoding', 'alt-svc'}}
|
| 144 |
|
| 145 |
async def combined_generator():
|
| 146 |
-
|
|
|
|
| 147 |
async for chunk in response_generator:
|
| 148 |
-
|
|
|
|
| 149 |
|
| 150 |
return OverrideStreamResponse(combined_generator(), headers=headers_to_forward)
|
| 151 |
except StopAsyncIteration:
|
|
|
|
| 143 |
headers_to_forward = {k: v for k, v in headers.items() if k.lower() not in {'content-length', 'content-encoding', 'alt-svc'}}
|
| 144 |
|
| 145 |
async def combined_generator():
|
| 146 |
+
if first_chunk.strip():
|
| 147 |
+
yield first_chunk.strip()
|
| 148 |
async for chunk in response_generator:
|
| 149 |
+
if chunk.strip():
|
| 150 |
+
yield chunk.strip()
|
| 151 |
|
| 152 |
return OverrideStreamResponse(combined_generator(), headers=headers_to_forward)
|
| 153 |
except StopAsyncIteration:
|