remove rejection feedback after onclick

This commit is contained in:
Irina Rueegg 2026-05-28 10:10:25 +02:00
parent da236ce14e
commit ea05437154

View File

@ -85,6 +85,12 @@ def _reject_action(feedback: str):
st.session_state.agent_pending_action = next_action
st.session_state.agent_status = "waiting_approval"
def _handle_reject():
feedback = st.session_state.agent_reject_feedback
with st.spinner("Agent is replanning..."):
_reject_action(feedback)
st.session_state.agent_reject_feedback = ""
def _followup_agent(question: str):
"""Continue a finished task by injecting a follow-up question and resuming the loop."""
@ -225,7 +231,10 @@ def render_agent_mode():
if args:
_render_arguments(args)
feedback = st.text_input(
if "agent_reject_feedback" not in st.session_state:
st.session_state.agent_reject_feedback = ""
st.text_input(
"Rejection feedback (optional):",
key="agent_reject_feedback",
placeholder="e.g. Use a different approach...",
@ -238,10 +247,11 @@ def render_agent_mode():
_approve_action()
st.rerun()
with col2:
if st.button("Reject", use_container_width=True):
with st.spinner("Agent is replanning..."):
_reject_action(feedback)
st.rerun()
st.button(
"Reject",
use_container_width=True,
on_click=_handle_reject,
)
with col3:
if st.button("Abort Task", use_container_width=True):
_reset_agent()