AD2000X commited on
Commit
cdf1208
·
verified ·
1 Parent(s): a87b19b

Update src/visualization.py

Browse files
Files changed (1) hide show
  1. src/visualization.py +22 -21
src/visualization.py CHANGED
@@ -131,28 +131,29 @@ def display_reasoning_trace(query: str, retrieved_docs: List[Dict], answer: str,
131
 
132
  # Display retrieved document details in expandable sections
133
  for source, docs in docs_by_source.items():
134
- with st.expander(f"{source.capitalize()} ({len(docs)})", expanded=source == "ontology_context"):
135
- for i, doc in enumerate(docs):
136
- # Add separator between documents
137
- if i > 0:
138
- st.markdown("---")
139
-
140
- # Display document content
141
- if hasattr(doc, 'page_content'):
142
- st.markdown(f"**Content:**")
143
-
144
- # Format depending on source
145
- if source in ["ontology", "ontology_context"]:
146
- st.markdown(doc.page_content)
147
- else:
148
- st.code(doc.page_content)
149
 
150
- # Display metadata if present
151
- if hasattr(doc, 'metadata') and doc.metadata:
152
- st.markdown("**Metadata:**")
153
- for key, value in doc.metadata.items():
154
- if key != 'source': # Already shown in section title
155
- st.markdown(f"- **{key}**: {value}")
 
 
 
 
 
 
156
 
157
  with tab3:
158
  # Show the reasoning flow from query to answer
 
131
 
132
  # Display retrieved document details in expandable sections
133
  for source, docs in docs_by_source.items():
134
+ st.subheader(f"{entity_type} ({len(entity_list)})")
135
+
136
+ for entity in entity_list:
137
+ # Add separator between documents
138
+ if i > 0:
139
+ st.markdown("---")
140
+
141
+ # Display document content
142
+ if hasattr(doc, 'page_content'):
143
+ st.markdown(f"**Content:**")
 
 
 
 
 
144
 
145
+ # Format depending on source
146
+ if source in ["ontology", "ontology_context"]:
147
+ st.markdown(doc.page_content)
148
+ else:
149
+ st.code(doc.page_content)
150
+
151
+ # Display metadata if present
152
+ if hasattr(doc, 'metadata') and doc.metadata:
153
+ st.markdown("**Metadata:**")
154
+ for key, value in doc.metadata.items():
155
+ if key != 'source': # Already shown in section title
156
+ st.markdown(f"- **{key}**: {value}")
157
 
158
  with tab3:
159
  # Show the reasoning flow from query to answer