Ludovicollin commited on
Commit
bb647a9
Β·
1 Parent(s): 7c0e87c

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +19 -2
main.py CHANGED
@@ -102,12 +102,12 @@ async def on_action(action):
102
  content.append(action.value)
103
  arrayContent = np.array(content)
104
  df = pd.DataFrame(arrayContent)
105
- with open('.chainlit/' + action.description + '.txt', 'wb') as csv_file:
106
  df.to_csv(path_or_buf=csv_file, index=False,header=False, encoding='utf-8')
107
  elements = [
108
  cl.File(
109
  name= action.description + ".txt",
110
- path="./.chainlit/" + action.description + ".txt",
111
  display="inline",
112
  ),
113
  ]
@@ -367,10 +367,15 @@ async def setup_agent(settings):
367
  ).send()
368
  cl.user_session.set("NCS" + romeListArray[0], completion_NCS.completion)
369
  listEmplois_name = f"Liste des emplois"
 
370
  text_elements.append(
371
  cl.Text(content="Question : " + romeListArray[0] + "\n\nRΓ©ponse :\n" + context, name=listEmplois_name)
372
  )
373
  await cl.Message(author="🌐🌐🌐",content="Source PΓ΄le Emploi : " + listEmplois_name, elements=text_elements).send()
 
 
 
 
374
  elif settings['type'] == 'Fiche synoptique - FCS':
375
  if cl.user_session.get("NCS" + romeListArray[0]):
376
  FCS = cl.TaskList()
@@ -443,6 +448,10 @@ async def setup_agent(settings):
443
  ).send()
444
  await cl.sleep(2)
445
  await FCS.remove()
 
 
 
 
446
  else:
447
  await cl.Message(
448
  author="🌐🌐🌐",content="β›” Vous n'avez pas encore créé de Note sectorielle!"
@@ -481,6 +490,10 @@ async def setup_agent(settings):
481
  cl.user_session.set("FCA" + romeListArray[0], completion_FCA.completion)
482
  await cl.sleep(2)
483
  await FCA.remove()
 
 
 
 
484
  else:
485
  await cl.Message(
486
  author="🌐🌐🌐",content="β›” Vous n'avez pas encore créé de Fiche synoptique!"
@@ -519,6 +532,10 @@ async def setup_agent(settings):
519
  cl.user_session.set("FCC" + romeListArray[0], completion_FCC.completion)
520
  await cl.sleep(2)
521
  await FCC.remove()
 
 
 
 
522
  else:
523
  await cl.Message(
524
  author="🌐🌐🌐",content="β›” Vous n'avez pas encore créé de Fiche synoptique!"
 
102
  content.append(action.value)
103
  arrayContent = np.array(content)
104
  df = pd.DataFrame(arrayContent)
105
+ with open('./' + action.description + '.txt', 'wb') as csv_file:
106
  df.to_csv(path_or_buf=csv_file, index=False,header=False, encoding='utf-8')
107
  elements = [
108
  cl.File(
109
  name= action.description + ".txt",
110
+ path="./" + action.description + ".txt",
111
  display="inline",
112
  ),
113
  ]
 
367
  ).send()
368
  cl.user_session.set("NCS" + romeListArray[0], completion_NCS.completion)
369
  listEmplois_name = f"Liste des emplois"
370
+ text_elements = []
371
  text_elements.append(
372
  cl.Text(content="Question : " + romeListArray[0] + "\n\nRΓ©ponse :\n" + context, name=listEmplois_name)
373
  )
374
  await cl.Message(author="🌐🌐🌐",content="Source PΓ΄le Emploi : " + listEmplois_name, elements=text_elements).send()
375
+ actions = [
376
+ cl.Action(name="download", value=completion_NCS.completion, description="download_note_sectorielle")
377
+ ]
378
+ await cl.Message(author="🌐🌐🌐",content="Download", actions=actions).send()
379
  elif settings['type'] == 'Fiche synoptique - FCS':
380
  if cl.user_session.get("NCS" + romeListArray[0]):
381
  FCS = cl.TaskList()
 
448
  ).send()
449
  await cl.sleep(2)
450
  await FCS.remove()
451
+ actions = [
452
+ cl.Action(name="download", value=completion_NCS.completion, description="download_fiche_synoptique")
453
+ ]
454
+ await cl.Message(author="🌐🌐🌐",content="Download", actions=actions).send()
455
  else:
456
  await cl.Message(
457
  author="🌐🌐🌐",content="β›” Vous n'avez pas encore créé de Note sectorielle!"
 
490
  cl.user_session.set("FCA" + romeListArray[0], completion_FCA.completion)
491
  await cl.sleep(2)
492
  await FCA.remove()
493
+ actions = [
494
+ cl.Action(name="download", value=completion_NCS.completion, description="download_fiche_activite")
495
+ ]
496
+ await cl.Message(author="🌐🌐🌐",content="Download", actions=actions).send()
497
  else:
498
  await cl.Message(
499
  author="🌐🌐🌐",content="β›” Vous n'avez pas encore créé de Fiche synoptique!"
 
532
  cl.user_session.set("FCC" + romeListArray[0], completion_FCC.completion)
533
  await cl.sleep(2)
534
  await FCC.remove()
535
+ actions = [
536
+ cl.Action(name="download", value=completion_NCS.completion, description="download_fiche_competence")
537
+ ]
538
+ await cl.Message(author="🌐🌐🌐",content="Download", actions=actions).send()
539
  else:
540
  await cl.Message(
541
  author="🌐🌐🌐",content="β›” Vous n'avez pas encore créé de Fiche synoptique!"