EdgeGPT icon indicating copy to clipboard operation
EdgeGPT copied to clipboard

[Bug]: websockets.exceptions.InvalidStatusCode: server rejected WebSocket connection: HTTP 200

Open IsBigLin opened this issue 1 year ago • 0 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues and checked the recent builds/commits

What happened?

拷贝rm文档中例子,运行报错,求高人指点。 开启proxy代理后,详细报错如下 File "/Users/naiqing.lnq/source/aigc/tmg-aigc/langchian-start/newbing/test.py", line 18, in asyncio.run(main()) File "/Users/naiqing.lnq/anaconda3/envs/edgeChat/lib/python3.11/asyncio/runners.py", line 190, in run return runner.run(main) ^^^^^^^^^^^^^^^^ File "/Users/naiqing.lnq/anaconda3/envs/edgeChat/lib/python3.11/asyncio/runners.py", line 118, in run return self._loop.run_until_complete(task) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/naiqing.lnq/anaconda3/envs/edgeChat/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete return future.result() ^^^^^^^^^^^^^^^ File "/Users/naiqing.lnq/source/aigc/tmg-aigc/langchian-start/newbing/test.py", line 12, in main response = await bot.ask(prompt="Hello world", conversation_style=ConversationStyle.creative) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/naiqing.lnq/anaconda3/envs/edgeChat/lib/python3.11/site-packages/EdgeGPT/EdgeGPT.py", line 116, in ask async for final, response in self.chat_hub.ask_stream( File "/Users/naiqing.lnq/anaconda3/envs/edgeChat/lib/python3.11/site-packages/EdgeGPT/chathub.py", line 102, in ask_stream async with connect( File "/Users/naiqing.lnq/anaconda3/envs/edgeChat/lib/python3.11/site-packages/websockets/legacy/client.py", line 637, in aenter return await self ^^^^^^^^^^ File "/Users/naiqing.lnq/anaconda3/envs/edgeChat/lib/python3.11/site-packages/websockets/legacy/client.py", line 655, in await_impl_timeout return await self.await_impl() ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/naiqing.lnq/anaconda3/envs/edgeChat/lib/python3.11/site-packages/websockets/legacy/client.py", line 662, in await_impl await protocol.handshake( File "/Users/naiqing.lnq/anaconda3/envs/edgeChat/lib/python3.11/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

Steps to reproduce the problem

  1. Go to ....
  2. Press ....
  3. ...

What should have happened?

image

Version where the problem happens

0.12.1 版本

What Python version are you running this with?

3.11.4

What is your operating system ?

MacOS

Command Line Arguments

File "/Users/naiqing.lnq/source/aigc/tmg-aigc/langchian-start/newbing/test.py", line 18, in <module>
    asyncio.run(main())
  File "/Users/naiqing.lnq/anaconda3/envs/edgeChat/lib/python3.11/asyncio/runners.py", line 190, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/Users/naiqing.lnq/anaconda3/envs/edgeChat/lib/python3.11/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/naiqing.lnq/anaconda3/envs/edgeChat/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/Users/naiqing.lnq/source/aigc/tmg-aigc/langchian-start/newbing/test.py", line 12, in main
    response = await bot.ask(prompt="Hello world", conversation_style=ConversationStyle.creative)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/naiqing.lnq/anaconda3/envs/edgeChat/lib/python3.11/site-packages/EdgeGPT/EdgeGPT.py", line 116, in ask
    async for final, response in self.chat_hub.ask_stream(
  File "/Users/naiqing.lnq/anaconda3/envs/edgeChat/lib/python3.11/site-packages/EdgeGPT/chathub.py", line 102, in ask_stream
    async with connect(
  File "/Users/naiqing.lnq/anaconda3/envs/edgeChat/lib/python3.11/site-packages/websockets/legacy/client.py", line 637, in __aenter__
    return await self
           ^^^^^^^^^^
  File "/Users/naiqing.lnq/anaconda3/envs/edgeChat/lib/python3.11/site-packages/websockets/legacy/client.py", line 655, in __await_impl_timeout__
    return await self.__await_impl__()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/naiqing.lnq/anaconda3/envs/edgeChat/lib/python3.11/site-packages/websockets/legacy/client.py", line 662, in __await_impl__
    await protocol.handshake(
  File "/Users/naiqing.lnq/anaconda3/envs/edgeChat/lib/python3.11/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

Console logs

File "/Users/naiqing.lnq/source/aigc/tmg-aigc/langchian-start/newbing/test.py", line 18, in <module>
    asyncio.run(main())
  File "/Users/naiqing.lnq/anaconda3/envs/edgeChat/lib/python3.11/asyncio/runners.py", line 190, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/Users/naiqing.lnq/anaconda3/envs/edgeChat/lib/python3.11/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/naiqing.lnq/anaconda3/envs/edgeChat/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/Users/naiqing.lnq/source/aigc/tmg-aigc/langchian-start/newbing/test.py", line 12, in main
    response = await bot.ask(prompt="Hello world", conversation_style=ConversationStyle.creative)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/naiqing.lnq/anaconda3/envs/edgeChat/lib/python3.11/site-packages/EdgeGPT/EdgeGPT.py", line 116, in ask
    async for final, response in self.chat_hub.ask_stream(
  File "/Users/naiqing.lnq/anaconda3/envs/edgeChat/lib/python3.11/site-packages/EdgeGPT/chathub.py", line 102, in ask_stream
    async with connect(
  File "/Users/naiqing.lnq/anaconda3/envs/edgeChat/lib/python3.11/site-packages/websockets/legacy/client.py", line 637, in __aenter__
    return await self
           ^^^^^^^^^^
  File "/Users/naiqing.lnq/anaconda3/envs/edgeChat/lib/python3.11/site-packages/websockets/legacy/client.py", line 655, in __await_impl_timeout__
    return await self.__await_impl__()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/naiqing.lnq/anaconda3/envs/edgeChat/lib/python3.11/site-packages/websockets/legacy/client.py", line 662, in __await_impl__
    await protocol.handshake(
  File "/Users/naiqing.lnq/anaconda3/envs/edgeChat/lib/python3.11/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

Additional information

1

IsBigLin avatar Aug 01 '23 12:08 IsBigLin