|
import streamlit as st |
|
import json |
|
|
|
|
|
st.set_page_config( |
|
page_title="Portfolio Chatbot Test", |
|
page_icon="🤖", |
|
layout="wide" |
|
) |
|
|
|
|
|
if 'messages' not in st.session_state: |
|
st.session_state.messages = [] |
|
|
|
def main(): |
|
st.title("Portfolio Chatbot Testing Interface") |
|
st.write("Basic testing version") |
|
|
|
|
|
col1, col2 = st.columns([2, 1]) |
|
|
|
with col1: |
|
st.subheader("Chat Interface") |
|
|
|
for message in st.session_state.messages: |
|
with st.chat_message(message["role"]): |
|
st.markdown(message["content"]) |
|
|
|
|
|
if prompt := st.chat_input("What would you like to know?"): |
|
|
|
st.session_state.messages.append({"role": "user", "content": prompt}) |
|
|
|
|
|
response = f"You asked: {prompt}" |
|
|
|
|
|
with st.chat_message("assistant"): |
|
st.markdown(response) |
|
|
|
|
|
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() |