Fix imports in Bing

This commit is contained in:
Heiner Lohaus 2023-09-05 17:35:51 +02:00
parent 5ca47b44b2
commit 7a9b719573
2 changed files with 8 additions and 16 deletions

View File

@ -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)

View File

@ -39,6 +39,7 @@ def main():
def get_providers() -> list[type[BaseProvider]]:
provider_names = dir(Provider)
ignore_names = [
"annotations",
"base_provider",
"BaseProvider",
"AsyncProvider",