diff options
author | Heiner Lohaus <hlohaus@users.noreply.github.com> | 2024-01-14 16:18:46 +0100 |
---|---|---|
committer | Heiner Lohaus <hlohaus@users.noreply.github.com> | 2024-01-14 16:18:46 +0100 |
commit | 0c40490a5b430da6272cc47cf5ff9dab17de1ee6 (patch) | |
tree | 98959dd21460dbf910ba6454d1aada10248b5b1c | |
parent | Fix missing distutils, install setuptools (diff) | |
download | gpt4free-0c40490a5b430da6272cc47cf5ff9dab17de1ee6.tar gpt4free-0c40490a5b430da6272cc47cf5ff9dab17de1ee6.tar.gz gpt4free-0c40490a5b430da6272cc47cf5ff9dab17de1ee6.tar.bz2 gpt4free-0c40490a5b430da6272cc47cf5ff9dab17de1ee6.tar.lz gpt4free-0c40490a5b430da6272cc47cf5ff9dab17de1ee6.tar.xz gpt4free-0c40490a5b430da6272cc47cf5ff9dab17de1ee6.tar.zst gpt4free-0c40490a5b430da6272cc47cf5ff9dab17de1ee6.zip |
-rw-r--r-- | etc/unittest/main.py | 1 | ||||
-rw-r--r-- | g4f/gui/server/backend.py | 7 |
2 files changed, 7 insertions, 1 deletions
diff --git a/etc/unittest/main.py b/etc/unittest/main.py index 61f4ffda..4b92a6a6 100644 --- a/etc/unittest/main.py +++ b/etc/unittest/main.py @@ -11,6 +11,7 @@ from g4f.gui.server.backend import Backend_Api, get_error_message from g4f.base_provider import BaseProvider g4f.debug.logging = False +g4f.debug.version_check = False class MockProvider(BaseProvider): working = True diff --git a/g4f/gui/server/backend.py b/g4f/gui/server/backend.py index 4a5cafa8..b4c8f56c 100644 --- a/g4f/gui/server/backend.py +++ b/g4f/gui/server/backend.py @@ -5,6 +5,7 @@ from typing import Generator from g4f import debug, version, models from g4f import _all_models, get_last_provider, ChatCompletion from g4f.image import is_allowed_extension, to_image +from g4f.errors import VersionNotFoundError from g4f.Provider import __providers__ from g4f.Provider.bing.create_images import patch_provider from .internet import get_search_message @@ -91,8 +92,12 @@ class Backend_Api: Returns: dict: A dictionary containing the current and latest version. """ + try: + current_version = version.utils.current_version + except VersionNotFoundError: + current_version = None return { - "version": version.utils.current_version, + "version": current_version, "latest_version": version.get_latest_version(), } |