Update main.py
Browse files
main.py
CHANGED
@@ -202,9 +202,13 @@ async def chat_completions(request: ChatRequest):
|
|
202 |
else:
|
203 |
response_content += chunk.content
|
204 |
|
205 |
-
# Clean up the response to
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
|
|
|
|
|
|
|
|
|
202 |
else:
|
203 |
response_content += chunk.content
|
204 |
|
205 |
+
# Clean up the response to extract the plain text content
|
206 |
+
clean_content = response_content.replace('\\n', '\n').strip()
|
207 |
+
|
208 |
+
return {
|
209 |
+
"id": str(uuid.uuid4()),
|
210 |
+
"object": "chat.completion",
|
211 |
+
"created": int(datetime.now().timestamp()),
|
212 |
+
"model": request.model,
|
213 |
+
"choices": [{"index": 0, "message": {"role": "assistant", "content": clean_content}, "finish_reason": "stop"}]
|
214 |
+
}
|