Thamaraikannan commited on
Commit
f86007c
·
verified ·
1 Parent(s): a92ecc7

Update src/streamlit_app.py

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +27 -3
src/streamlit_app.py CHANGED
@@ -554,12 +554,36 @@ if search_clicked or (query and len(query.strip()) > 0):
554
  page_no = metadata.get("page_no", "N/A")
555
  title = metadata.get("title")
556
 
557
-
558
- st.markdown("#### [{i}] DOC : {doc_id} | Page: {page_no} | Title {title}".format(i=i, doc_id=doc_id, page_no=page_no, title=title))
 
 
 
 
 
 
559
 
560
  html_content = markdown2.markdown(text_content)
561
- st.markdown(f'<div style="background: #303336; padding: 1rem; border-radius: 8px; margin: 1rem 0; line-height: 1.6; color: white;">{html_content}</div>', unsafe_allow_html=True)
 
 
 
 
 
 
 
 
 
 
 
 
562
 
 
 
 
 
 
 
563
 
564
  # Expandable full metadata
565
  doc_label = "Source" if st.session_state.chat_mode else "Result"
 
554
  page_no = metadata.get("page_no", "N/A")
555
  title = metadata.get("title")
556
 
557
+ # st.markdown("#### [{i}] DOC : {doc_id} | Page: {page_no} | Title {title}".format(i=i, doc_id=doc_id, page_no=page_no, title=title))
558
+ st.markdown(
559
+ "#### [{i}] DOC : <span style='color:green;'>{doc_id}</span> | Page: {page_no} | Title: {title}".format(
560
+ i=i, doc_id=doc_id, page_no=page_no, title=title
561
+ ),
562
+ unsafe_allow_html=True
563
+ )
564
+
565
 
566
  html_content = markdown2.markdown(text_content)
567
+ # st.markdown(f'<div style="background: #303336; padding: 1rem; border-radius: 8px; margin: 1rem 0; line-height: 1.6; color: white;">{html_content}</div>', unsafe_allow_html=True)
568
+
569
+ # Split into lines for preview
570
+ lines = text_content.split("\n")
571
+ preview_lines = 5
572
+ preview_text = "\n".join(lines[:preview_lines])
573
+ html_preview = markdown.markdown(preview_text)
574
+
575
+ # Show preview
576
+ st.markdown(
577
+ f'<div style="background: #303336; padding: 1rem; border-radius: 8px; line-height: 1.6; color: white; max-height: 7em; overflow: hidden;">{html_preview}</div>',
578
+ unsafe_allow_html=True
579
+ )
580
 
581
+ # Expandable full content
582
+ with st.expander("🔽 Expand Full Document", expanded=False):
583
+ st.markdown(
584
+ f'<div style="background: #303336; padding: 1rem; border-radius: 8px; line-height: 1.6; color: white;">{html_content}</div>',
585
+ unsafe_allow_html=True
586
+ )
587
 
588
  # Expandable full metadata
589
  doc_label = "Source" if st.session_state.chat_mode else "Result"