Spaces:
Running
Running
Asish Karthikeya Gogineni commited on
Commit ·
7579835
1
Parent(s): e82a017
fix: Wire up 'Try asking' suggestion buttons to chat
Browse files- Added pending_prompt handling in app.py
- When suggestion button is clicked, it now properly triggers the chat
- Clears pending_prompt after use
app.py
CHANGED
|
@@ -553,8 +553,17 @@ else:
|
|
| 553 |
# Use unsafe_allow_html in case any formatted content exists
|
| 554 |
st.markdown(msg["content"], unsafe_allow_html=True)
|
| 555 |
|
| 556 |
-
#
|
| 557 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 558 |
st.session_state.messages.append({"role": "user", "content": prompt})
|
| 559 |
with st.chat_message("user"):
|
| 560 |
st.markdown(prompt)
|
|
|
|
| 553 |
# Use unsafe_allow_html in case any formatted content exists
|
| 554 |
st.markdown(msg["content"], unsafe_allow_html=True)
|
| 555 |
|
| 556 |
+
# Handle pending prompt from suggestion buttons
|
| 557 |
+
prompt = None
|
| 558 |
+
if st.session_state.get("pending_prompt"):
|
| 559 |
+
prompt = st.session_state.pending_prompt
|
| 560 |
+
st.session_state.pending_prompt = None # Clear it
|
| 561 |
+
|
| 562 |
+
# Input - also check for pending prompt
|
| 563 |
+
if not prompt:
|
| 564 |
+
prompt = st.chat_input("How does the authentication work?")
|
| 565 |
+
|
| 566 |
+
if prompt:
|
| 567 |
st.session_state.messages.append({"role": "user", "content": prompt})
|
| 568 |
with st.chat_message("user"):
|
| 569 |
st.markdown(prompt)
|