rsm-roguchi commited on
Commit
2f9d5e4
·
1 Parent(s): b8850dc
data/emails/c143e4c4-0444-45b9-b03f-31c48a310cd0/Alan_White_20250604_161451.pdf ADDED
Binary file (1.66 kB). View file
 
data/emails/c143e4c4-0444-45b9-b03f-31c48a310cd0/Dawn_Osborn_20250604_161443.pdf ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ %PDF-1.3
2
+ 3 0 obj
3
+ <</Type /Page
4
+ /Parent 1 0 R
5
+ /Resources 2 0 R
6
+ /Contents 4 0 R>>
7
+ endobj
8
+ 4 0 obj
9
+ <</Filter /FlateDecode /Length 383>>
10
+ stream
11
+ x�eQ�n�0��+�T�hJm�d�K�3M�,VG�b�_R���> ��yS�ϫ��[�W/T5+K�zx�r��X��v�fm ���O�-<�h���Ț�/����[m0~@mZ���/��AM�E�P��G
12
+ v\�{K�HP���/���� |H ��"-A��Sj8(�� ��9{�O�ٲ��Z���0BO����F���>�$�l�� Z��)��08��V%k���#pb@t���ܟ�dI��k�5r����=iMQ�}Ȍ��B���57�����n�Bp�F�#4��A �[NM9)��� ��^���� '���LZ
13
+ ���O�H&�\�XٜW���T
14
+ F�݌|�v��Ò���%K�f����,�9���aĿ��OU��
15
+ endstream
16
+ endobj
17
+ 1 0 obj
18
+ <</Type /Pages
19
+ /Kids [3 0 R ]
20
+ /Count 1
21
+ /MediaBox [0 0 595.28 841.89]
22
+ >>
23
+ endobj
24
+ 5 0 obj
25
+ <</Type /Font
26
+ /BaseFont /Helvetica
27
+ /Subtype /Type1
28
+ /Encoding /WinAnsiEncoding
29
+ >>
30
+ endobj
31
+ 2 0 obj
32
+ <<
33
+ /ProcSet [/PDF /Text /ImageB /ImageC /ImageI]
34
+ /Font <<
35
+ /F1 5 0 R
36
+ >>
37
+ /XObject <<
38
+ >>
39
+ >>
40
+ endobj
41
+ 6 0 obj
42
+ <<
43
+ /Producer (PyFPDF 1.7.2 http://pyfpdf.googlecode.com/)
44
+ /CreationDate (D:20250604161532)
45
+ >>
46
+ endobj
47
+ 7 0 obj
48
+ <<
49
+ /Type /Catalog
50
+ /Pages 1 0 R
51
+ /OpenAction [3 0 R /FitH null]
52
+ /PageLayout /OneColumn
53
+ >>
54
+ endobj
55
+ xref
56
+ 0 8
57
+ 0000000000 65535 f
58
+ 0000000540 00000 n
59
+ 0000000723 00000 n
60
+ 0000000009 00000 n
61
+ 0000000087 00000 n
62
+ 0000000627 00000 n
63
+ 0000000827 00000 n
64
+ 0000000936 00000 n
65
+ trailer
66
+ <<
67
+ /Size 8
68
+ /Root 7 0 R
69
+ /Info 6 0 R
70
+ >>
71
+ startxref
72
+ 1039
73
+ %%EOF
data/emails/c143e4c4-0444-45b9-b03f-31c48a310cd0/Interview_Emails.zip ADDED
Binary file (1.45 kB). View file
 
data/emails/c143e4c4-0444-45b9-b03f-31c48a310cd0/Jorge_Padilla_20250604_161340.pdf ADDED
Binary file (3.32 kB). View file
 
data/emails/c143e4c4-0444-45b9-b03f-31c48a310cd0/Melanie_Golden_20250604_161447.pdf ADDED
Binary file (2.88 kB). View file
 
server/interview_scheduler.py CHANGED
@@ -5,7 +5,7 @@ import requests
5
  from dotenv import load_dotenv
6
  from shiny import reactive, render, ui
7
 
8
- # Access ../code/context.py
9
 
10
  from context import get_all_candidates
11
  from llm_connect import get_response
@@ -57,6 +57,7 @@ def draft_invite_email_with_llm(name, email, link, job_data):
57
  f"Scheduling Link: {link}\n\n"
58
  f"Write a professional, warm, and concise email inviting the candidate to schedule an interview. "
59
  f"Include the scheduling link. Return only the email body text. No formatting or extra explanation.\n"
 
60
  )
61
 
62
  return get_response(
@@ -191,8 +192,8 @@ def server(input, output, session):
191
  safe_name = f"{c['name'].replace(' ', '_')}_{timestamp}"
192
  filename = f"{safe_name}.pdf"
193
 
194
- # Correct folder: milestone2/data/emails/{job_id}/
195
- output_dir = f"../data/emails/{job_id}"
196
 
197
  os.makedirs(output_dir, exist_ok=True)
198
 
@@ -256,14 +257,7 @@ def server(input, output, session):
256
  if not job_id:
257
  return ui.p("⚠️ No active job selected.")
258
 
259
- file_path = os.path.abspath(
260
- os.path.join(
261
- os.path.dirname(__file__),
262
- "..", "..", "milestone2", "data", "emails", job_id,
263
- os.path.basename(selected)
264
- )
265
- )
266
-
267
 
268
  if not os.path.exists(file_path):
269
  print("❌ File not found on disk.")
@@ -295,7 +289,7 @@ def server(input, output, session):
295
  return None # nothing to download
296
 
297
  job_id = session._memo.get("active_job_id", "").strip()
298
- zip_path = f"../data/emails/{job_id}/Interview_Emails.zip"
299
 
300
  if os.path.exists(zip_path):
301
  os.remove(zip_path)
@@ -318,7 +312,7 @@ def server(input, output, session):
318
  return "⚠️ Select a PDF to edit."
319
 
320
  # Load original text
321
- pdf_path = f"../data/emails/{job_id}/{selected}"
322
 
323
  if not os.path.exists(pdf_path):
324
  return "❌ Could not find the original PDF."
@@ -328,7 +322,7 @@ def server(input, output, session):
328
 
329
  # Call your LLM with edit prompt
330
  full_prompt = (
331
- f"The following is an email invitation:\n\n"
332
  f"{original_text}\n\n"
333
  f"User instruction: {user_instruction}\n\n"
334
  f"Please revise the email accordingly. Return only the revised email."
@@ -343,6 +337,18 @@ def server(input, output, session):
343
  temperature=0.6,
344
  max_tokens=600
345
  )
 
 
 
 
 
 
 
 
 
 
 
 
346
  return revised.strip()
347
  except Exception as e:
348
  return f"❌ LLM failed: {e}"
@@ -356,7 +362,7 @@ def server(input, output, session):
356
  if not selected or not job_id:
357
  return
358
 
359
- file_path = f"../data/emails/{job_id}/{selected}"
360
 
361
  if not os.path.exists(file_path):
362
  return
@@ -377,7 +383,7 @@ def server(input, output, session):
377
  if not selected or not job_id or not new_text:
378
  return
379
 
380
- file_path = f"../data/emails/{job_id}/{selected}"
381
 
382
  pdf = FPDF()
383
  pdf.add_page()
@@ -388,6 +394,8 @@ def server(input, output, session):
388
  pdf.output(file_path)
389
 
390
  print(f"✅ Overwrote PDF: {file_path}")
 
 
391
 
392
  session.send_input_message("selected_pdf", {"value": selected})
393
 
 
5
  from dotenv import load_dotenv
6
  from shiny import reactive, render, ui
7
 
8
+ # Access code/context.py
9
 
10
  from context import get_all_candidates
11
  from llm_connect import get_response
 
57
  f"Scheduling Link: {link}\n\n"
58
  f"Write a professional, warm, and concise email inviting the candidate to schedule an interview. "
59
  f"Include the scheduling link. Return only the email body text. No formatting or extra explanation.\n"
60
+ f"Sign under the company name, DO NOT USE MY NAME"
61
  )
62
 
63
  return get_response(
 
192
  safe_name = f"{c['name'].replace(' ', '_')}_{timestamp}"
193
  filename = f"{safe_name}.pdf"
194
 
195
+ # Correct folder: data/emails/{job_id}/
196
+ output_dir = f"data/emails/{job_id}"
197
 
198
  os.makedirs(output_dir, exist_ok=True)
199
 
 
257
  if not job_id:
258
  return ui.p("⚠️ No active job selected.")
259
 
260
+ file_path = f"data/emails/{job_id}/{selected}"
 
 
 
 
 
 
 
261
 
262
  if not os.path.exists(file_path):
263
  print("❌ File not found on disk.")
 
289
  return None # nothing to download
290
 
291
  job_id = session._memo.get("active_job_id", "").strip()
292
+ zip_path = f"data/emails/{job_id}/Interview_Emails.zip"
293
 
294
  if os.path.exists(zip_path):
295
  os.remove(zip_path)
 
312
  return "⚠️ Select a PDF to edit."
313
 
314
  # Load original text
315
+ pdf_path = f"data/emails/{job_id}/{selected}"
316
 
317
  if not os.path.exists(pdf_path):
318
  return "❌ Could not find the original PDF."
 
322
 
323
  # Call your LLM with edit prompt
324
  full_prompt = (
325
+ f"The following is an email invitation for a first round interview at a company:\n\n"
326
  f"{original_text}\n\n"
327
  f"User instruction: {user_instruction}\n\n"
328
  f"Please revise the email accordingly. Return only the revised email."
 
337
  temperature=0.6,
338
  max_tokens=600
339
  )
340
+
341
+ pdf = FPDF()
342
+ pdf.add_page()
343
+ pdf.set_auto_page_break(auto=True, margin=15)
344
+ pdf.set_font("Arial", size=12)
345
+ for line in revised.strip().split("\n"):
346
+ pdf.multi_cell(0, 10, line)
347
+ pdf.output(pdf_path)
348
+ pdf_files = [f for f in os.listdir(f"data/emails/{job_id}") if f.endswith(".pdf")]
349
+
350
+ ui.update_select("pdf_selector", choices=pdf_files)
351
+ ui.update_text_area("edit_text", value=revised.strip())
352
  return revised.strip()
353
  except Exception as e:
354
  return f"❌ LLM failed: {e}"
 
362
  if not selected or not job_id:
363
  return
364
 
365
+ file_path = f"data/emails/{job_id}/{selected}"
366
 
367
  if not os.path.exists(file_path):
368
  return
 
383
  if not selected or not job_id or not new_text:
384
  return
385
 
386
+ file_path = f"data/emails/{job_id}/{selected}"
387
 
388
  pdf = FPDF()
389
  pdf.add_page()
 
394
  pdf.output(file_path)
395
 
396
  print(f"✅ Overwrote PDF: {file_path}")
397
+ pdf_files = [f for f in os.listdir(f"data/emails/{job_id}") if f.endswith(".pdf")]
398
+ ui.update_select("pdf_selector", choices=pdf_files)
399
 
400
  session.send_input_message("selected_pdf", {"value": selected})
401