Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -154,9 +154,20 @@ st.markdown("""
|
|
154 |
""", unsafe_allow_html=True)
|
155 |
|
156 |
# Initialize chat history
|
|
|
157 |
if "chat_history" not in st.session_state:
|
158 |
st.session_state.chat_history = [{"role": "assistant", "content": "Hello! How can I assist you today?"}]
|
159 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
160 |
# Sidebar for chat reset
|
161 |
if st.sidebar.button("Reset Chat"):
|
162 |
st.session_state.chat_history = [{"role": "assistant", "content": "Hello! How can I assist you today?"}]
|
|
|
154 |
""", unsafe_allow_html=True)
|
155 |
|
156 |
# Initialize chat history
|
157 |
+
# Initialize chat history in session state
|
158 |
if "chat_history" not in st.session_state:
|
159 |
st.session_state.chat_history = [{"role": "assistant", "content": "Hello! How can I assist you today?"}]
|
160 |
|
161 |
+
# Chat Display
|
162 |
+
st.markdown("<div class='container'>", unsafe_allow_html=True)
|
163 |
+
|
164 |
+
for message in st.session_state.chat_history:
|
165 |
+
if message["role"] == "user":
|
166 |
+
st.markdown(f"<div class='user-msg'><strong>You:</strong> {message['content']}</div>", unsafe_allow_html=True)
|
167 |
+
else:
|
168 |
+
st.markdown(f"<
|
169 |
+
|
170 |
+
|
171 |
# Sidebar for chat reset
|
172 |
if st.sidebar.button("Reset Chat"):
|
173 |
st.session_state.chat_history = [{"role": "assistant", "content": "Hello! How can I assist you today?"}]
|