Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -146,7 +146,7 @@ async def yield_openai_chunks(response: httpx.Response):
|
|
146 |
buffer = buffer[index + 1:]
|
147 |
|
148 |
if content.startswith("0:"):
|
149 |
-
content = content[2:].
|
150 |
data = {"id":"123456-456789-123456","object":"chat.completion.chunk","choices":[{"delta":{"content":content},"index":0,"finish_reason":None}]}
|
151 |
yield "data: " + json.dumps(data) + "\n\n"
|
152 |
else:
|
|
|
146 |
buffer = buffer[index + 1:]
|
147 |
|
148 |
if content.startswith("0:"):
|
149 |
+
content = content[2:][1:-1].replace("\\n","\n").replace('\\"','"').replace("\\\\","\\")
|
150 |
data = {"id":"123456-456789-123456","object":"chat.completion.chunk","choices":[{"delta":{"content":content},"index":0,"finish_reason":None}]}
|
151 |
yield "data: " + json.dumps(data) + "\n\n"
|
152 |
else:
|