Skip to content

Commit 54fa7ad

Browse files
authored
Merge pull request #243 from kokofixcomputers/patch-2
Fix change sharing resulting in 403
2 parents 6bd0e86 + 9e26581 commit 54fa7ad

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

‎setup.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
setup(
55
name="hugchat",
6-
version="0.4.8",
6+
version="0.4.9",
77
description="A huggingchat python api.",
88
long_description=open("README.md", "rt", encoding="utf-8").read(),
99
long_description_content_type="text/markdown",

‎src/hugchat/hugchat.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ def set_share_conversations(self, val: bool = True):
355355

356356
r = self.session.post(
357357
self.hf_base_url + "/chat/settings",
358-
headers={"Referer": "https://huggingface.co/chat"},
358+
headers={"Referer": "https://huggingface.co/chat", "Origin":"https://huggingface.co"},
359359
cookies=self.get_cookies(),
360360
allow_redirects=True,
361361
files=settings,
@@ -741,6 +741,8 @@ def _stream_query(
741741
"Model is overloaded, please try again later or switch to another model."
742742
)
743743
logging.debug(resp.headers)
744+
if "Conversation not found" in str(res):
745+
raise exceptions.InvalidConversationIDError("Conversation id invalid")
744746
raise exceptions.ChatError(f"Failed to parse response: {res}")
745747
if break_flag:
746748
break

0 commit comments

Comments
 (0)