summaryrefslogtreecommitdiffstats
path: root/g4f/Provider
diff options
context:
space:
mode:
authorxtekky <98614666+xtekky@users.noreply.github.com>2023-08-07 13:23:42 +0200
committerGitHub <noreply@github.com>2023-08-07 13:23:42 +0200
commit6a34a83cdf2b64260b20c8119e10711517bc4f80 (patch)
tree6938ffae092ea1be3fdde2d2b5fc1a99dc03d77b /g4f/Provider
parentMerge pull request #790 from VastV2/Ails-Update (diff)
parentFix: There is no current event loop in thread. (diff)
downloadgpt4free-6a34a83cdf2b64260b20c8119e10711517bc4f80.tar
gpt4free-6a34a83cdf2b64260b20c8119e10711517bc4f80.tar.gz
gpt4free-6a34a83cdf2b64260b20c8119e10711517bc4f80.tar.bz2
gpt4free-6a34a83cdf2b64260b20c8119e10711517bc4f80.tar.lz
gpt4free-6a34a83cdf2b64260b20c8119e10711517bc4f80.tar.xz
gpt4free-6a34a83cdf2b64260b20c8119e10711517bc4f80.tar.zst
gpt4free-6a34a83cdf2b64260b20c8119e10711517bc4f80.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 94c1e21a..5e290f91 100644
--- a/g4f/Provider/Providers/Bing.py
+++ b/g4f/Provider/Providers/Bing.py
@@ -305,19 +305,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):