Skip to content

Commit

Permalink
Fix WSS connect error
Browse files Browse the repository at this point in the history
  • Loading branch information
NijikaMyWaifu authored Jul 13, 2023
1 parent 6646e87 commit d6470d1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
3 changes: 2 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 447,8 @@ async def stream_output():
locale=self.config.get('locale'),
proxy=proxy if proxy != "" else None,
image_url=self.visual_search_url,
wss_url='wss://' self.config.get('wss_domain') '/sydney/ChatHub'
wss_url='wss://' self.config.get('wss_domain') '/sydney/ChatHub',
cookies=cookies,
)) as agen:
async for response in agen:
# print(response)
Expand Down
9 changes: 7 additions & 2 deletions sydney.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,10 251,15 @@ async def ask_stream(
locale: str = "zh-CN",
proxy=_PROXY,
image_url=None,
wss_url='wss://sydney.bing.com/sydney/ChatHub'
wss_url='wss://sydney.bing.com/sydney/ChatHub',
cookies: list[dict] | None = None,
):
timeout = aiohttp.ClientTimeout(total=900)
async with aiohttp.ClientSession(timeout=timeout) as session:
formatted_cookies = {}
if cookies:
for cookie in cookies:
formatted_cookies[cookie["name"]] = cookie["value"]
async with aiohttp.ClientSession(timeout=timeout, cookies=formatted_cookies) as session:
conversation_id = conversation["conversationId"]
client_id = conversation["clientId"]
conversation_signature = conversation["conversationSignature"]
Expand Down

0 comments on commit d6470d1

Please sign in to comment.