HexyeDEV / Telegram-Chatbot-Gpt4Free

This is a Python-based Telegram bot using the telethon library. The bot responds to messages using the evagpt4 reverse engeneered api from OpenGPT repo
MIT License
135 stars 39 forks source link

Sweep: Error when getting JSON response from Bing server #21

Open CmetankaJDD opened 6 months ago

CmetankaJDD commented 6 months ago

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')

  1. Run the script main.py from the repository https://github.com/username/Telegram-Chatbot-Gpt4Free
  2. Send a message to the bot in Telegram
  3. Get an error in the console

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.

Vladimirkkkk commented 5 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 ?