summaryrefslogtreecommitdiffstats
path: root/g4f/Provider/GptForLove.py
diff options
context:
space:
mode:
authorTekky <98614666+xtekky@users.noreply.github.com>2023-10-08 14:21:21 +0200
committerGitHub <noreply@github.com>2023-10-08 14:21:21 +0200
commitd804b20694c8ffc88355adee610d1424a1df1263 (patch)
tree9750cb102284d9445d60c539f4e6d3586603e917 /g4f/Provider/GptForLove.py
parent~ | `v-0.1.5.5` (diff)
parentAdd Messages and AsyncResult typing (diff)
downloadgpt4free-d804b20694c8ffc88355adee610d1424a1df1263.tar
gpt4free-d804b20694c8ffc88355adee610d1424a1df1263.tar.gz
gpt4free-d804b20694c8ffc88355adee610d1424a1df1263.tar.bz2
gpt4free-d804b20694c8ffc88355adee610d1424a1df1263.tar.lz
gpt4free-d804b20694c8ffc88355adee610d1424a1df1263.tar.xz
gpt4free-d804b20694c8ffc88355adee610d1424a1df1263.tar.zst
gpt4free-d804b20694c8ffc88355adee610d1424a1df1263.zip
Diffstat (limited to 'g4f/Provider/GptForLove.py')
-rw-r--r--g4f/Provider/GptForLove.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/g4f/Provider/GptForLove.py b/g4f/Provider/GptForLove.py
index 18a42e85..53c403e1 100644
--- a/g4f/Provider/GptForLove.py
+++ b/g4f/Provider/GptForLove.py
@@ -50,7 +50,10 @@ class GptForLove(AsyncGeneratorProvider):
async with session.post("https://api.gptplus.one/chat-process", json=data) as response:
response.raise_for_status()
async for line in response.content:
- line = json.loads(line)
+ try:
+ line = json.loads(line)
+ except:
+ raise RuntimeError(f"Broken line: {line}")
if "detail" in line:
content = line["detail"]["choices"][0]["delta"].get("content")
if content: