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

XFEstudio/gpt4free

Update types.py

c9a83e53
H Lohaus <hlohaus@users.noreply.github.com>
提交于

代码差异

1 个文件 +12 -3
Modified g4f/client/types.py +12 -3
@@ -5,7 +5,18 @@ ImageProvider = Union[BaseProvider, object]
5 5 Proxies = Union[dict, str]
6 6 IterResponse = Iterator[Union[ChatCompletion, ChatCompletionChunk]]
7 7
8 class Client():
8 class ClientProxyMixin():
9 def get_proxy(self) -> Union[str, None]:
10 if isinstance(self.proxies, str):
11 return self.proxies
12 elif self.proxies is None:
13 return os.environ.get("G4F_PROXY")
14 elif "all" in self.proxies:
15 return self.proxies["all"]
16 elif "https" in self.proxies:
17 return self.proxies["https"]
18
19 class Client(ClientProxyMixin):
9 20 def __init__(
10 21 self,
11 22 api_key: str = None,
@@ -16,5 +27,3 @@ class Client():
16 27 ) -> None:
17 28 self.api_key: str = api_key
18 29 self.proxies: Proxies = proxies
19 self.chat: Chat = Chat(self, provider)
20 self.images: Images = Images(self, image_provider)