Skip to content

Commit

Permalink
Merge pull request #243 from kokofixcomputers/patch-2
Browse files Browse the repository at this point in the history
Fix change sharing resulting in 403
  • Loading branch information
Soulter authored Jul 7, 2024
2 parents ba48b7c + 2afbb8c commit e6061db
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 3 additions & 1 deletion src/hugchat/hugchat.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit e6061db

Please sign in to comment.