:zap: [Enhance] HuggingchatStreamer: logger auth messages
Browse files
networks/huggingchat_streamer.py
CHANGED
@@ -46,7 +46,7 @@ class HuggingchatRequester:
|
|
46 |
else:
|
47 |
logger.warn(f"[{res.status_code}]")
|
48 |
logger.warn(res.text)
|
49 |
-
raise ValueError("Failed to get hf-chat ID
|
50 |
|
51 |
def get_conversation_id(self, system_prompt: str = ""):
|
52 |
request_url = "https://huggingface.co/chat/conversation"
|
@@ -105,7 +105,7 @@ class HuggingchatRequester:
|
|
105 |
logger.success(f"[{message_id}]")
|
106 |
else:
|
107 |
logger.warn(f"[{res.status_code}]")
|
108 |
-
raise ValueError("Failed to get
|
109 |
|
110 |
return message_id
|
111 |
|
@@ -169,7 +169,6 @@ class HuggingchatRequester:
|
|
169 |
checker = TokenChecker(input_str=system_prompt + input_prompt, model=self.model)
|
170 |
checker.check_token_limit()
|
171 |
|
172 |
-
logger.enter_quiet(not verbose)
|
173 |
self.get_hf_chat_id()
|
174 |
self.get_conversation_id(system_prompt=system_prompt)
|
175 |
message_id = self.get_last_message_id()
|
@@ -191,7 +190,6 @@ class HuggingchatRequester:
|
|
191 |
"web_search": False,
|
192 |
}
|
193 |
self.log_request(request_url, method="POST")
|
194 |
-
logger.exit_quiet(not verbose)
|
195 |
|
196 |
res = requests.post(
|
197 |
request_url,
|
|
|
46 |
else:
|
47 |
logger.warn(f"[{res.status_code}]")
|
48 |
logger.warn(res.text)
|
49 |
+
raise ValueError(f"Failed to get hf-chat ID: {res.text}")
|
50 |
|
51 |
def get_conversation_id(self, system_prompt: str = ""):
|
52 |
request_url = "https://huggingface.co/chat/conversation"
|
|
|
105 |
logger.success(f"[{message_id}]")
|
106 |
else:
|
107 |
logger.warn(f"[{res.status_code}]")
|
108 |
+
raise ValueError("Failed to get message ID!")
|
109 |
|
110 |
return message_id
|
111 |
|
|
|
169 |
checker = TokenChecker(input_str=system_prompt + input_prompt, model=self.model)
|
170 |
checker.check_token_limit()
|
171 |
|
|
|
172 |
self.get_hf_chat_id()
|
173 |
self.get_conversation_id(system_prompt=system_prompt)
|
174 |
message_id = self.get_last_message_id()
|
|
|
190 |
"web_search": False,
|
191 |
}
|
192 |
self.log_request(request_url, method="POST")
|
|
|
193 |
|
194 |
res = requests.post(
|
195 |
request_url,
|