mrmadblack commited on
Commit
75b8217
·
verified ·
1 Parent(s): 59bb09c

Update server.py

Browse files
Files changed (1) hide show
  1. server.py +12 -1
server.py CHANGED
@@ -207,7 +207,18 @@ def chat(req: ChatRequest):
207
  if not line:
208
  continue
209
 
210
- data = json.loads(line)
 
 
 
 
 
 
 
 
 
 
 
211
 
212
  token = data.get("content", "")
213
 
 
207
  if not line:
208
  continue
209
 
210
+ line = line.decode("utf-8").strip()
211
+
212
+ if not line:
213
+ continue
214
+
215
+ if line.startswith("data:"):
216
+ line = line[5:].strip()
217
+
218
+ try:
219
+ data = json.loads(line)
220
+ except Exception:
221
+ continue
222
 
223
  token = data.get("content", "")
224