AnatoliiG commited on
Commit
d3d3b80
·
1 Parent(s): af6affa

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -1
app.py CHANGED
@@ -48,7 +48,15 @@ async def chat_completions(request: Request):
48
  yield f"data: {json.dumps(chunk)}\n\n"
49
  yield "data: [DONE]\n\n"
50
 
51
- return StreamingResponse(iter_content(), media_type="text/event-stream")
 
 
 
 
 
 
 
 
52
 
53
  return JSONResponse(content=output)
54
  except Exception as e:
 
48
  yield f"data: {json.dumps(chunk)}\n\n"
49
  yield "data: [DONE]\n\n"
50
 
51
+ return StreamingResponse(
52
+ iter_content(),
53
+ media_type="text/event-stream",
54
+ headers={
55
+ "Cache-Control": "no-cache",
56
+ "Connection": "keep-alive",
57
+ "X-Accel-Buffering": "no",
58
+ },
59
+ )
60
 
61
  return JSONResponse(content=output)
62
  except Exception as e: