Soulter / hugging-chat-api

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

Strange Characters #230

Closed comeback01 closed 5 months ago

comeback01 commented 5 months ago

For some time now, regardless of the application I use, there are strange characters.

Thank you for your help.

image

github-actions[bot] commented 5 months ago

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

Whitelisted1 commented 5 months ago

I don't see this when printing to the console in Python, but with web tools I am able to see it

here is some of the output that might be causing this issue:

{"type":"status","status":"started"}
{"type":"stream","token":"Hello\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"}
{"type":"title","title":"👋 Hello"}
{"type":"stream","token":"!\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"}
{"type":"stream","token":" It\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"}
{"type":"stream","token":"'s\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"}
{"type":"stream","token":" nice\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"}
{"type":"stream","token":" to\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"}
{"type":"stream","token":" meet\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"}
{"type":"stream","token":" you\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"}
{"type":"stream","token":".\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"}
{"type":"stream","token":" Is\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"}
{"type":"stream","token":" there\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"}
{"type":"stream","token":" something\u0000\u0000\u0000\u0000\u0000\u0000"}
{"type":"stream","token":" I\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"}
{"type":"stream","token":" can\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"}
{"type":"stream","token":" help\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"}
{"type":"stream","token":" you\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"}
{"type":"stream","token":" with\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"}
{"type":"stream","token":",\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"}
{"type":"stream","token":" or\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"}
{"type":"stream","token":" would\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"}
{"type":"stream","token":" you\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"}
{"type":"stream","token":" like\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"}
{"type":"stream","token":" to\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"}
{"type":"stream","token":" chat\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"}
{"type":"stream","token":"?\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"}
{"type":"finalAnswer","text":"Hello! It's nice to meet you. Is there something I can help you with, or would you like to chat?","interrupted":false}

I'm unsure why it would be outputting this, but a possible fix might be to replace the \u0000 string with a blank string.

Whitelisted1 commented 5 months ago

On further inspection, I am able to see the strange characters in the Python script

{'type': 'stream', 'token': 'Hello\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'}
{'type': 'stream', 'token': '!\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'}
{'type': 'stream', 'token': ' How\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'}
{'type': 'stream', 'token': ' can\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'}
{'type': 'stream', 'token': ' I\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'}
{'type': 'stream', 'token': ' help\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'}
{'type': 'stream', 'token': ' you\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'}
{'type': 'stream', 'token': ' today\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'}
{'type': 'stream', 'token': '?\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'}
comeback01 commented 5 months ago

Thank you very much for the explanation.

I didn't have this problem before, it's recent (about 10 days I think).

Is there a solution to this problem?

Thanks

Soulter commented 5 months ago

The problem has been solved, update to the latest version 0.4.8 to get the fixes.