IAMTFRMZA commited on
Commit
0a5b400
·
verified ·
1 Parent(s): 7852a85

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -0
app.py CHANGED
@@ -78,6 +78,16 @@ with col2:
78
  with st.chat_message(msg["role"]):
79
  st.write(msg["content"])
80
 
 
 
 
 
 
 
 
 
 
 
81
  if prompt:
82
  st.session_state.messages.append({"role": "user", "content": prompt})
83
 
 
78
  with st.chat_message(msg["role"]):
79
  st.write(msg["content"])
80
 
81
+ # ✅ Extract and render follow-up questions as buttons (from assistant)
82
+ if msg["role"] == "assistant":
83
+ followups = re.findall(r"[-•*] (What|How|Are|Is|Does|Can|When|Where|Why)[^\n]+", msg["content"])
84
+ if followups:
85
+ st.markdown("#### 💡 Ask a Follow-up:")
86
+ for q in followups:
87
+ if st.button(f"🔁 {q}", key=f"followup-{q}"):
88
+ st.session_state.messages.append({"role": "user", "content": q})
89
+ st.rerun()
90
+
91
  if prompt:
92
  st.session_state.messages.append({"role": "user", "content": prompt})
93