Spaces:
Sleeping
Sleeping
Ari commited on
Update app.py
Browse files
app.py
CHANGED
|
@@ -220,3 +220,17 @@ def process_input():
|
|
| 220 |
|
| 221 |
# Reset the user_input in session state
|
| 222 |
st.session_state['user_input'] = ''
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 220 |
|
| 221 |
# Reset the user_input in session state
|
| 222 |
st.session_state['user_input'] = ''
|
| 223 |
+
|
| 224 |
+
# Display the conversation history
|
| 225 |
+
for message in st.session_state.history:
|
| 226 |
+
if message['role'] == 'user':
|
| 227 |
+
st.markdown(f"**User:** {message['content']}")
|
| 228 |
+
elif message['role'] == 'assistant':
|
| 229 |
+
if isinstance(message['content'], pd.DataFrame):
|
| 230 |
+
st.markdown("**Assistant:** Query Results:")
|
| 231 |
+
st.dataframe(message['content'])
|
| 232 |
+
else:
|
| 233 |
+
st.markdown(f"**Assistant:** {message['content']}")
|
| 234 |
+
|
| 235 |
+
# Place the input field at the bottom with the callback
|
| 236 |
+
st.text_input("Enter your message:", key='user_input', on_change=process_input)
|