cryogenic22 commited on
Commit
4dc6b1e
·
verified ·
1 Parent(s): 0c965b4

Update ui/components.py

Browse files
Files changed (1) hide show
  1. 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
- with st.expander(
78
- f"Analysis {idx + 1} - {chat.get('timestamp', 'No date')}",
79
- key=f"chat_expander_{idx}"
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