MCP_Research / component /paper_list.py
mgbam's picture
Update component/paper_list.py
7ed05a1 verified
raw
history blame
890 Bytes
# Paper list component
# File: components/paper_list.py
import streamlit as st
def render_paper_list(papers):
"""
Display a list of papers: title, authors, truncated abstract, and link if available.
"""
st.header("πŸ“„ Papers Found")
if not papers:
st.warning("No papers found. Try another query.")
return
for paper in papers:
title = paper.get("title", "Untitled")
authors = paper.get("authors", [])
abstract = paper.get("abstract", "No abstract.")
link = paper.get("url")
with st.expander(title, expanded=False):
st.markdown(f"**Authors:** {', '.join(authors)}")
# Truncate abstract to 300 chars
snippet = abstract if len(abstract) < 300 else abstract[:300] + "..."
st.write(snippet)
if link:
st.markdown(f"[Read more]({link})")