import streamlit as st import json # Page configuration st.set_page_config( page_title="Portfolio Chatbot Test", page_icon="🤖", layout="wide" ) # Initialize session state if 'messages' not in st.session_state: st.session_state.messages = [] def main(): st.title("Portfolio Chatbot Testing Interface") st.write("Basic testing version") # Create two columns for layout col1, col2 = st.columns([2, 1]) with col1: st.subheader("Chat Interface") # Display chat messages from history for message in st.session_state.messages: with st.chat_message(message["role"]): st.markdown(message["content"]) # Accept user input if prompt := st.chat_input("What would you like to know?"): # Add user message to chat history st.session_state.messages.append({"role": "user", "content": prompt}) # Simple echo response for testing response = f"You asked: {prompt}" # Display assistant response with st.chat_message("assistant"): st.markdown(response) # Add assistant response to chat history st.session_state.messages.append({"role": "assistant", "content": response}) with col2: st.subheader("Testing Tools") if st.button("Clear Chat"): st.session_state.messages = [] st.experimental_rerun() if __name__ == "__main__": main()