summaryrefslogtreecommitdiffstats
path: root/g4f/Provider/Bing.py
diff options
context:
space:
mode:
authorHeiner Lohaus <hlohaus@users.noreply.github.com>2024-05-05 23:38:31 +0200
committerHeiner Lohaus <hlohaus@users.noreply.github.com>2024-05-05 23:38:31 +0200
commit8fcf618bbe164e6c6f3e0df5e6c9809f35a50e6c (patch)
treed956ccf9116d4f4db0157c5025dcfbb2a4804487 /g4f/Provider/Bing.py
parentAdd AppConfig class, update readme (diff)
downloadgpt4free-8fcf618bbe164e6c6f3e0df5e6c9809f35a50e6c.tar
gpt4free-8fcf618bbe164e6c6f3e0df5e6c9809f35a50e6c.tar.gz
gpt4free-8fcf618bbe164e6c6f3e0df5e6c9809f35a50e6c.tar.bz2
gpt4free-8fcf618bbe164e6c6f3e0df5e6c9809f35a50e6c.tar.lz
gpt4free-8fcf618bbe164e6c6f3e0df5e6c9809f35a50e6c.tar.xz
gpt4free-8fcf618bbe164e6c6f3e0df5e6c9809f35a50e6c.tar.zst
gpt4free-8fcf618bbe164e6c6f3e0df5e6c9809f35a50e6c.zip
Diffstat (limited to 'g4f/Provider/Bing.py')
-rw-r--r--g4f/Provider/Bing.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/g4f/Provider/Bing.py b/g4f/Provider/Bing.py
index a9eb78e6..7e64a617 100644
--- a/g4f/Provider/Bing.py
+++ b/g4f/Provider/Bing.py
@@ -457,10 +457,13 @@ async def stream_generate(
returned_text = ''
message_id = None
while do_read:
- msg = await wss.receive_str()
+ try:
+ msg = await wss.receive_str()
+ except TypeError:
+ continue
objects = msg.split(Defaults.delimiter)
for obj in objects:
- if obj is None or not obj:
+ if not obj:
continue
try:
response = json.loads(obj)