Niansuh commited on
Commit
7425798
·
verified ·
1 Parent(s): 38264bf

Update api/utils.py

Browse files
Files changed (1) hide show
  1. api/utils.py +1 -3
api/utils.py CHANGED
@@ -37,8 +37,6 @@ def message_to_dict(message):
37
  def create_chat_completion_data(
38
  content: str, model: str, timestamp: int, finish_reason: Optional[str] = None
39
  ) -> Dict[str, Any]:
40
- # Remove extra blank lines
41
- cleaned_content = '\n'.join([line.rstrip() for line in content.splitlines() if line.strip() != ''])
42
  return {
43
  "id": f"chatcmpl-{uuid.uuid4()}",
44
  "object": "chat.completion.chunk",
@@ -47,7 +45,7 @@ def create_chat_completion_data(
47
  "choices": [
48
  {
49
  "index": 0,
50
- "delta": {"content": cleaned_content, "role": "assistant"},
51
  "finish_reason": finish_reason,
52
  }
53
  ],
 
37
  def create_chat_completion_data(
38
  content: str, model: str, timestamp: int, finish_reason: Optional[str] = None
39
  ) -> Dict[str, Any]:
 
 
40
  return {
41
  "id": f"chatcmpl-{uuid.uuid4()}",
42
  "object": "chat.completion.chunk",
 
45
  "choices": [
46
  {
47
  "index": 0,
48
+ "delta": {"content": content, "role": "assistant"},
49
  "finish_reason": finish_reason,
50
  }
51
  ],