Open CmetankaJDD opened 6 months ago
Im started this bot
Console - erorr:
raise WSServerHandshakeError( aiohttp.client_exceptions.WSServerHandshakeError: 200, message='Invalid response status', url=URL('wss://sydney.bing.com/sydney/ChatHub?sec_access_token
What ?
Details
When trying to create a conversation with Bing using Python and aiohttp, a ContentTypeError exception is raised. The Bing server returns an HTML page instead of a JSON response. This may be related to an incorrect URL or a problem on the server side. Reproducing the error:
Traceback (most recent call last): File "C:\Users\Den\AppData\Local\Programs\Python\Python311\Lib\site-packages\telethon\client\updates.py", line 570, in _dispatch_update await callback(event) File "C:\Users\Den\Desktop\тг бот\Telegram-Chatbot-Gpt4Free-main\main.py", line 212, in handler result = await AiAgent(prompt, system_prompt) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Den\Desktop\тг бот\Telegram-Chatbot-Gpt4Free-main\main.py", line 44, in AiAgent async for message in req: File "C:\Users\Den\Desktop\тг бот\Telegram-Chatbot-Gpt4Free-main\bing__init.py", line 443, in stream_generate conversation = await create_conversation(session, tone, image, proxy) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Den\Desktop\тг бот\Telegram-Chatbot-Gpt4Free-main\bing\init__.py", line 73, in create_conversation data = await response.json() ^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Den\AppData\Local\Programs\Python\Python311\Lib\site-packages\aiohttp\client_reqrep.py", line 1104, in json raise ContentTypeError( aiohttp.client_exceptions.ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: text/html; charset=utf-8', url=URL('https://www.bing.com/turing/conversation/create?bundleVersion=1.1199.4')
Expected result: The script gets a JSON response from the Bing server and generates a reply message for the bot in Telegram. Actual result: The script throws a ContentTypeError exception and cannot continue working.