Spaces:
Sleeping
Sleeping
| import uuid | |
| import streamlit as st | |
| from dotenv import load_dotenv | |
| import scholar_integration | |
| import rag_chatbot | |
| from document_processor import DocumentProcessor | |
| from utils import sample_suggestions | |
| # Load environment variables from .env file | |
| load_dotenv() | |
| st.set_page_config(page_title="3Step AI Chatbot", layout="wide") | |
| # Initialize session variables | |
| if "messages" not in st.session_state: | |
| st.session_state.messages = [] | |
| if "toggle" not in st.session_state: | |
| st.session_state.toggle = False | |
| if "vector_store" not in st.session_state: | |
| st.session_state.vector_store = None | |
| if "user_id" not in st.session_state: | |
| st.session_state.user_id = uuid.uuid4().hex[:8] # Unique ID per user | |
| if "processing_canceled" not in st.session_state: | |
| st.session_state.processing_canceled = False | |
| if "selected_question" not in st.session_state: | |
| st.session_state.selected_question = None | |
| if "suggested_questions" not in st.session_state: | |
| st.session_state.suggested_questions = sample_suggestions | |
| if "processing_question" not in st.session_state: | |
| st.session_state.processing_question = False | |
| if "current_question" not in st.session_state: | |
| st.session_state.current_question = None | |
| def main(): | |
| # Initialize document processor | |
| doc_processor = DocumentProcessor() | |
| mode = st.sidebar.radio("Choose mode:", ["RAG Chatbot", "Academic Research Assistant"]) | |
| if mode == "RAG Chatbot": | |
| # Your existing RAG chatbot code | |
| rag_chatbot.add_rag_chatbot_interface() | |
| else: | |
| st.empty() | |
| # Add the scholar integration | |
| scholar_integration.add_scholarly_chat_interface() | |
| if __name__ == "__main__": | |
| main() |