damonbill commited on
Commit
730341a
·
verified ·
1 Parent(s): 9d21f81

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +3 -2
main.py CHANGED
@@ -949,7 +949,8 @@ def abacus_stream_generator(response, model: str, caching_info: Dict[str, Any]):
949
  # Close playground code block if needed
950
  if inside_code_block:
951
  content_buffer += "\n```"
952
- yield f"data: {StreamResponse(id=stream_id, created=created_time, model=model, choices=[StreamChoice(delta={'content': '\n```'})]).json()}\n\n"
 
953
 
954
  # --- New Caching Logic ---
955
  assistant_message = ChatMessage(role="assistant", content=content_buffer,
@@ -965,7 +966,7 @@ def abacus_stream_generator(response, model: str, caching_info: Dict[str, Any]):
965
 
966
  # Send completion signal
967
  log_debug("Sending completion signal")
968
- yield f"data: {StreamResponse(id=stream_id, created=created_time, model=model, choices=[StreamChoice(delta={}, finish_reason='stop')]).json()}\n\n"
969
  yield "data: [DONE]\n\n"
970
 
971
 
 
949
  # Close playground code block if needed
950
  if inside_code_block:
951
  content_buffer += "\n```"
952
+ yield "data: " + StreamResponse(id=stream_id, created=created_time, model=model, choices=[StreamChoice(delta={'content': '\n```\n'})]).json() + "\n\n"
953
+
954
 
955
  # --- New Caching Logic ---
956
  assistant_message = ChatMessage(role="assistant", content=content_buffer,
 
966
 
967
  # Send completion signal
968
  log_debug("Sending completion signal")
969
+ yield "data: " + StreamResponse(id=stream_id, created=created_time, model=model, choices=[StreamChoice(delta={'stop': '\n```\n'})]).json() + "\n\n"
970
  yield "data: [DONE]\n\n"
971
 
972