From 47b50b4827121ec68d9e52a018b631a4a3f09625 Mon Sep 17 00:00:00 2001 From: Heiner Lohaus Date: Sat, 27 Jan 2024 02:00:44 +0100 Subject: Fix PerplexityLabs Provider, Improve bypass_cloudflare helper --- g4f/Provider/Aura.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'g4f/Provider/Aura.py') diff --git a/g4f/Provider/Aura.py b/g4f/Provider/Aura.py index 06887425..126c8d0f 100644 --- a/g4f/Provider/Aura.py +++ b/g4f/Provider/Aura.py @@ -1,5 +1,7 @@ from __future__ import annotations + from aiohttp import ClientSession + from ..typing import AsyncResult, Messages from .base_provider import AsyncGeneratorProvider @@ -23,7 +25,7 @@ class Aura(AsyncGeneratorProvider): "Content-Type": "application/json", "Origin": f"{cls.url}", "Referer": f"{cls.url}/", - "Sec-Ch-Ua": '"Not_A Brand";v="8", "Chromium";v="120", "Google Chrome";v="120"', + "Sec-Ch-Ua": '"Not_A Brand";v="8", "Chromium";v="120", "Google Chrome";v="120"', "Sec-Ch-Ua-Mobile": "?0", "Sec-Ch-Ua-Platform": '"Linux"', "Sec-Fetch-Dest": "empty", @@ -52,5 +54,6 @@ class Aura(AsyncGeneratorProvider): "temperature": 0.5 } async with session.post(f"{cls.url}/api/chat", json=data, proxy=proxy) as response: + response.raise_for_status() async for chunk in response.content.iter_any(): yield chunk.decode() \ No newline at end of file -- cgit v1.2.3