import streamlit as st import time def apply_custom_css(): """Applies custom CSS for proper left-right chat alignment with enhanced colors.""" css = """ """ st.markdown(css, unsafe_allow_html=True) def render_header(): st.title("🤖 MediLingua: Your Medical Assistant") st.markdown( "

Ask medical questions and get summarized answers from real doctor responses.

", unsafe_allow_html=True ) def render_sidebar(): with st.sidebar: st.header("⚙️ Configuration") if st.secrets.get("GOOGLE_API_KEY"): st.success("✅ Google API Key configured.") else: st.error("❌ Missing API Key in `.streamlit/secrets.toml`.") st.markdown("---") st.markdown("💡 Built with **Streamlit** & **Gemini**.") def render_chat_history(messages): """Render previous messages.""" for message in messages: with st.chat_message(message["role"]): st.markdown(message["content"]) def bot_typing_animation(message_placeholder, final_text, delay=0.02): """ Simulate bot typing animation in chat. """ message_placeholder.markdown("") # Empty initially displayed = "" for char in final_text: displayed += char message_placeholder.markdown(displayed) time.sleep(delay)