summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBagus Indrayana <bagusindrayanaindo@gmail.com>2023-08-24 12:13:20 +0200
committerBagus Indrayana <bagusindrayanaindo@gmail.com>2023-08-24 12:13:20 +0200
commite56f9b7c0dee64eec3843da1fd68f2d0c90b875d (patch)
tree513be26d7ad67ce873240a54b884cbdeca0a160c
parent ~ | Merge pull request #829 (diff)
downloadgpt4free-e56f9b7c0dee64eec3843da1fd68f2d0c90b875d.tar
gpt4free-e56f9b7c0dee64eec3843da1fd68f2d0c90b875d.tar.gz
gpt4free-e56f9b7c0dee64eec3843da1fd68f2d0c90b875d.tar.bz2
gpt4free-e56f9b7c0dee64eec3843da1fd68f2d0c90b875d.tar.lz
gpt4free-e56f9b7c0dee64eec3843da1fd68f2d0c90b875d.tar.xz
gpt4free-e56f9b7c0dee64eec3843da1fd68f2d0c90b875d.tar.zst
gpt4free-e56f9b7c0dee64eec3843da1fd68f2d0c90b875d.zip
Diffstat (limited to '')
-rw-r--r--g4f/Provider/EasyChat.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/g4f/Provider/EasyChat.py b/g4f/Provider/EasyChat.py
index 2a61346c..3c6562f0 100644
--- a/g4f/Provider/EasyChat.py
+++ b/g4f/Provider/EasyChat.py
@@ -75,16 +75,18 @@ class EasyChat(BaseProvider):
if "choices" in json_data:
yield json_data["choices"][0]["message"]["content"]
else:
- yield Exception("No response from server")
+ raise Exception("No response from server")
else:
for chunk in response.iter_lines():
if b"content" in chunk:
- splitData = chunk.decode().split("data: ")
+ splitData = chunk.decode().split("data:")
if len(splitData) > 1:
yield json.loads(splitData[1])["choices"][0]["delta"]["content"]
+ else:
+ continue
else:
- yield Exception(f"Error {response.status_code} from server")
+ raise Exception(f"Error {response.status_code} from server : {response.reason}")
@classmethod