mgbam's picture
Create sidebar.py
c08b7b9 verified
raw
history blame
1.11 kB
# Sidebar component
# File: components/sidebar.py
import streamlit as st
def render_sidebar():
"""
Display the sidebar UI for user query input.
Returns:
query (str): The research query text.
search_clicked (bool): Whether the search button was clicked.
"""
st.sidebar.header("πŸ” Research Query")
query = st.sidebar.text_input("Enter your research topic:", "")
search_clicked = st.sidebar.button("Search")
return query, search_clicked
# File: components/paper_list.py
import streamlit as st
def render_paper_list(papers):
"""
Display a list of papers with titles, authors, and abstracts.
Args:
papers (List[dict]): Each dict should have 'id', 'title', 'authors', 'abstract'.
"""
st.header("πŸ“„ Papers Found")
if not papers:
st.info("No papers found for this query.")
return
for paper in papers:
with st.expander(paper.get("title", "Unknown Title")):
st.markdown(f"**Authors:** {', '.join(paper.get('authors', []))}")
st.write(paper.get("abstract", "No abstract available."))