Spaces:
Runtime error
Runtime error
Update ui/components.py
Browse files- ui/components.py +8 -6
ui/components.py
CHANGED
|
@@ -74,10 +74,13 @@ def show_chat_history(chat_history):
|
|
| 74 |
"""Display chat history"""
|
| 75 |
st.subheader("Chat History")
|
| 76 |
for idx, chat in enumerate(chat_history):
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
|
|
|
|
|
|
|
|
|
| 81 |
st.write(chat.get('analysis', ''))
|
| 82 |
if chat.get('question'):
|
| 83 |
st.write(f"Follow-up: {chat['question']}")
|
|
@@ -100,5 +103,4 @@ def show_save_options():
|
|
| 100 |
key="save_chat_name"
|
| 101 |
)
|
| 102 |
save_btn = st.button("Save", key="save_chat_btn")
|
| 103 |
-
return save_name if save_btn else None
|
| 104 |
-
|
|
|
|
| 74 |
"""Display chat history"""
|
| 75 |
st.subheader("Chat History")
|
| 76 |
for idx, chat in enumerate(chat_history):
|
| 77 |
+
# Create a unique identifier for each analysis
|
| 78 |
+
timestamp = chat.get('timestamp', 'No date')
|
| 79 |
+
analysis_type = chat.get('analysis_type', 'Analysis')
|
| 80 |
+
label = f"{analysis_type} from {timestamp[:16]}"
|
| 81 |
+
|
| 82 |
+
expander = st.expander(label)
|
| 83 |
+
with expander:
|
| 84 |
st.write(chat.get('analysis', ''))
|
| 85 |
if chat.get('question'):
|
| 86 |
st.write(f"Follow-up: {chat['question']}")
|
|
|
|
| 103 |
key="save_chat_name"
|
| 104 |
)
|
| 105 |
save_btn = st.button("Save", key="save_chat_btn")
|
| 106 |
+
return save_name if save_btn else None
|
|
|