sunheycho commited on
Commit
7fb5af7
Β·
1 Parent(s): f51f445

Fix SSE message format causing frontend parsing issues

Browse files

- Remove double wrapping of message objects in SSE stream
- Send message objects directly instead of wrapping in {'message': msg}
- Should fix white screen issue after analysis completion
- Frontend can now properly receive and display final results

Files changed (1) hide show
  1. api.py +2 -1
api.py CHANGED
@@ -1130,7 +1130,8 @@ def stream_product_comparison(session_id):
1130
  print(f"[DEBUG] πŸ“€ Sending {len(new_messages)} new messages")
1131
  for msg in new_messages:
1132
  print(f"[DEBUG] πŸ“¨ Message: {msg}")
1133
- yield f"data: {json.dumps({'message': msg})}\n\n"
 
1134
  last_message_index = len(messages)
1135
 
1136
  # Send current status
 
1130
  print(f"[DEBUG] πŸ“€ Sending {len(new_messages)} new messages")
1131
  for msg in new_messages:
1132
  print(f"[DEBUG] πŸ“¨ Message: {msg}")
1133
+ # msg is already a dict with message, agent, timestamp
1134
+ yield f"data: {json.dumps(msg)}\n\n"
1135
  last_message_index = len(messages)
1136
 
1137
  # Send current status