Dhruv-Ty commited on
Commit
0ab8a85
Β·
verified Β·
1 Parent(s): 6786f88

source format

Browse files
Files changed (1) hide show
  1. src/chat_display.py +9 -4
src/chat_display.py CHANGED
@@ -163,15 +163,20 @@ def display_chat_history():
163
  with st.expander("Show Sources"):
164
  st.markdown("**Medical sources used:**")
165
  for i, source in enumerate(message.get("evidence", [])):
166
- title = source.get("title", "No title")
167
  url = source.get("url", "#")
168
- source_type = source.get("source_type", "")
169
  is_open_access = source.get("is_open_access", False)
170
 
171
- # Add open access indicator
172
  access_icon = "πŸ”“ " if is_open_access else ""
173
 
174
- st.markdown(f"{i+1}. {access_icon}[{title}]({url}) - *{source_type}*")
 
 
 
 
 
 
175
 
176
  st.markdown("---")
177
  st.markdown("**Legend:** πŸ”“ = Open Access (full text available)")
 
163
  with st.expander("Show Sources"):
164
  st.markdown("**Medical sources used:**")
165
  for i, source in enumerate(message.get("evidence", [])):
166
+ title = source.get("title", "No title") # Fallback if citation is missing
167
  url = source.get("url", "#")
168
+ source_type = source.get("source_type", "Unknown Source")
169
  is_open_access = source.get("is_open_access", False)
170
 
 
171
  access_icon = "πŸ”“ " if is_open_access else ""
172
 
173
+ citation_text = source.get('citation', title).strip()
174
+
175
+ markdown_string = (
176
+ f"{i+1}. {access_icon}{citation_text}\n"
177
+ f" [[Access Article]]({url}) - *{source_type}*"
178
+ )
179
+ st.markdown(markdown_string)
180
 
181
  st.markdown("---")
182
  st.markdown("**Legend:** πŸ”“ = Open Access (full text available)")