Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
|
2 |
import os
|
3 |
import time
|
4 |
import re
|
@@ -78,16 +78,6 @@ with col2:
|
|
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 i, q in enumerate(followups):
|
87 |
-
if st.button(f"🔁 {q}", key=f"followup-{i}-{q[:10]}"):
|
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 |
|
@@ -146,4 +136,4 @@ with col2:
|
|
146 |
st.rerun()
|
147 |
|
148 |
except Exception as e:
|
149 |
-
st.error(f"❌ Error: {str(e)}")
|
|
|
1 |
+
Import streamlit as st
|
2 |
import os
|
3 |
import time
|
4 |
import re
|
|
|
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 |
|
|
|
136 |
st.rerun()
|
137 |
|
138 |
except Exception as e:
|
139 |
+
st.error(f"❌ Error: {str(e)}")
|