summaryrefslogtreecommitdiffstats
path: root/g4f/providers/base_provider.py
diff options
context:
space:
mode:
authorRyuk <88324835+anonymousx97@users.noreply.github.com>2024-05-20 06:23:37 +0200
committerGitHub <noreply@github.com>2024-05-20 06:23:37 +0200
commit567b39c3301776cca9241ecef8913f38c26bb9c5 (patch)
tree6045d120938bb86e22b4e7abef756e7ab492e487 /g4f/providers/base_provider.py
parentMerge pull request #1984 from hlohaus/leech (diff)
downloadgpt4free-567b39c3301776cca9241ecef8913f38c26bb9c5.tar
gpt4free-567b39c3301776cca9241ecef8913f38c26bb9c5.tar.gz
gpt4free-567b39c3301776cca9241ecef8913f38c26bb9c5.tar.bz2
gpt4free-567b39c3301776cca9241ecef8913f38c26bb9c5.tar.lz
gpt4free-567b39c3301776cca9241ecef8913f38c26bb9c5.tar.xz
gpt4free-567b39c3301776cca9241ecef8913f38c26bb9c5.tar.zst
gpt4free-567b39c3301776cca9241ecef8913f38c26bb9c5.zip
Diffstat (limited to '')
-rw-r--r--g4f/providers/base_provider.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/g4f/providers/base_provider.py b/g4f/providers/base_provider.py
index 5624c9e1..d6c24387 100644
--- a/g4f/providers/base_provider.py
+++ b/g4f/providers/base_provider.py
@@ -30,6 +30,13 @@ if sys.platform == 'win32':
def get_running_loop(check_nested: bool) -> Union[AbstractEventLoop, None]:
try:
loop = asyncio.get_running_loop()
+ # Do not patch uvloop loop because its incompatible.
+ try:
+ import uvloop
+ if isinstance(loop, uvloop.Loop):
+ return
+ except (ImportError, ModuleNotFoundError):
+ pass
if check_nested and not hasattr(loop.__class__, "_nest_patched"):
try:
import nest_asyncio
@@ -290,4 +297,4 @@ class ProviderModelMixin:
elif model not in cls.get_models() and cls.models:
raise ModelNotSupportedError(f"Model is not supported: {model} in: {cls.__name__}")
debug.last_model = model
- return model \ No newline at end of file
+ return model