summaryrefslogtreecommitdiffstats
path: root/g4f/Provider/FreeGpt.py
diff options
context:
space:
mode:
authorHeiner Lohaus <heiner@lohaus.eu>2023-10-22 15:15:43 +0200
committerHeiner Lohaus <heiner@lohaus.eu>2023-10-22 15:15:43 +0200
commit78f93bb737bc72c7a47dabe71adbc5b0349c8072 (patch)
tree7de64b02f0e32861c00555db27316cea95ebafc9 /g4f/Provider/FreeGpt.py
parentImprove readme (diff)
downloadgpt4free-78f93bb737bc72c7a47dabe71adbc5b0349c8072.tar
gpt4free-78f93bb737bc72c7a47dabe71adbc5b0349c8072.tar.gz
gpt4free-78f93bb737bc72c7a47dabe71adbc5b0349c8072.tar.bz2
gpt4free-78f93bb737bc72c7a47dabe71adbc5b0349c8072.tar.lz
gpt4free-78f93bb737bc72c7a47dabe71adbc5b0349c8072.tar.xz
gpt4free-78f93bb737bc72c7a47dabe71adbc5b0349c8072.tar.zst
gpt4free-78f93bb737bc72c7a47dabe71adbc5b0349c8072.zip
Diffstat (limited to '')
-rw-r--r--g4f/Provider/FreeGpt.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/g4f/Provider/FreeGpt.py b/g4f/Provider/FreeGpt.py
index 6638b67f..a6d31644 100644
--- a/g4f/Provider/FreeGpt.py
+++ b/g4f/Provider/FreeGpt.py
@@ -41,7 +41,10 @@ class FreeGpt(AsyncGeneratorProvider):
async with session.post(f"{url}/api/generate", json=data) as response:
response.raise_for_status()
async for chunk in response.iter_content():
- yield chunk.decode()
+ chunk = chunk.decode()
+ if chunk == "当前地区当日额度已消耗完":
+ raise RuntimeError("Rate limit reached")
+ yield chunk
@classmethod
@property