|
|
|
import streamlit as st |
|
from config.settings import settings |
|
from pathlib import Path |
|
from assets.logo import get_logo_path |
|
from services.logger import app_logger |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if not st.session_state.get("authenticated_user_id"): |
|
st.warning("Please log in to access the application.") |
|
|
|
|
|
try: |
|
st.switch_page("app.py") |
|
except st.errors.StreamlitAPIException as e: |
|
if "st.switch_page can only be called when running in MPA mode" in str(e): |
|
app_logger.warning("Running in single-page mode or st.switch_page issue. Stopping script.") |
|
st.info("Please navigate to the main login page.") |
|
else: |
|
app_logger.error(f"Error during st.switch_page: {e}") |
|
st.error("Redirection error. Please go to the login page manually.") |
|
st.stop() |
|
|
|
|
|
|
|
authenticated_username = st.session_state.get("authenticated_username", "User") |
|
|
|
st.title(f"Welcome to {settings.APP_TITLE}, {authenticated_username}!") |
|
st.markdown(f""" |
|
Welcome, **{authenticated_username}**! |
|
|
|
This application leverages cutting-edge AI to provide insights for healthcare professionals. |
|
|
|
**Features:** |
|
- **AI-Powered Consultation:** Engage in a conversation with an AI assistant capable of understanding medical queries, |
|
looking up information, and more. |
|
- **Secure User Authentication:** Your data and interactions are protected. |
|
- **Reporting:** Generate PDF summaries of your consultations. |
|
|
|
**How to Get Started:** |
|
1. Navigate to the **Consult** page to start a new session with the AI. |
|
2. Use the **Reports** page to view and download past consultation summaries. |
|
|
|
*Disclaimer: This is a demonstration application. Information provided should not be used for |
|
actual medical decision-making without verification by qualified medical professionals.* |
|
""") |
|
|
|
|
|
logo_path_str = get_logo_path() |
|
if logo_path_str: |
|
logo_file = Path(logo_path_str) |
|
if logo_file.exists(): |
|
try: |
|
st.image(str(logo_file), width=150, caption=settings.APP_TITLE) |
|
except Exception as e: |
|
app_logger.warning(f"Could not display logo on Home page from path '{logo_path_str}': {e}") |
|
|
|
|
|
elif settings.APP_TITLE: |
|
st.caption(f"Image: {settings.APP_TITLE} Logo") |
|
|
|
app_logger.info(f"User {authenticated_username} accessed Home page.") |