abidkh commited on
Commit
d58f7d4
Β·
1 Parent(s): bc5f9ef

History in headings

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -29,10 +29,10 @@ elif mode == "Health Q&A":
29
  save_interaction("Health Q&A", question, response)
30
  st.session_state.history.append(("Health Q&A", question, response))
31
 
32
- # Show history
33
  with st.expander("πŸ“œ Show Previous Interactions"):
34
- for m, q, r in st.session_state.history[::-1]:
35
- st.markdown(f"**Mode**: {m}")
36
- st.markdown(f"**Input**: {q}")
37
- st.markdown(f"**Response**: {r}")
38
- st.markdown("---")
 
29
  save_interaction("Health Q&A", question, response)
30
  st.session_state.history.append(("Health Q&A", question, response))
31
 
32
+ # Show history as clickable expandable headers
33
  with st.expander("πŸ“œ Show Previous Interactions"):
34
+ for mode, query, response in st.session_state.history[::-1]:
35
+ heading = f"[{mode}] {query[:80]}{'...' if len(query) > 80 else ''}"
36
+ with st.expander(heading):
37
+ st.markdown("**Diagnosis / Answer:**")
38
+ st.write(response)