ParthSadaria commited on
Commit
32a3c2c
·
verified ·
1 Parent(s): 921b0bd

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +2 -2
main.py CHANGED
@@ -66,10 +66,10 @@ def generate_search(query: str, stream: bool = True) -> str:
66
  if value.startswith("data: "):
67
  try:
68
  json_modified_value = json.loads(value[6:]) # Remove 'data: ' prefix
69
- content = json_modified_value.get("choices", [{}])[0].get("delta", {}).get("content", "")
70
  # Include everything, even if it's just whitespace
71
  if stream:
72
- yield f"data: {json.dumps({'response': content})}\n\n"
73
  streaming_text += content
74
  except json.JSONDecodeError:
75
  continue # Skip lines that are not valid JSON
 
66
  if value.startswith("data: "):
67
  try:
68
  json_modified_value = json.loads(value[6:]) # Remove 'data: ' prefix
69
+ content = json_modified_value
70
  # Include everything, even if it's just whitespace
71
  if stream:
72
+ yield f"data: {content}\n"
73
  streaming_text += content
74
  except json.JSONDecodeError:
75
  continue # Skip lines that are not valid JSON