diff options
author | foxfire52 <foxfire52@virgilio.it> | 2024-11-15 07:38:51 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-15 07:38:51 +0100 |
commit | f38428ab23a1ec1f6ee22b976189d7e9da9b9167 (patch) | |
tree | d1f0ab8b2f849a8162e2a1430910d0b41d300de5 /g4f/gui/server/api.py | |
parent | Merge pull request #2331 from NoelisTired/main (diff) | |
download | gpt4free-f38428ab23a1ec1f6ee22b976189d7e9da9b9167.tar gpt4free-f38428ab23a1ec1f6ee22b976189d7e9da9b9167.tar.gz gpt4free-f38428ab23a1ec1f6ee22b976189d7e9da9b9167.tar.bz2 gpt4free-f38428ab23a1ec1f6ee22b976189d7e9da9b9167.tar.lz gpt4free-f38428ab23a1ec1f6ee22b976189d7e9da9b9167.tar.xz gpt4free-f38428ab23a1ec1f6ee22b976189d7e9da9b9167.tar.zst gpt4free-f38428ab23a1ec1f6ee22b976189d7e9da9b9167.zip |
Diffstat (limited to '')
-rw-r--r-- | g4f/gui/server/api.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/g4f/gui/server/api.py b/g4f/gui/server/api.py index 7aac650a..dafcb5d4 100644 --- a/g4f/gui/server/api.py +++ b/g4f/gui/server/api.py @@ -19,6 +19,8 @@ from g4f.Provider import ProviderType, __providers__, __map__ from g4f.providers.base_provider import ProviderModelMixin, FinishReason from g4f.providers.conversation import BaseConversation +logger = logging.getLogger(__name__) + # Define the directory for generated images images_dir = "./generated_images" @@ -155,7 +157,7 @@ class Api: conversations[provider][conversation_id] = chunk yield self._format_json("conversation", conversation_id) elif isinstance(chunk, Exception): - logging.exception(chunk) + logger.exception(chunk) yield self._format_json("message", get_error_message(chunk)) elif isinstance(chunk, ImagePreview): yield self._format_json("preview", chunk.to_string()) @@ -165,7 +167,7 @@ class Api: elif not isinstance(chunk, FinishReason): yield self._format_json("content", str(chunk)) except Exception as e: - logging.exception(e) + logger.exception(e) yield self._format_json('error', get_error_message(e)) async def _copy_images(self, images: list[str], cookies: Optional[Cookies] = None): |