Miquel Farré commited on
Commit ·
0185d4a
1
Parent(s): 2defc46
changing behavior after failure
Browse files483 unmodified lines484485486487488489490491492493483 unmodified linesoutputs=results_output)# 3. Then set back to interactive modetask_result.then(fn=set_interactive_mode,inputs=None, # No inputs needed hereoutputs=html_output)483 unmodified lines484485486487488489490491492493494495496497498499500501502503504505506507508509483 unmodified linesoutputs=results_output)# # 3. Then set back to interactive mode# task_result.then(# fn=set_interactive_mode,# inputs=None, # No inputs needed here# outputs=html_output# )# 3. Define a function to check the result and only return to interactive mode if successfuldef check_result_and_set_mode(result, request: gr.Request):# Only switch back to interactive mode if the agent completed successfullyif result.startswith("Task completed:"):return update_html(True, request)else:# Keep the view-only mode (with BSOD displayed by JS)return None# 3. Then conditionally set back to interactive mode based on successtask_result.then(fn=check_result_and_set_mode,inputs=[results_output], # Pass the result text to checkoutputs=html_output)
app.py+19-3