HI. i have a python api that is sending data to a reactjs frontend. the issue that I am facing is that after I generate content with gpt, I am unable send the full data. the only parts that are sending are the first lines.
ie;
generated data:
Hey bro,
Just wanted to let you know that Mom is planning a family gathering next month. It's going to be at her place on the 15th at 5pm. Make sure to mark your calendar!
Looking forward to catching up with everyone.
Best,
[Your Name]```
sent data:
```Subject: Update on upcoming family gathering ```
the code that sends the data is as follows:
```py
@app.route('/api/stream-results/<model>', methods=['GET'])
def stream_results(model):
def generate():
while not streaming_results[model]:
time.sleep(1)
s = f"data: {streaming_results[model]}\n\n"
print(s)
return s
return Response(generate(), mimetype='text/event-stream')```
when i print s, it shows the propper and expected result, whereas when the frontend receives data, only the first line is received.
if you need frontend code please lmk im happy to provide.