File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed
Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -56,7 +56,6 @@ async def event_stream_generator():
5656 continue
5757 # yield as bytes and flush
5858 yield json .dumps (event ) + "\n "
59- await asyncio .sleep (0.1 ) # Yield control to the event loop
6059 except asyncio .CancelledError :
6160 logger .info (f"Client disconnected, stream cancelled for user { user_id } ." )
6261 except Exception as e :
Original file line number Diff line number Diff line change @@ -14,6 +14,13 @@ server {
1414 # Location block for your chat stream
1515 location /chat/message {
1616 proxy_pass http ://backend_app;
17+ proxy_set_header Host $host ;
18+ proxy_set_header X-Real-IP $remote_addr ;
19+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for ;
20+ proxy_set_header X-Forwarded-Proto $scheme ;
21+
22+ proxy_read_timeout 86400s ; # Prevent timeout during long LLM responses
23+ proxy_send_timeout 86400s ;
1724
1825 # Prevent buffering
1926 proxy_buffering off;
You can’t perform that action at this time.
0 commit comments