bluenevus commited on
Commit
d57ffe2
·
1 Parent(s): cc1c8fe

Update app.py via AI Editor

Browse files
Files changed (1) hide show
  1. app.py +16 -22
app.py CHANGED
@@ -23,8 +23,8 @@ CLAUDE3_SONNET_MODEL = "claude-3-7-sonnet-20250219"
23
  CLAUDE3_MAX_CONTEXT_TOKENS = 200_000
24
  CLAUDE3_MAX_OUTPUT_TOKENS = 64_000
25
 
26
- uploaded_documents = {}
27
- uploaded_proposals = {}
28
  shredded_document = None
29
  generated_response = None
30
 
@@ -212,8 +212,7 @@ app.layout = dbc.Container([
212
  'margin': '10px'
213
  },
214
  multiple=False
215
- ),
216
- html.Div(id='output-document-upload')
217
  ])
218
  ], className="mb-3"),
219
 
@@ -245,11 +244,10 @@ app.layout = dbc.Container([
245
  'margin': '10px'
246
  },
247
  multiple=False
248
- ),
249
- html.Div(id='output-proposal-upload')
250
  ])
251
  ])
252
- ], width=3, style={'minWidth': '260px'}),
253
 
254
  dbc.Col([
255
  dbc.Card([
@@ -259,13 +257,13 @@ app.layout = dbc.Container([
259
  dbc.Textarea(id="chat-input", placeholder="Enter additional instructions...", style={"width":"100%", "wordWrap": "break-word"}, className="mb-2"),
260
  ]),
261
  html.Div([
262
- dbc.Button("Shred", id="shred-action-btn", className="mr-2 btn-primary"),
263
- dbc.Button("Generate", id="generate-action-btn", className="mr-2 btn-secondary"),
264
- dbc.Button("Check Compliance", id="compliance-action-btn", className="mr-2 btn-tertiary"),
265
- dbc.Button("Recover", id="recover-action-btn", className="mr-2 btn-tertiary"),
266
- dbc.Button("Virtual Board", id="board-action-btn", className="mr-2 btn-tertiary"),
267
- dbc.Button("LOE", id="loe-action-btn", className="btn-tertiary"),
268
- ], className="mt-3 mb-3"),
269
  dcc.Loading(
270
  id="loading",
271
  type="default",
@@ -274,7 +272,7 @@ app.layout = dbc.Container([
274
  )
275
  ])
276
  ], style={'backgroundColor': 'white'})
277
- ], width=9)
278
  ], style={'marginTop':'20px'})
279
  ], fluid=True)
280
 
@@ -303,9 +301,9 @@ def update_uploaded_docs(
303
  ):
304
  ctx = callback_context
305
  triggered = ctx.triggered
306
- changed_id = ""
307
- output_document_upload = ""
308
- output_proposal_upload = ""
309
 
310
  if rfp_content is not None and rfp_filename:
311
  content_type, content_string = rfp_content.split(',')
@@ -313,10 +311,8 @@ def update_uploaded_docs(
313
  text = decode_document(decoded)
314
  if text is not None:
315
  uploaded_documents[rfp_filename] = text
316
- output_document_upload = html.Div(f"Document '{rfp_filename}' uploaded successfully.", style={"wordWrap": "break-word"})
317
  logging.info(f"Document uploaded: {rfp_filename}")
318
  else:
319
- output_document_upload = html.Div("Error: Could not decode document. Please upload a valid text file.", style={"wordWrap": "break-word"})
320
  logging.error(f"Failed to decode uploaded document: {rfp_filename}")
321
 
322
  if proposal_content is not None and proposal_filename:
@@ -325,10 +321,8 @@ def update_uploaded_docs(
325
  text = decode_document(decoded)
326
  if text is not None:
327
  uploaded_proposals[proposal_filename] = text
328
- output_proposal_upload = html.Div(f"Proposal '{proposal_filename}' uploaded successfully.", style={"wordWrap": "break-word"})
329
  logging.info(f"Proposal uploaded: {proposal_filename}")
330
  else:
331
- output_proposal_upload = html.Div("Error: Could not decode proposal. Please upload a valid text file.", style={"wordWrap": "break-word"})
332
  logging.error(f"Failed to decode uploaded proposal: {proposal_filename}")
333
 
334
  if rfp_delete_clicks:
 
23
  CLAUDE3_MAX_CONTEXT_TOKENS = 200_000
24
  CLAUDE3_MAX_OUTPUT_TOKENS = 64_000
25
 
26
+ uploaded_documents = {}
27
+ uploaded_proposals = {}
28
  shredded_document = None
29
  generated_response = None
30
 
 
212
  'margin': '10px'
213
  },
214
  multiple=False
215
+ )
 
216
  ])
217
  ], className="mb-3"),
218
 
 
244
  'margin': '10px'
245
  },
246
  multiple=False
247
+ )
 
248
  ])
249
  ])
250
+ ], style={'minWidth': '260px', 'width':'30vw','maxWidth':'30vw'}, width=3),
251
 
252
  dbc.Col([
253
  dbc.Card([
 
257
  dbc.Textarea(id="chat-input", placeholder="Enter additional instructions...", style={"width":"100%", "wordWrap": "break-word"}, className="mb-2"),
258
  ]),
259
  html.Div([
260
+ dbc.Button("Shred", id="shred-action-btn", className="me-2 mb-2 btn-primary"),
261
+ dbc.Button("Proposal", id="generate-action-btn", className="me-2 mb-2 btn-secondary"),
262
+ dbc.Button("Compliance", id="compliance-action-btn", className="me-2 mb-2 btn-tertiary"),
263
+ dbc.Button("Recover", id="recover-action-btn", className="me-2 mb-2 btn-tertiary"),
264
+ dbc.Button("Virtual Board", id="board-action-btn", className="me-2 mb-2 btn-tertiary"),
265
+ dbc.Button("LOE", id="loe-action-btn", className="mb-2 btn-tertiary"),
266
+ ], className="mt-3 mb-3 d-flex flex-wrap"),
267
  dcc.Loading(
268
  id="loading",
269
  type="default",
 
272
  )
273
  ])
274
  ], style={'backgroundColor': 'white'})
275
+ ], style={'width':'70vw','maxWidth':'70vw'}, width=9)
276
  ], style={'marginTop':'20px'})
277
  ], fluid=True)
278
 
 
301
  ):
302
  ctx = callback_context
303
  triggered = ctx.triggered
304
+
305
+ output_document_upload = None
306
+ output_proposal_upload = None
307
 
308
  if rfp_content is not None and rfp_filename:
309
  content_type, content_string = rfp_content.split(',')
 
311
  text = decode_document(decoded)
312
  if text is not None:
313
  uploaded_documents[rfp_filename] = text
 
314
  logging.info(f"Document uploaded: {rfp_filename}")
315
  else:
 
316
  logging.error(f"Failed to decode uploaded document: {rfp_filename}")
317
 
318
  if proposal_content is not None and proposal_filename:
 
321
  text = decode_document(decoded)
322
  if text is not None:
323
  uploaded_proposals[proposal_filename] = text
 
324
  logging.info(f"Proposal uploaded: {proposal_filename}")
325
  else:
 
326
  logging.error(f"Failed to decode uploaded proposal: {proposal_filename}")
327
 
328
  if rfp_delete_clicks: