XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet
公开
关注 0 Fork 0 Star 1
返回提交历史

XFEstudio/gpt4free

Fix using pa providers

73289791
hlohaus <983577+hlohaus@users.noreply.github.com>
提交于

代码差异

2 个文件 +8 -5
Modified g4f/Provider/__init__.py +7 -4
@@ -607,15 +607,18 @@ class ProviderUtils:
607 607 # Check explicit map
608 608 try:
609 609 return ProviderLoader.from_name(label)
610 except AttributeError:
610 except ImportError:
611 611 pass
612 612
613 613 # Fallback to search
614 614 for provider_name in ProviderLoader.names:
615 615 if provider_name.lower().startswith(label.lower()):
616 provider = ProviderLoader.from_name(provider_name)
617 if provider.working:
618 return provider
616 try:
617 provider = ProviderLoader.from_name(provider_name)
618 if provider.working:
619 return provider
620 except ImportError:
621 pass
619 622
620 623 raise ValueError(f"Provider with label '{label}' not found")
621 624
Modified g4f/mcp/pa_provider.py +1 -1
@@ -1204,7 +1204,7 @@ def load_pa_provider(file_path: "str | Path") -> Optional[Type]:
1204 1204 raise ValueError(f"File must have .pa.py extension: {file_path}")
1205 1205
1206 1206 code = file_path.read_text(encoding="utf-8")
1207 result = execute_safe_code(code, file_path=file_path, timeout=0.1, max_depth=100)
1207 result = execute_safe_code(code, file_path=file_path, timeout=1, max_depth=100)
1208 1208
1209 1209 if not result.success:
1210 1210 raise RuntimeError(