summaryrefslogtreecommitdiffstats
path: root/g4f/Provider
diff options
context:
space:
mode:
authorH Lohaus <hlohaus@users.noreply.github.com>2024-04-07 00:07:58 +0200
committerGitHub <noreply@github.com>2024-04-07 00:07:58 +0200
commit802cf1ce21ebf90d46c6b8f2916e327b7bc2c9fc (patch)
treefd1ff1b06885a4fbe5fe2696b9ae1f599355138a /g4f/Provider
parentUpdate Liaobots.py (diff)
downloadgpt4free-802cf1ce21ebf90d46c6b8f2916e327b7bc2c9fc.tar
gpt4free-802cf1ce21ebf90d46c6b8f2916e327b7bc2c9fc.tar.gz
gpt4free-802cf1ce21ebf90d46c6b8f2916e327b7bc2c9fc.tar.bz2
gpt4free-802cf1ce21ebf90d46c6b8f2916e327b7bc2c9fc.tar.lz
gpt4free-802cf1ce21ebf90d46c6b8f2916e327b7bc2c9fc.tar.xz
gpt4free-802cf1ce21ebf90d46c6b8f2916e327b7bc2c9fc.tar.zst
gpt4free-802cf1ce21ebf90d46c6b8f2916e327b7bc2c9fc.zip
Diffstat (limited to 'g4f/Provider')
-rw-r--r--g4f/Provider/Llama2.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/g4f/Provider/Llama2.py b/g4f/Provider/Llama2.py
index 6a94eea1..04b5aee0 100644
--- a/g4f/Provider/Llama2.py
+++ b/g4f/Provider/Llama2.py
@@ -3,6 +3,7 @@ from __future__ import annotations
from aiohttp import ClientSession
from ..typing import AsyncResult, Messages
+from ..requests.raise_for_status import raise_for_status
from .base_provider import AsyncGeneratorProvider, ProviderModelMixin
@@ -67,8 +68,10 @@ class Llama2(AsyncGeneratorProvider, ProviderModelMixin):
}
started = False
async with session.post(f"{cls.url}/api", json=data, proxy=proxy) as response:
- response.raise_for_status()
+ await raise_for_status(response)
async for chunk in response.content.iter_any():
+ if not chunk:
+ continue
if not started:
chunk = chunk.lstrip()
started = True