From f1683c8db83cee5805a6e103fca2c2551aae5086 Mon Sep 17 00:00:00 2001 From: kqlio67 Date: Sat, 31 Aug 2024 09:47:39 +0300 Subject: Comprehensive Updates and Enhancements Across Multiple Providers --- g4f/Provider/LiteIcoding.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'g4f/Provider/LiteIcoding.py') diff --git a/g4f/Provider/LiteIcoding.py b/g4f/Provider/LiteIcoding.py index ad04aceb..69294a57 100644 --- a/g4f/Provider/LiteIcoding.py +++ b/g4f/Provider/LiteIcoding.py @@ -1,6 +1,7 @@ from __future__ import annotations from aiohttp import ClientSession, ClientResponseError +import re from ..typing import AsyncResult, Messages from .base_provider import AsyncGeneratorProvider, ProviderModelMixin from .helper import format_prompt @@ -31,7 +32,7 @@ class LiteIcoding(AsyncGeneratorProvider, ProviderModelMixin): headers = { "Accept": "*/*", "Accept-Language": "en-US,en;q=0.9", - "Authorization": "Bearer b3b2712cf83640a5acfdc01e78369930", + "Authorization": "Bearer aa3020ee873e40cb8b3f515a0708ebc4", "Connection": "keep-alive", "Content-Type": "application/json;charset=utf-8", "DNT": "1", @@ -97,7 +98,11 @@ class LiteIcoding(AsyncGeneratorProvider, ProviderModelMixin): .replace('\\"', '"') .strip() ) - yield full_response.strip() + # Add filter to remove unwanted text + filtered_response = re.sub(r'\n---\n.*', '', full_response, flags=re.DOTALL) + # Remove extra quotes at the beginning and end + cleaned_response = filtered_response.strip().strip('"') + yield cleaned_response except ClientResponseError as e: raise RuntimeError( -- cgit v1.2.3