import streamlit as st from utils.paper_tools import process_query st.set_page_config(page_title="Research Chatbot", layout="wide") # ⬇️ Custom CSS to style the chat input box st.markdown(""" """, unsafe_allow_html=True) # Logo and Branding Header # st.image("logo.png", width=150) st.title("🧠 ResearchGPT") st.caption("Your intelligent assistant for exploring research papers.") # Toggle for dark/light mode # mode = st.toggle("🌗 Toggle Dark Mode", value=False) # if mode: # st.markdown(""" # # """, unsafe_allow_html=True) # Contextual suggestions st.markdown("#### 🔍 Try asking:") st.markdown("- Search papers on large language models") st.markdown("- Summarize paper 2403.00001") st.markdown("- Find research on agentic AI") # Initialize chat history if "chat_history" not in st.session_state: st.session_state.chat_history = [] # Chat input at the bottom of the page query = st.chat_input("Your Query:") # Process user query if query: st.session_state.chat_history.append(("user", query)) with st.spinner("Bot is typing..."): try: response = process_query(query) st.session_state.chat_history.append(("bot", response)) except Exception as e: response = f"Error: {str(e)}" st.session_state.chat_history.append(("bot", response)) # Display chat messages in reverse order for role, msg in reversed(st.session_state.chat_history): with st.chat_message("user" if role == "user" else "assistant"): if role == "bot" and msg.strip().startswith("##"): # Card-style layout for results st.markdown("""
""", unsafe_allow_html=True) st.markdown(msg) st.markdown("""
""", unsafe_allow_html=True) else: st.markdown(msg) # Minimal footer st.markdown("---") # st.markdown("Made with ❤️ by [Hargurjeet](https://www.linkedin.com/in/hargurjeet/)") # Fixed bottom-right footer st.markdown( """ """, unsafe_allow_html=True )