Fix: GptGo json.decoder.JSONDecodeError

This commit is contained in:
hs_junxiang 2023-10-12 10:53:30 +08:00
parent 4829f3bfec
commit 19346ba9ba

View File

@ -60,6 +60,8 @@ class GptGo(AsyncGeneratorProvider):
if line.startswith("data: [DONE]"):
break
line = json.loads(line[len(start):-1])
if line["choices"][0]["finish_reason"] == "stop":
break
content = line["choices"][0]["delta"].get("content")
if content:
yield content