Spaces:
Running
Running
Update src/visualization.py
Browse files- 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 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
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 |
-
#
|
151 |
-
if
|
152 |
-
st.markdown(
|
153 |
-
|
154 |
-
|
155 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
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
|