Spaces:
Paused
Paused
Update app.py via AI Editor
Browse files
app.py
CHANGED
@@ -499,26 +499,6 @@ app.layout = dbc.Container([
|
|
499 |
], style={'marginTop':'20px'})
|
500 |
], fluid=True)
|
501 |
|
502 |
-
@app.callback(
|
503 |
-
Output('preview-window-state', 'data'),
|
504 |
-
[
|
505 |
-
Input('shred-action-btn', 'n_clicks'),
|
506 |
-
Input('proposal-action-btn', 'n_clicks'),
|
507 |
-
Input('compliance-action-btn', 'n_clicks'),
|
508 |
-
Input('recover-action-btn', 'n_clicks'),
|
509 |
-
Input('board-action-btn', 'n_clicks'),
|
510 |
-
Input('loe-action-btn', 'n_clicks')
|
511 |
-
],
|
512 |
-
prevent_initial_call=True
|
513 |
-
)
|
514 |
-
def shrink_preview_window_on_action(
|
515 |
-
shred_clicks, proposal_clicks, compliance_clicks, recover_clicks, board_clicks, loe_clicks
|
516 |
-
):
|
517 |
-
ctx = callback_context
|
518 |
-
if ctx.triggered:
|
519 |
-
return "shrunk"
|
520 |
-
return dash.no_update
|
521 |
-
|
522 |
@app.callback(
|
523 |
Output('output-preview-container', 'style'),
|
524 |
[Input('preview-window-state', 'data')]
|
@@ -556,6 +536,7 @@ def update_preview_window_style(state):
|
|
556 |
Input('compliance-action-btn', 'n_clicks'),
|
557 |
Input('recover-action-btn', 'n_clicks'),
|
558 |
Input('board-action-btn', 'n_clicks'),
|
|
|
559 |
Input('upload-document', 'contents'),
|
560 |
State('upload-document', 'filename'),
|
561 |
Input({'type': 'delete-doc-btn', 'index': ALL, 'group': 'doc'}, 'n_clicks'),
|
@@ -571,7 +552,7 @@ def update_preview_window_style(state):
|
|
571 |
prevent_initial_call=True
|
572 |
)
|
573 |
def master_callback(
|
574 |
-
shred_clicks, proposal_clicks, compliance_clicks, recover_clicks, board_clicks,
|
575 |
rfp_content, rfp_filename, doc_delete_clicks, selected_doc,
|
576 |
proposal_content, proposal_filename, proposal_delete_clicks, selected_proposal,
|
577 |
chat_input, cancel_clicks, preview_window_state
|
@@ -585,13 +566,12 @@ def master_callback(
|
|
585 |
except Exception:
|
586 |
return []
|
587 |
|
588 |
-
doc_delete_clicks = safe_get_n_clicks(ctx,
|
589 |
-
proposal_delete_clicks = safe_get_n_clicks(ctx,
|
590 |
uploaded_rfp_decoded_bytes = None
|
591 |
|
592 |
global gemini_lock, uploaded_documents_bytes
|
593 |
|
594 |
-
# If an action button is clicked, immediately shrink window, do nothing else (let other callback run)
|
595 |
if triggered_id in [
|
596 |
'shred-action-btn', 'proposal-action-btn', 'compliance-action-btn',
|
597 |
'recover-action-btn', 'board-action-btn', 'loe-action-btn'
|
@@ -648,7 +628,7 @@ def master_callback(
|
|
648 |
if triggered_id and isinstance(doc_delete_clicks, list):
|
649 |
for i, n_click in enumerate(doc_delete_clicks):
|
650 |
if n_click:
|
651 |
-
btn_id = ctx.inputs_list[
|
652 |
del_filename = btn_id['index']
|
653 |
if del_filename in uploaded_documents:
|
654 |
del uploaded_documents[del_filename]
|
@@ -671,7 +651,7 @@ def master_callback(
|
|
671 |
if triggered_id and isinstance(proposal_delete_clicks, list):
|
672 |
for i, n_click in enumerate(proposal_delete_clicks):
|
673 |
if n_click:
|
674 |
-
btn_id = ctx.inputs_list[
|
675 |
del_filename = btn_id['index']
|
676 |
if del_filename in proposals:
|
677 |
del proposals[del_filename]
|
|
|
499 |
], style={'marginTop':'20px'})
|
500 |
], fluid=True)
|
501 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
502 |
@app.callback(
|
503 |
Output('output-preview-container', 'style'),
|
504 |
[Input('preview-window-state', 'data')]
|
|
|
536 |
Input('compliance-action-btn', 'n_clicks'),
|
537 |
Input('recover-action-btn', 'n_clicks'),
|
538 |
Input('board-action-btn', 'n_clicks'),
|
539 |
+
Input('loe-action-btn', 'n_clicks'),
|
540 |
Input('upload-document', 'contents'),
|
541 |
State('upload-document', 'filename'),
|
542 |
Input({'type': 'delete-doc-btn', 'index': ALL, 'group': 'doc'}, 'n_clicks'),
|
|
|
552 |
prevent_initial_call=True
|
553 |
)
|
554 |
def master_callback(
|
555 |
+
shred_clicks, proposal_clicks, compliance_clicks, recover_clicks, board_clicks, loe_clicks,
|
556 |
rfp_content, rfp_filename, doc_delete_clicks, selected_doc,
|
557 |
proposal_content, proposal_filename, proposal_delete_clicks, selected_proposal,
|
558 |
chat_input, cancel_clicks, preview_window_state
|
|
|
566 |
except Exception:
|
567 |
return []
|
568 |
|
569 |
+
doc_delete_clicks = safe_get_n_clicks(ctx, 8)
|
570 |
+
proposal_delete_clicks = safe_get_n_clicks(ctx, 12)
|
571 |
uploaded_rfp_decoded_bytes = None
|
572 |
|
573 |
global gemini_lock, uploaded_documents_bytes
|
574 |
|
|
|
575 |
if triggered_id in [
|
576 |
'shred-action-btn', 'proposal-action-btn', 'compliance-action-btn',
|
577 |
'recover-action-btn', 'board-action-btn', 'loe-action-btn'
|
|
|
628 |
if triggered_id and isinstance(doc_delete_clicks, list):
|
629 |
for i, n_click in enumerate(doc_delete_clicks):
|
630 |
if n_click:
|
631 |
+
btn_id = ctx.inputs_list[8][i]['id']
|
632 |
del_filename = btn_id['index']
|
633 |
if del_filename in uploaded_documents:
|
634 |
del uploaded_documents[del_filename]
|
|
|
651 |
if triggered_id and isinstance(proposal_delete_clicks, list):
|
652 |
for i, n_click in enumerate(proposal_delete_clicks):
|
653 |
if n_click:
|
654 |
+
btn_id = ctx.inputs_list[12][i]['id']
|
655 |
del_filename = btn_id['index']
|
656 |
if del_filename in proposals:
|
657 |
del proposals[del_filename]
|