mbosse99 commited on
Commit
fb1b9df
·
1 Parent(s): 0d3f37f

Update for pre generated workflow

Browse files
Files changed (1) hide show
  1. app.py +18 -3
app.py CHANGED
@@ -16,6 +16,8 @@ os_mail_password = os.getenv("MAIL_PASSWORD")
16
 
17
  with open("sys_prompt.txt") as f:
18
  sys_prompt = f.read()
 
 
19
 
20
  get_window_url_params = """
21
  function(job, resume, job_params) {
@@ -39,6 +41,8 @@ def get_job_data_from_db(job_id, can_id):
39
  WHERE c.id = '{job_id}'
40
  """
41
  job_data = list(container.query_items(query=query, enable_cross_partition_query=True))[0]
 
 
42
  return job_data["title"], job_data["evaluation_email"], job_data["question_one"],job_data["question_two"],job_data["question_three"], can_id
43
  except Exception as e:
44
  print(f"Fehler beim laden der Job Daten: {str(e)}")
@@ -189,7 +193,9 @@ def bot(history, job, resume, job_params):
189
  if not resume or not job:
190
  yield history
191
  return
 
192
  if len(job_params[2])>0 or len(job_params[3])>0 or len(job_params[4])>0:
 
193
  questions_combined = ""
194
  if len(job_params[2])>0:
195
  questions_combined += "-"+job_params[2]+"\n"
@@ -200,9 +206,18 @@ def bot(history, job, resume, job_params):
200
 
201
  extension_text = "The recruiter has predefined the following question(s): \n\n" + questions_combined + "\nPlease ask these questions one after the other first and only then generate your own questions so that you get a total of 10 questions together with the predefined ones."
202
 
203
- system = sys_prompt.format(job=job, resume=resume, n=10, extension=extension_text)
 
 
 
 
 
 
 
 
204
  else:
205
- system = sys_prompt.format(job=job, resume=resume, n=10, extension="")
 
206
 
207
  messages = [{"role": "system", "content": system}]
208
  for user, assistant in history:
@@ -367,4 +382,4 @@ with gr.Blocks(css=css) as app:
367
  clr.click(lambda: None, None, chat, queue=False)
368
 
369
  app.queue()
370
- app.launch()
 
16
 
17
  with open("sys_prompt.txt") as f:
18
  sys_prompt = f.read()
19
+ with open("sys_prompt_pre_questions.txt") as fg:
20
+ sys_prompt_pre_generated = fg.read()
21
 
22
  get_window_url_params = """
23
  function(job, resume, job_params) {
 
41
  WHERE c.id = '{job_id}'
42
  """
43
  job_data = list(container.query_items(query=query, enable_cross_partition_query=True))[0]
44
+ if "pre_generated" in job_data:
45
+ return job_data["title"], job_data["evaluation_email"], job_data["question_one"],job_data["question_two"],job_data["question_three"], can_id, job_data["pre_generated"], job_data["custom_questions"]
46
  return job_data["title"], job_data["evaluation_email"], job_data["question_one"],job_data["question_two"],job_data["question_three"], can_id
47
  except Exception as e:
48
  print(f"Fehler beim laden der Job Daten: {str(e)}")
 
193
  if not resume or not job:
194
  yield history
195
  return
196
+ extension_text = ""
197
  if len(job_params[2])>0 or len(job_params[3])>0 or len(job_params[4])>0:
198
+ print("ich habe eine extra Frage")
199
  questions_combined = ""
200
  if len(job_params[2])>0:
201
  questions_combined += "-"+job_params[2]+"\n"
 
206
 
207
  extension_text = "The recruiter has predefined the following question(s): \n\n" + questions_combined + "\nPlease ask these questions one after the other first and only then generate your own questions so that you get a total of 10 questions together with the predefined ones."
208
 
209
+ if len(job_params)>7:
210
+ print("in der neuen Struktur")
211
+ if job_params[6]:
212
+ print("mit pre fragen")
213
+ final_question_string = "\n".join(job_params[7])
214
+ system = sys_prompt_pre_generated.format(job=job, resume=resume,questions=final_question_string)
215
+ else:
216
+ print("neue struktur keine Fragen")
217
+ system = sys_prompt.format(job=job, resume=resume, n=10, extension=extension_text)
218
  else:
219
+ print("alte Struktur")
220
+ system = sys_prompt.format(job=job, resume=resume, n=10, extension=extension_text)
221
 
222
  messages = [{"role": "system", "content": system}]
223
  for user, assistant in history:
 
382
  clr.click(lambda: None, None, chat, queue=False)
383
 
384
  app.queue()
385
+ app.launch()