~ | Merge pull request #1053 from Lin-jun-xiang/fix_GptGo

Fix: GptGo json.decoder.JSONDecodeError
This commit is contained in:
Tekky 2023-10-12 14:26:48 +01:00 committed by GitHub
commit 2ea62781fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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