diff options
author | razrab <razrab@PimoLin> | 2023-10-23 07:25:46 +0200 |
---|---|---|
committer | razrab <razrab@PimoLin> | 2023-10-23 07:25:46 +0200 |
commit | 2b3bc749b39b0c6f3e8921b9e3b2fc52263c568c (patch) | |
tree | 7de51129865bd786bdf7b21fa658725a474a8cd8 /g4f/Provider/FreeGpt.py | |
parent | Added code to ignore certain providers in the API (diff) | |
parent | ~ | g4f `v-0.1.7.5` (diff) | |
download | gpt4free-2b3bc749b39b0c6f3e8921b9e3b2fc52263c568c.tar gpt4free-2b3bc749b39b0c6f3e8921b9e3b2fc52263c568c.tar.gz gpt4free-2b3bc749b39b0c6f3e8921b9e3b2fc52263c568c.tar.bz2 gpt4free-2b3bc749b39b0c6f3e8921b9e3b2fc52263c568c.tar.lz gpt4free-2b3bc749b39b0c6f3e8921b9e3b2fc52263c568c.tar.xz gpt4free-2b3bc749b39b0c6f3e8921b9e3b2fc52263c568c.tar.zst gpt4free-2b3bc749b39b0c6f3e8921b9e3b2fc52263c568c.zip |
Diffstat (limited to 'g4f/Provider/FreeGpt.py')
-rw-r--r-- | g4f/Provider/FreeGpt.py | 5 |
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 |