pininkara / BingChatBot

Bing chat Telegram bot using Python and unofficial EdgeGPT API
Apache License 2.0
54 stars 20 forks source link

why error? #21

Open f9rr4r1 opened 10 months ago

f9rr4r1 commented 10 months ago

←[0;32mMessage: а From: Дмитрий None @ 1111111 2023-10-26 20:27:50,113 (init.py:960 MainThread) ERROR - TeleBot: "Infinity polling exception: 'conversationSignature'" 2023-10-26 20:27:50,114 (init.py:962 MainThread) ERROR - TeleBot: "Exception traceback: Traceback (most recent call last): File "C:\Users\admin\AppData\Local\Programs\Python\Python311\Lib\site-packages\telebot__init.py", line 955, in infinity_polling self.polling(non_stop=True, timeout=timeout, long_polling_timeout=long_polling_timeout, File "C:\Users\admin\AppData\Local\Programs\Python\Python311\Lib\site-packages\telebot__init.py", line 1043, in polling self.threaded_polling(non_stop=non_stop, interval=interval, timeout=timeout, long_polling_timeout=long_polling_timeout, File "C:\Users\admin\AppData\Local\Programs\Python\Python311\Lib\site-packages\telebot__init.py", line 1118, in threaded_polling raise e File "C:\Users\admin\AppData\Local\Programs\Python\Python311\Lib\site-packages\telebot__init.py", line 1074, in threaded_polling self.worker_pool.raise_exceptions() File "C:\Users\admin\AppData\Local\Programs\Python\Python311\Lib\site-packages\telebot\util.py", line 148, in raise_exceptions raise self.exception_info File "C:\Users\admin\AppData\Local\Programs\Python\Python311\Lib\site-packages\telebot\util.py", line 91, in run task(*args, **kwargs) File "C:\Users\admin\AppData\Local\Programs\Python\Python311\Lib\site-packages\telebot__init.py", line 6428, in _run_middlewares_and_handler result = handler'function' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\admin\Downloads\chatbing\3\bing.py", line 109, in response_all response_list = asyncio.run(bing_chat(message_text, message)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\admin\AppData\Local\Programs\Python\Python311\Lib\asyncio\runners.py", line 190, in run return runner.run(main) ^^^^^^^^^^^^^^^^ File "C:\Users\admin\AppData\Local\Programs\Python\Python311\Lib\asyncio\runners.py", line 118, in run return self._loop.run_until_complete(task) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\admin\AppData\Local\Programs\Python\Python311\Lib\asyncio\base_events.py", line 653, in run_until_complete return future.result() ^^^^^^^^^^^^^^^ File "C:\Users\admin\Downloads\chatbing\3\bing.py", line 152, in bing_chat EDGES[message.from_user.id] = Chatbot(cookie_path=COOKIE_PATH) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\admin\AppData\Local\Programs\Python\Python311\Lib\site-packages\EdgeGPT.py", line 362, in init__ self.chat_hub: _ChatHub = _ChatHub( ^^^^^^^^^ File "C:\Users\admin\AppData\Local\Programs\Python\Python311\Lib\site-packages\EdgeGPT.py", line 274, in init__ conversation_signature=conversation.struct["conversationSignature"],


KeyError: 'conversationSignature'
"
Bingchatbot commented 10 months ago

Автор давно не обновлял свой код. За это время изменилась структура ответов Bing. По данной ошибке нужно брать conversationSignature из response.headers["X-Sydney-Conversationsignature"]. А также, если есть response.headers["X-Sydney-Encryptedconversationsignature"] добавить к wss_link += f"?sec_access_token={parse.quote(self.encrypted_conversation_signature)}" Посмотри подробнее в коде https://github.com/Integration-Automation/ReEdgeGPT нужный коммит: https://github.com/Integration-Automation/ReEdgeGPT/commit/aada2e3316d36d1612547f7f466f56eddbdf9c6d

translate.google : The author has not updated his code for a long time. During this time, the structure of Bing responses has changed. Due to this error, you need to take conversationSignature from response.headers["X-Sydney-Conversationsignature"]. And also, if there is response.headers["X-Sydney-Encryptedconversationsignature"] add to wss_link += f"?sec_access_token={parse.quote(self.encrypted_conversation_signature)}" Look in more detail in the code https://github.com/Integration-Automation/ReEdgeGPT required commit: https://github.com/Integration-Automation/ReEdgeGPT/commit/aada2e3316d36d1612547f7f466f56eddbdf9c6d