remove rejection feedback after onclick
This commit is contained in:
parent
da236ce14e
commit
ea05437154
@ -85,6 +85,12 @@ def _reject_action(feedback: str):
|
|||||||
st.session_state.agent_pending_action = next_action
|
st.session_state.agent_pending_action = next_action
|
||||||
st.session_state.agent_status = "waiting_approval"
|
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):
|
def _followup_agent(question: str):
|
||||||
"""Continue a finished task by injecting a follow-up question and resuming the loop."""
|
"""Continue a finished task by injecting a follow-up question and resuming the loop."""
|
||||||
@ -225,7 +231,10 @@ def render_agent_mode():
|
|||||||
if args:
|
if args:
|
||||||
_render_arguments(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):",
|
"Rejection feedback (optional):",
|
||||||
key="agent_reject_feedback",
|
key="agent_reject_feedback",
|
||||||
placeholder="e.g. Use a different approach...",
|
placeholder="e.g. Use a different approach...",
|
||||||
@ -238,10 +247,11 @@ def render_agent_mode():
|
|||||||
_approve_action()
|
_approve_action()
|
||||||
st.rerun()
|
st.rerun()
|
||||||
with col2:
|
with col2:
|
||||||
if st.button("Reject", use_container_width=True):
|
st.button(
|
||||||
with st.spinner("Agent is replanning..."):
|
"Reject",
|
||||||
_reject_action(feedback)
|
use_container_width=True,
|
||||||
st.rerun()
|
on_click=_handle_reject,
|
||||||
|
)
|
||||||
with col3:
|
with col3:
|
||||||
if st.button("Abort Task", use_container_width=True):
|
if st.button("Abort Task", use_container_width=True):
|
||||||
_reset_agent()
|
_reset_agent()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user