Soulter / hugging-chat-api

HuggingChat Python API🤗
GNU Affero General Public License v3.0
859 stars 123 forks source link

ERROR:root:No `type` found in response: {'message': 'An error occurred'} #253

Closed jon-Mei-97 closed 3 months ago

jon-Mei-97 commented 3 months ago

Describe the bug ERROR:root:Notypefound in response: {'message': 'An error occurred', 'errorId': .... }

To Reproduce

...
chatbot = hugchat.ChatBot(cookies=cookies.get_dict())
message_result = chatbot.chat("Hi!")
print(message_result)

Expected behavior Should return a result

Additional context MacOS 14.5 HugChat 0.4.10 Python 3.11

Complete Error:

ERROR:root:No `type` found in response: {'message': 'An error occurred', 'errorId': 'xxxxxxxxx'}
Traceback (most recent call last):
  File "/Users/x/PycharmProjects/TestHughat/TestHug.py", line 22, in <module>
    print(message_result)
  File "/Users/x/PycharmProjects/TestHughat/venv/lib/python3.11/site-packages/hugchat/message.py", line 292, in __str__
    return self.wait_until_done()
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/x/PycharmProjects/TestHughat/venv/lib/python3.11/site-packages/hugchat/message.py", line 259, in wait_until_done
    self.__next__()
  File "/Users/x/PycharmProjects/TestHughat/venv/lib/python3.11/site-packages/hugchat/message.py", line 200, in __next__
    raise self.error
  File "/Users/xPycharmProjects/TestHughat/venv/lib/python3.11/site-packages/hugchat/message.py", line 124, in __next__
    self._filterResponse(data)
  File "/Users/xPycharmProjects/TestHughat/venv/lib/python3.11/site-packages/hugchat/message.py", line 108, in _filterResponse
    raise ChatError(f"Server returns an error: {obj['message']}")
hugchat.exceptions.ChatError: Server returns an error: An error occurred
Traceback (most recent call last):
  File "/Users/x/PycharmProjects/TestHughat/venv/lib/python3.11/site-packages/hugchat/hugchat.py", line 733, in _stream_query
    yield obj
GeneratorExit
Exception ignored in: <generator object ChatBot._stream_query at 0x105a27d30>
Traceback (most recent call last):
  File "/Users/x/PycharmProjects/TestHughat/venv/lib/python3.11/site-packages/hugchat/hugchat.py", line 745, in _stream_query
hugchat.exceptions.ChatError: Failed to parse response: {"message":"An error occurred","errorId":"xxxxxxxxxxx"}
github-actions[bot] commented 3 months ago

Hi! Thanks for your issue, we will deal with your issue as soon as possible.

karolinefarias commented 3 months ago

same problem for me

AhmedBoin commented 3 months ago

same problem too

Soulter commented 3 months ago

Hello, I've found the cause of this error and published a new version. Please upgrade to the latest version to avoid the problem.