Spaces:
Configuration error
Configuration error
File size: 956 Bytes
27a8994 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
import streamlit as st
from agent.agent import RunAgent
# Set Streamlit layout
st.set_page_config(page_title="Document Chat App", layout="wide")
st.title("📄 Document Chat App")
# Initialize session state
if 'chat_history' not in st.session_state:
st.session_state.chat_history = []
# Display chat history
for speaker, message in st.session_state.chat_history:
with st.chat_message(name=speaker):
st.markdown(message)
# Chat input
user_input = st.chat_input("Ask something about your document...")
if user_input:
# Show user message
with st.chat_message("You"):
st.markdown(user_input)
# Run agent
response = RunAgent(query=user_input)
# Show bot response
with st.chat_message("Bot"):
st.markdown(response)
# Save to chat history
st.session_state.chat_history.append(("You", user_input))
st.session_state.chat_history.append(("Bot", response))
|