Closed xnny closed 1 year ago
Hey. What is exactly the fix about? I'm trying my own "edgegpt" in JS, and I also meet this error. Sorry for off-topic
Ok, when trying to connect to WebSocket (wss://sydney.bing.com/sydney/ChatHub), if no cookie is passed, an error is reported.
Hey. What is exactly the fix about? I'm trying my own "edgegpt" in JS, and I also meet this error. Sorry for off-topic
Ok, when trying to connect to WebSocket (wss://sydney.bing.com/sydney/ChatHub), if no cookie is passed, an error is reported.
I mean, on local it's working fine for me, but production server fails with error 200 (it's like Microsoft banned public hosting services' IP addresses). It was working earlier with same cookies, so that's why I'm asking
I still have this error when I am running the script on a server. No error on my local computer. I am using the same proxy in both case and no cookies.
It does work for me
It does work for me
You are using a Linux server ? Also, I am not using cookies.
This modification is useful to resolve certain asyncio.exceptions.TimeoutError
errors in the
I still have this error when I am running the script on a server. No error on my local computer. I am using the same proxy in both case and no cookies.
+1 me too
I still have this error when I am running the script on a server. No error on my local computer. I am using the same proxy in both case and no cookies.
+1 me too
Worker return exception: Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/websockets/legacy/client.py", line 662, in __await_impl__ await protocol.handshake( File "/usr/local/lib/python3.9/site-packages/websockets/legacy/client.py", line 329, in handshake raise InvalidStatusCode(status_code, response_headers) websockets.exceptions.InvalidStatusCode: server rejected WebSocket connection: HTTP 200
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/websockets/legacy/client.py", line 655, in await_impl_timeout return await self.await_impl() File "/usr/local/lib/python3.9/site-packages/websockets/legacy/client.py", line 676, in await_impl await protocol.wait_closed() asyncio.exceptions.CancelledError
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run result = self.fn(*self.args, **self.kwargs) File "/home/WeCom-ChatGPT/chatgpt-on-wechat/channel/chat_channel.py", line 152, in _handle reply, context = self._generate_reply(context) File "/home/WeCom-ChatGPT/chatgpt-on-wechat/channel/chat_channel.py", line 172, in _generate_reply reply = super().build_reply_content(context.content, context) File "/home/WeCom-ChatGPT/chatgpt-on-wechat/channel/channel.py", line 38, in build_reply_content return Bridge().fetch_reply_content(query, context) File "/home/WeCom-ChatGPT/chatgpt-on-wechat/bridge/bridge.py", line 65, in fetch_reply_content return self.get_bot("chat").reply(query, context) File "/home/WeCom-ChatGPT/chatgpt-on-wechat/bot/bing/new_bing_bot.py", line 57, in reply answer = asyncio.run(task) File "/usr/local/lib/python3.9/asyncio/runners.py", line 44, in run return loop.run_until_complete(main) File "/usr/local/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete return future.result() File "/home/WeCom-ChatGPT/chatgpt-on-wechat/bot/bing/jailbroken_sydney.py", line 104, in ask async for final, response in self.ask_stream( File "/home/WeCom-ChatGPT/chatgpt-on-wechat/bot/bing/jailbroken_sydney.py", line 84, in ask_stream async for final, response in self.chat_hub.ask_stream( File "/home/WeCom-ChatGPT/chatgpt-on-wechat/bot/bing/jailbroken_sydney.py", line 172, in ask_stream async for item in super().ask_stream(prompt=prompt, conversation_style=conversation_style, wss_link=wss_link): File "/usr/local/lib/python3.9/site-packages/EdgeGPT/chathub.py", line 111, in ask_stream async with connect( File "/usr/local/lib/python3.9/site-packages/websockets/legacy/client.py", line 637, in aenter return await self File "/usr/local/lib/python3.9/site-packages/websockets/legacy/client.py", line 655, in await_impl_timeout return await self.await_impl__() File "/usr/local/lib/python3.9/site-packages/websockets/legacy/async_timeout.py", line 169, in aexit__ self._do_exit(exc_type) File "/usr/local/lib/python3.9/site-packages/websockets/legacy/async_timeout.py", line 252, in _do_exit raise asyncio.TimeoutError asyncio.exceptions.TimeoutError
chathub.py: req_header = HEADERS if self.cookies is not None: ws_cookies = [] for cookie in self.cookies: ws_cookies.append(f"{cookie['name']}={cookie['value']}") req_header.update({ 'Cookie': ';'.join(ws_cookies), })
# Check if websocket is closed
async with connect(
wss_link or "wss://sydney.bing.com/sydney/ChatHub",
extra_headers=req_header,
max_size=None,
ssl=ssl_context,
ping_interval=None,
) as wss:
await self._initial_handshake(wss)
Hey. What is exactly the fix about? I'm trying my own "edgegpt" in JS, and I also meet this error. Sorry for off-topic