Fix: GptGo json.decoder.JSONDecodeError

This commit is contained in:
hs_junxiang 2023-10-12 10:53:30 +08:00
parent 4829f3bfec
commit 19346ba9ba
1 changed files with 2 additions and 0 deletions

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