Update main.py
Browse files
main.py
CHANGED
@@ -218,7 +218,9 @@ async def chat_completions(request: ChatRequest):
|
|
218 |
async def generate():
|
219 |
async for chunk in async_generator:
|
220 |
if isinstance(chunk, ImageResponse):
|
221 |
-
|
|
|
|
|
222 |
else:
|
223 |
yield f"data: {json.dumps(create_response(chunk, request.model))}\n\n"
|
224 |
yield "data: [DONE]\n\n"
|
@@ -228,7 +230,8 @@ async def chat_completions(request: ChatRequest):
|
|
228 |
response_content = ""
|
229 |
async for chunk in async_generator:
|
230 |
if isinstance(chunk, ImageResponse):
|
231 |
-
|
|
|
232 |
else:
|
233 |
response_content += chunk # Concatenate text responses
|
234 |
|
|
|
218 |
async def generate():
|
219 |
async for chunk in async_generator:
|
220 |
if isinstance(chunk, ImageResponse):
|
221 |
+
# Format the response as a Markdown image
|
222 |
+
image_markdown = f""
|
223 |
+
yield f"data: {json.dumps(create_response(image_markdown, request.model))}\n\n"
|
224 |
else:
|
225 |
yield f"data: {json.dumps(create_response(chunk, request.model))}\n\n"
|
226 |
yield "data: [DONE]\n\n"
|
|
|
230 |
response_content = ""
|
231 |
async for chunk in async_generator:
|
232 |
if isinstance(chunk, ImageResponse):
|
233 |
+
# Add Markdown image to the response
|
234 |
+
response_content += f"\n"
|
235 |
else:
|
236 |
response_content += chunk # Concatenate text responses
|
237 |
|