diff options
Diffstat (limited to 'g4f/Provider')
-rw-r--r-- | g4f/Provider/Ai4Chat.py | 3 | ||||
-rw-r--r-- | g4f/Provider/Mhystical.py | 6 | ||||
-rw-r--r-- | g4f/Provider/you/har_file.py | 8 |
3 files changed, 10 insertions, 7 deletions
diff --git a/g4f/Provider/Ai4Chat.py b/g4f/Provider/Ai4Chat.py index 1096279d..9fd9c619 100644 --- a/g4f/Provider/Ai4Chat.py +++ b/g4f/Provider/Ai4Chat.py @@ -9,6 +9,7 @@ from ..typing import AsyncResult, Messages from .base_provider import AsyncGeneratorProvider, ProviderModelMixin from .helper import format_prompt +logger = logging.getLogger(__name__) class Ai4Chat(AsyncGeneratorProvider, ProviderModelMixin): label = "AI4Chat" @@ -84,5 +85,5 @@ class Ai4Chat(AsyncGeneratorProvider, ProviderModelMixin): yield clean_message except Exception as e: - logging.exception("Error while calling AI 4Chat API: %s", e) + logger.exception("Error while calling AI 4Chat API: %s", e) yield f"Error: {e}" diff --git a/g4f/Provider/Mhystical.py b/g4f/Provider/Mhystical.py index 44b32604..2aa98ebc 100644 --- a/g4f/Provider/Mhystical.py +++ b/g4f/Provider/Mhystical.py @@ -18,6 +18,8 @@ from .helper import format_prompt """ +logger = logging.getLogger(__name__) + class Mhystical(AsyncGeneratorProvider, ProviderModelMixin): url = "https://api.mhystical.cc" api_endpoint = "https://api.mhystical.cc/v1/completions" @@ -84,5 +86,5 @@ class Mhystical(AsyncGeneratorProvider, ProviderModelMixin): message_content = json_response["choices"][0]["message"]["content"] return message_content except (KeyError, IndexError, json.JSONDecodeError) as e: - logging.error("Error parsing response: %s", e) - return "Error: Failed to parse response from API."
\ No newline at end of file + logger.error("Error parsing response: %s", e) + return "Error: Failed to parse response from API." diff --git a/g4f/Provider/you/har_file.py b/g4f/Provider/you/har_file.py index 71d741fd..40bf3882 100644 --- a/g4f/Provider/you/har_file.py +++ b/g4f/Provider/you/har_file.py @@ -11,7 +11,7 @@ from ...cookies import get_cookies_dir from ...errors import MissingRequirementsError from ... import debug -logging.basicConfig(level=logging.ERROR) +logger = logging.getLogger(__name__) class NoValidHarFileError(Exception): ... @@ -81,14 +81,14 @@ async def get_telemetry_ids(proxy: str = None) -> list: return [await create_telemetry_id(proxy)] except NoValidHarFileError as e: if debug.logging: - logging.error(e) + logger.error(e) try: from nodriver import start except ImportError: raise MissingRequirementsError('Add .har file from you.com or install "nodriver" package | pip install -U nodriver') if debug.logging: - logging.error('Getting telemetry_id for you.com with nodriver') + logger.error('Getting telemetry_id for you.com with nodriver') browser = page = None try: @@ -112,4 +112,4 @@ async def get_telemetry_ids(proxy: str = None) -> list: await browser.stop() except Exception as e: if debug.logging: - logging.error(e) + logger.error(e) |