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

XFEstudio/gpt4free

Update async.py

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

代码差异

1 个文件 +2 -8
Modified g4f/client/async.py +2 -8
@@ -13,7 +13,7 @@ from ..typing import Union, Iterator, Messages, ImageType, AsyncIerator
13 13 from ..image import ImageResponse as ImageProviderResponse
14 14 from ..errors import NoImageResponseError, RateLimitError, MissingAuthError
15 15 from .. import get_model_and_provider, get_last_provider
16 from .helper import read_json
16 from .helper import read_json, find_stop
17 17
18 18 from .Provider.BingCreateImages import BingCreateImages
19 19 from .Provider.needs_auth import Gemini, OpenaiChat
@@ -30,7 +30,7 @@ async def iter_response(
30 30 finish_reason = None
31 31 completion_id = ''.join(random.choices(string.ascii_letters + string.digits, k=28))
32 32 count: int = 0
33 async for idx, chunk in response:
33 async for chunk in response:
34 34 if isinstance(chunk, FinishReason):
35 35 finish_reason = chunk.reason
36 36 break
@@ -71,12 +71,6 @@ class Client(BaseClient):
71 71 self.chat: Chat = Chat(self, provider)
72 72 self.images: Images = Images(self, image_provider)
73 73
74 def filter_none(**kwargs):
75 for key in list(kwargs.keys()):
76 if kwargs[key] is None:
77 del kwargs[key]
78 return kwargs
79
80 74 class Completions():
81 75 def __init__(self, client: Client, provider: ProviderType = None):
82 76 self.client: Client = client