From b2631af65e3528a4bdec93e27feb99b402d914b0 Mon Sep 17 00:00:00 2001 From: abc <98614666+xtekky@users.noreply.github.com> Date: Sun, 14 May 2023 22:45:43 +0100 Subject: [PATCH] fixes --- g4f/Providers/Ails.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/g4f/Providers/Ails.py b/g4f/Providers/Ails.py index d968ca8..d6f8b67 100644 --- a/g4f/Providers/Ails.py +++ b/g4f/Providers/Ails.py @@ -21,10 +21,10 @@ class Utils: base_string: str = '%s:%s:%s:%s' % ( json_data['t'], json_data['m'], - secretKey.decode(), + 'OVbi[TPN{S#)c{36%9?g;usl)CL', len(json_data['m']) ) - + return hashlib.sha256(base_string.encode()).hexdigest() def format_timestamp(timestamp: int) -> str: @@ -38,11 +38,20 @@ class Utils: def _create_completion(model: str,messages: list, temperature: float = 0.6, stream: bool = False): headers = { 'authority': 'api.caipacity.com', - 'authorization': f'Bearer free', + 'accept': '*/*', + 'authorization': 'Bearer free', 'client-id': str(uuid.uuid4()), + 'client-v': '0.1.26', 'content-type': 'application/json', 'origin': 'https://ai.ls', - 'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36' + 'referer': 'https://ai.ls/', + 'sec-ch-ua': '"Google Chrome";v="113", "Chromium";v="113", "Not-A.Brand";v="24"', + 'sec-ch-ua-mobile': '?0', + 'sec-ch-ua-platform': '"macOS"', + 'sec-fetch-dest': 'empty', + 'sec-fetch-mode': 'cors', + 'sec-fetch-site': 'cross-site', + 'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36', } timestamp = Utils.format_timestamp(int(time.time() * 1000))