summaryrefslogtreecommitdiffstats
path: root/g4f
diff options
context:
space:
mode:
Diffstat (limited to 'g4f')
-rw-r--r--g4f/Provider/Providers/Bing.py25
1 files changed, 13 insertions, 12 deletions
diff --git a/g4f/Provider/Providers/Bing.py b/g4f/Provider/Providers/Bing.py
index 1d33cda5..2ec2cf05 100644
--- a/g4f/Provider/Providers/Bing.py
+++ b/g4f/Provider/Providers/Bing.py
@@ -304,19 +304,20 @@ async def stream_generate(prompt: str, mode: optionsSets.optionSet = optionsSets
await session.close()
-def run(generator):
- loop = asyncio.get_event_loop()
- gen = generator.__aiter__()
+def run(generator):
+ loop = asyncio.new_event_loop()
+ asyncio.set_event_loop(loop)
+ gen = generator.__aiter__()
+
+ while True:
+ try:
+ next_val = loop.run_until_complete(gen.__anext__())
+ yield next_val
+
+ except StopAsyncIteration:
+ break
+ #print('Done')
- while True:
- try:
- next_val = loop.run_until_complete(gen.__anext__())
- yield next_val
-
- except StopAsyncIteration:
- break
-
- #print('Done')
def convert(messages):