From 19346ba9bae9d4c63acc41b36d198a6b50246e29 Mon Sep 17 00:00:00 2001 From: hs_junxiang Date: Thu, 12 Oct 2023 10:53:30 +0800 Subject: Fix: GptGo json.decoder.JSONDecodeError --- g4f/Provider/GptGo.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'g4f/Provider') diff --git a/g4f/Provider/GptGo.py b/g4f/Provider/GptGo.py index f9b94a5c..255c0ca9 100644 --- a/g4f/Provider/GptGo.py +++ b/g4f/Provider/GptGo.py @@ -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 -- cgit v1.2.3