Update app.py
Browse files7 unmodified lines8910111213141516171819203 unmodified lines242526272829308 unmodified lines3940414243444541 unmodified lines878889909192932 unmodified lines969798991001011021031041051061077 unmodified linesst.markdown("""<style>/* Page Styling */.stApp {background-color: #343541;color: #e0e0e0;}/* Input box */.stTextInput input {background-color: #40414f;color: #fff;3 unmodified linesfont-size: 16px;}/* Send button */.stButton>button {background-color: #19c37d;color: white;8 unmodified linesbackground-color: #15a96e;}/* Chat messages */.chat-container {max-height: 75vh;overflow-y: auto;41 unmodified linesif "chat_history" not in st.session_state:st.session_state.chat_history = []# --- Chat Input ---with st.form("chat_form", clear_on_submit=True):user_input = st.text_input("Ask anything about mobile accessories...", key="input")send = st.form_submit_button("Send")2 unmodified linesresponse = generate_response(user_input)st.session_state.chat_history.append(("user", user_input))st.session_state.chat_history.append(("bot", response))# --- Chat Display ---st.markdown('<div class="chat-container"><div class="chat-wrapper">', unsafe_allow_html=True)for role, msg in st.session_state.chat_history:css_class = "user" if role == "user" else "bot"st.markdown(f'<div class="message {css_class}">{msg}</div>', unsafe_allow_html=True)st.markdown('</div></div>', unsafe_allow_html=True)7 unmodified lines891011121314151617183 unmodified lines2223242526278 unmodified lines36373839404141 unmodified lines83848586878889909192939495962 unmodified lines991001011027 unmodified linesst.markdown("""<style>.stApp {background-color: #343541;color: #e0e0e0;}.stTextInput input {background-color: #40414f;color: #fff;3 unmodified linesfont-size: 16px;}.stButton>button {background-color: #19c37d;color: white;8 unmodified linesbackground-color: #15a96e;}.chat-container {max-height: 75vh;overflow-y: auto;41 unmodified linesif "chat_history" not in st.session_state:st.session_state.chat_history = []# --- Chat Display (on top) ---st.markdown('<div class="chat-container"><div class="chat-wrapper">', unsafe_allow_html=True)for role, msg in st.session_state.chat_history:css_class = "user" if role == "user" else "bot"st.markdown(f'<div class="message {css_class}">{msg}</div>', unsafe_allow_html=True)st.markdown('</div></div>', unsafe_allow_html=True)# --- Chat Input (below) ---with st.form("chat_form", clear_on_submit=True):user_input = st.text_input("Ask anything about mobile accessories...", key="input")send = st.form_submit_button("Send")2 unmodified linesresponse = generate_response(user_input)st.session_state.chat_history.append(("user", user_input))st.session_state.chat_history.append(("bot", response))st.rerun() # Optional: Keeps scroll to bottom after each input
app.py+9-14