Merge pull request #25 from yuanzhanghu/main

fixed json parsing error for ping result in stream
This commit is contained in:
LanQian 2024-04-28 03:29:39 +08:00 committed by GitHub
commit 2e79b88b81
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -103,7 +103,7 @@ async def stream_response(service, response, model, max_tokens):
try:
if chunk.startswith("data: [DONE]"):
yield "data: [DONE]\n\n"
elif not chunk.startswith("data: "):
elif not chunk.startswith("data: {"):
continue
else:
chunk_old_data = json.loads(chunk[6:])