Spaces:
Sleeping
Sleeping
GitHub Actions commited on
Commit ·
fac1b6d
1
Parent(s): 294842f
🚀 Automated sync from GitHub
Browse files
app.py
CHANGED
|
@@ -135,6 +135,14 @@ def clear_pending(language_filter, dialect_filter):
|
|
| 135 |
return f"Clear failed: {exc}", refresh_pending(language_filter, dialect_filter)
|
| 136 |
|
| 137 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 138 |
def refresh_history(start_date, end_date, contract_filter):
|
| 139 |
try:
|
| 140 |
selected = contract_filter or ["PureBi"]
|
|
@@ -211,7 +219,9 @@ with gr.Blocks(title="PureKITchat Admin Mirror") as demo:
|
|
| 211 |
)
|
| 212 |
reject_custom = gr.Textbox(label="Custom Reason")
|
| 213 |
reject_btn = gr.Button("Reject Selected", variant="stop")
|
| 214 |
-
|
|
|
|
|
|
|
| 215 |
pending_status = gr.Textbox(label="Audit Log", interactive=False)
|
| 216 |
|
| 217 |
with gr.Tab("PureChain History"):
|
|
@@ -272,6 +282,7 @@ with gr.Blocks(title="PureKITchat Admin Mirror") as demo:
|
|
| 272 |
[timestamp, original_utt, reject_reason, reject_custom, pending_language, pending_dialect],
|
| 273 |
[pending_status, pending_df],
|
| 274 |
)
|
|
|
|
| 275 |
clear_btn.click(clear_pending, [pending_language, pending_dialect], [pending_status, pending_df])
|
| 276 |
history_refresh.click(refresh_history, [history_start, history_end, history_contracts], history_df)
|
| 277 |
rejected_refresh.click(refresh_rejected, None, rejected_df)
|
|
|
|
| 135 |
return f"Clear failed: {exc}", refresh_pending(language_filter, dialect_filter)
|
| 136 |
|
| 137 |
|
| 138 |
+
def undo_last_admin_action(language_filter, dialect_filter):
|
| 139 |
+
try:
|
| 140 |
+
result = call_polyglot("/admin_undo_last_action")
|
| 141 |
+
return str(result), refresh_pending(language_filter, dialect_filter)
|
| 142 |
+
except Exception as exc:
|
| 143 |
+
return f"Undo failed: {exc}", refresh_pending(language_filter, dialect_filter)
|
| 144 |
+
|
| 145 |
+
|
| 146 |
def refresh_history(start_date, end_date, contract_filter):
|
| 147 |
try:
|
| 148 |
selected = contract_filter or ["PureBi"]
|
|
|
|
| 219 |
)
|
| 220 |
reject_custom = gr.Textbox(label="Custom Reason")
|
| 221 |
reject_btn = gr.Button("Reject Selected", variant="stop")
|
| 222 |
+
with gr.Row():
|
| 223 |
+
undo_btn = gr.Button("Undo Last Approval/Rejection", variant="secondary")
|
| 224 |
+
clear_btn = gr.Button("Sweep All Pending", variant="secondary")
|
| 225 |
pending_status = gr.Textbox(label="Audit Log", interactive=False)
|
| 226 |
|
| 227 |
with gr.Tab("PureChain History"):
|
|
|
|
| 282 |
[timestamp, original_utt, reject_reason, reject_custom, pending_language, pending_dialect],
|
| 283 |
[pending_status, pending_df],
|
| 284 |
)
|
| 285 |
+
undo_btn.click(undo_last_admin_action, [pending_language, pending_dialect], [pending_status, pending_df])
|
| 286 |
clear_btn.click(clear_pending, [pending_language, pending_dialect], [pending_status, pending_df])
|
| 287 |
history_refresh.click(refresh_history, [history_start, history_end, history_contracts], history_df)
|
| 288 |
rejected_refresh.click(refresh_rejected, None, rejected_df)
|