mirror of
https://github.com/xtekky/gpt4free.git
synced 2024-09-11 16:55:41 +03:00
Update base_provider: Do not nest patch uvloop loop.
This commit is contained in:
parent
5115cf0e23
commit
567b39c330
@ -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
|
||||
return model
|
||||
|
Loading…
Reference in New Issue
Block a user