Update api/utils.py
Browse files- api/utils.py +2 -2
api/utils.py
CHANGED
|
@@ -127,9 +127,9 @@ async def process_streaming_response(request: ChatRequest):
|
|
| 127 |
# Yield cleaned chunk as part of the stream
|
| 128 |
yield f"data: {json.dumps(create_chat_completion_data(cleaned_content, request.model, timestamp))}\n\n"
|
| 129 |
|
| 130 |
-
# Append advertisement as a separate chunk
|
| 131 |
if ADVERTISEMENT_TEXT and not advertisement_added:
|
| 132 |
-
advertisement_with_line_break = "\n" + ADVERTISEMENT_TEXT
|
| 133 |
yield f"data: {json.dumps(create_chat_completion_data(advertisement_with_line_break, request.model, timestamp))}\n\n"
|
| 134 |
advertisement_added = True
|
| 135 |
|
|
|
|
| 127 |
# Yield cleaned chunk as part of the stream
|
| 128 |
yield f"data: {json.dumps(create_chat_completion_data(cleaned_content, request.model, timestamp))}\n\n"
|
| 129 |
|
| 130 |
+
# Append markdown separator and advertisement as a separate chunk
|
| 131 |
if ADVERTISEMENT_TEXT and not advertisement_added:
|
| 132 |
+
advertisement_with_line_break = "\n---\n" + ADVERTISEMENT_TEXT # Add the markdown horizontal rule
|
| 133 |
yield f"data: {json.dumps(create_chat_completion_data(advertisement_with_line_break, request.model, timestamp))}\n\n"
|
| 134 |
advertisement_added = True
|
| 135 |
|