diff --git a/setup.py b/setup.py index 0beae23..a00a6b2 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ setup( name="hugchat", - version="0.4.8", + version="0.4.9", description="A huggingchat python api.", long_description=open("README.md", "rt", encoding="utf-8").read(), long_description_content_type="text/markdown", diff --git a/src/hugchat/hugchat.py b/src/hugchat/hugchat.py index 354aa56..e487e9e 100644 --- a/src/hugchat/hugchat.py +++ b/src/hugchat/hugchat.py @@ -355,7 +355,7 @@ def set_share_conversations(self, val: bool = True): r = self.session.post( self.hf_base_url + "/chat/settings", - headers={"Referer": "https://huggingface.co/chat"}, + headers={"Referer": "https://huggingface.co/chat", "Origin":"https://huggingface.co"}, cookies=self.get_cookies(), allow_redirects=True, files=settings, @@ -741,6 +741,8 @@ def _stream_query( "Model is overloaded, please try again later or switch to another model." ) logging.debug(resp.headers) + if "Conversation not found" in str(res): + raise exceptions.InvalidConversationIDError("Conversation id invalid") raise exceptions.ChatError(f"Failed to parse response: {res}") if break_flag: break