summaryrefslogtreecommitdiffstats
path: root/g4f/Provider
diff options
context:
space:
mode:
authorRamon Victor Cardoso <ramonvc19@gmail.com>2023-06-27 18:30:18 +0200
committerRamon Victor Cardoso <ramonvc19@gmail.com>2023-06-27 18:30:18 +0200
commitf89fa7517654523024fe2eaed29d32b9f4189d79 (patch)
tree8b155ab82bc5f72a1539f06a7bd0b7a18c732a6a /g4f/Provider
parentMerge pull request #684 from ostix360/main (diff)
downloadgpt4free-f89fa7517654523024fe2eaed29d32b9f4189d79.tar
gpt4free-f89fa7517654523024fe2eaed29d32b9f4189d79.tar.gz
gpt4free-f89fa7517654523024fe2eaed29d32b9f4189d79.tar.bz2
gpt4free-f89fa7517654523024fe2eaed29d32b9f4189d79.tar.lz
gpt4free-f89fa7517654523024fe2eaed29d32b9f4189d79.tar.xz
gpt4free-f89fa7517654523024fe2eaed29d32b9f4189d79.tar.zst
gpt4free-f89fa7517654523024fe2eaed29d32b9f4189d79.zip
Diffstat (limited to '')
-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):