Skip to content

Commit

Permalink
display sigle filter, not history
Browse files Browse the repository at this point in the history
  • Loading branch information
Taniya-Das committed Aug 22, 2024
1 parent f740fbe commit e5cc39a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion frontend/ui_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ def parse_and_update_response(self, metadata: pd.DataFrame):
print(self.structured_query_response) # Only for debugging. Comment later.
if self.structured_query_response[0] is not None and isinstance(self.structured_query_response[1], dict):
# Safely attempt to access the "filter" key in the first element

if self.structured_query_response[0].get("filter", None) and self.database_filtered:
filtered_metadata = metadata[
metadata["did"].isin(self.database_filtered)
Expand Down Expand Up @@ -414,7 +415,7 @@ def process_query_chat(self, query):
)

if response_parser.structured_query_response:
st.session_state.messages.append("Detected Filter(s): ", json.dumps(response_parser.structured_query_response[0].get("filter", None)))
st.write("Detected Filter(s): ", json.dumps(response_parser.structured_query_response[0].get("filter", None)))
else:
st.write("Detected Filter(s): ", None)
# st.write("Detected Topics: ", response_parser.structured_query_response[0].get("query", None))
Expand Down

0 comments on commit e5cc39a

Please sign in to comment.