mirror of
https://github.com/xtekky/gpt4free.git
synced 2024-09-12 00:29:27 -04:00
Fix imports in Bing
This commit is contained in:
parent
5ca47b44b2
commit
7a9b719573
@ -1,7 +1,10 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from aiohttp import ClientSession
|
||||
from ..typing import Any, AsyncGenerator, Union
|
||||
import random
|
||||
import json
|
||||
import os
|
||||
from aiohttp import ClientSession, ClientTimeout
|
||||
from ..typing import AsyncGenerator
|
||||
from .base_provider import AsyncGeneratorProvider, get_cookies
|
||||
|
||||
|
||||
@ -225,7 +228,7 @@ async def stream_generate(
|
||||
cookies: dict=None
|
||||
):
|
||||
async with ClientSession(
|
||||
timeout=aiohttp.ClientTimeout(total=900),
|
||||
timeout=ClientTimeout(total=900),
|
||||
cookies=cookies,
|
||||
headers=Defaults.headers,
|
||||
) as session:
|
||||
@ -277,16 +280,4 @@ async def stream_generate(
|
||||
final = True
|
||||
break
|
||||
finally:
|
||||
await delete_conversation(session, conversation)
|
||||
|
||||
def run(generator: AsyncGenerator[Union[Any, str], Any]):
|
||||
loop = asyncio.get_event_loop()
|
||||
gen = generator.__aiter__()
|
||||
|
||||
while True:
|
||||
try:
|
||||
yield loop.run_until_complete(gen.__anext__())
|
||||
|
||||
except StopAsyncIteration:
|
||||
break
|
||||
|
||||
await delete_conversation(session, conversation)
|
@ -39,6 +39,7 @@ def main():
|
||||
def get_providers() -> list[type[BaseProvider]]:
|
||||
provider_names = dir(Provider)
|
||||
ignore_names = [
|
||||
"annotations",
|
||||
"base_provider",
|
||||
"BaseProvider",
|
||||
"AsyncProvider",
|
||||
|
Loading…
Reference in New Issue
Block a user