Skip to content
Snippets Groups Projects
Unverified Commit c981eb14 authored by Huu Le (Lee)'s avatar Huu Le (Lee) Committed by GitHub
Browse files

Fix escaping double quotes in vercel_response.py (#68)

parent c094b0c6
No related branches found
No related tags found
No related merge requests found
......@@ -13,9 +13,9 @@ class VercelStreamResponse(StreamingResponse):
@classmethod
def convert_text(cls, token: str):
# Escape newlines to avoid breaking the stream
token = token.replace("\n", "\\n")
return f'{cls.TEXT_PREFIX}"{token}"\n'
# Escape newlines and double quotes to avoid breaking the stream
token = json.dumps(token)
return f"{cls.TEXT_PREFIX}{token}\n"
@classmethod
def convert_data(cls, data: dict):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment