import streamlit as st import time import main # Initialize conversation history if 'conversation' not in st.session_state: st.session_state['conversation'] = [] # Function to display conversation history def display_conversation(): for entry in st.session_state['conversation']: if entry['type'] == 'bot': st.markdown(f"
{entry['message']}
", unsafe_allow_html=True) else: st.markdown(f"
{entry['message']}
", unsafe_allow_html=True) # Function to simulate chatbot response def get_bot_response(user_input): # Simulated bot response response = main.ask_llms(user_input) bot_response = f"Echo: {response}" return bot_response # Streamlit UI components st.title("Professional Chatbot Interface") # Display conversation st.markdown("### Conversation") display_conversation() # User input user_input = st.text_input("You", "") # Button for user to submit the input if st.button("Send"): if user_input: # Save user's message st.session_state['conversation'].append({"type": "user", "message": user_input}) # Get bot response and save it bot_message = get_bot_response(user_input) time.sleep(1) # Simulate delay st.session_state['conversation'].append({"type": "bot", "message": bot_message}) # Refresh the page after sending the message st.rerun() # Design Enhancements # Custom CSS to style the input box # Custom CSS to style the input box st.markdown(""" """, unsafe_allow_html=True)