From a4fe9907d613a6c81fb40491c7f3bfd766c7847f Mon Sep 17 00:00:00 2001 From: abc <98614666+xtekky@users.noreply.github.com> Date: Mon, 28 Aug 2023 21:13:47 +0100 Subject: ~ | v-0.0.2.6 --- g4f/Provider/Bing.py | 50 +++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 25 deletions(-) (limited to 'g4f') diff --git a/g4f/Provider/Bing.py b/g4f/Provider/Bing.py index 5910c6b4..c31ba5a7 100644 --- a/g4f/Provider/Bing.py +++ b/g4f/Provider/Bing.py @@ -15,9 +15,8 @@ class Bing(AsyncGeneratorProvider): def create_async_generator( model: str, messages: list[dict[str, str]], - cookies: dict = None, - **kwargs - ) -> AsyncGenerator: + cookies: dict = None, **kwargs) -> AsyncGenerator: + if not cookies: cookies = get_cookies(".bing.com") if len(messages) < 2: @@ -30,30 +29,31 @@ class Bing(AsyncGeneratorProvider): if cookies: #TODO: Will implement proper cookie retrieval later and use a try-except mechanism in 'stream_generate' instead of defaulting the cookie value like this cookies_dict = { - 'MUID': '', - 'BCP': '', - 'MUIDB': '', - 'USRLOC': '', - 'SRCHD': 'AF=hpcodx', - 'MMCASM': '', - '_UR': '', - 'ANON': '', - 'NAP': '', - 'ABDEF': '', - 'PPLState': '1', + 'MUID' : '', + 'BCP' : '', + 'MUIDB' : '', + 'USRLOC' : '', + 'SRCHD' : 'AF=hpcodx', + 'MMCASM' : '', + '_UR' : '', + 'ANON' : '', + 'NAP' : '', + 'ABDEF' : '', + 'PPLState' : '1', 'KievRPSSecAuth': '', - '_U': '', - 'SUID': '', - '_EDGE_S': '', - 'WLS': '', - '_HPVN': '', - '_SS': '', - '_clck': '', - 'SRCHUSR': '', - '_RwBf': '', - 'SRCHHPGUSR': '', - 'ipv6': '', + '_U' : '', + 'SUID' : '', + '_EDGE_S' : '', + 'WLS' : '', + '_HPVN' : '', + '_SS' : '', + '_clck' : '', + 'SRCHUSR' : '', + '_RwBf' : '', + 'SRCHHPGUSR' : '', + 'ipv6' : '', } + return stream_generate(prompt, context, cookies_dict) def create_context(messages: list[dict[str, str]]): -- cgit v1.2.3