From aca098b7477ef913b433eed1e7df3780133a06db Mon Sep 17 00:00:00 2001 From: TribS <33004761+TribSTox@users.noreply.github.com> Date: Thu, 16 May 2024 17:55:55 +0200 Subject: [PATCH] fix: remove 'hostname' property from WebSearchSource The 'hostname' property is no longer present in the JSON response, causing errors in the web search functionality. This commit removes the 'hostname' attribute from the WebSearchSource class and updates the Message class to handle the updated JSON structure correctly. - Removed 'hostname' attribute from WebSearchSource. - Updated Message class to process web search sources without 'hostname'. This fix resolves the issue where the web search results were causing errors due to the missing 'hostname' property. --- src/hugchat/message.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/hugchat/message.py b/src/hugchat/message.py index 55e933a..5c14f3a 100644 --- a/src/hugchat/message.py +++ b/src/hugchat/message.py @@ -17,13 +17,11 @@ class WebSearchSource: title: str link: str - hostname: str def __str__(self): return json.dumps({ "title": self.title, "link": self.link, - "hostname": self.hostname, }) @@ -112,7 +110,6 @@ def __next__(self) -> dict: wss = WebSearchSource() wss.title = source["title"] wss.link = source["link"] - wss.hostname = source["hostname"] self.web_search_sources.append(wss) elif "messageType" in a: message_type: str = a["messageType"]