Update api/utils.py
Browse files- 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":
|
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 |
],
|