Sa-m commited on
Commit
dd141a2
·
verified ·
1 Parent(s): 7d556ef

Update interview_logic.py

Browse files
Files changed (1) hide show
  1. interview_logic.py +7 -13
interview_logic.py CHANGED
@@ -509,24 +509,22 @@ def process_resume_logic(file_obj):
509
  }
510
  }
511
 
512
-
513
  def start_interview_logic(roles, processed_resume_data, text_model):
514
  """Starts the interview process logic."""
515
  if not roles or (isinstance(roles, list) and not any(roles)) or not processed_resume_data or not processed_resume_data.strip():
516
  return {
517
  "status": "Please select a role and ensure resume is processed.",
518
  "initial_question": "",
519
- "all_questions": "",
520
  "interview_state": {},
521
  "ui_updates": {
522
- "audio_input": "gr_show",
523
- "submit_answer_btn": "gr_show",
524
  "next_question_btn": "gr_hide",
525
  "submit_interview_btn": "gr_hide",
526
  "feedback_display": "gr_hide",
527
  "metrics_display": "gr_hide",
528
- "question_display": "gr_show",
529
- "answer_instructions": "gr_show"
530
  }
531
  }
532
  try:
@@ -542,8 +540,7 @@ def start_interview_logic(roles, processed_resume_data, text_model):
542
  questions.append(default_questions[len(questions)])
543
  questions = questions[:5] # cap at 5
544
 
545
- # Display all 5 questions at once
546
- all_questions_text = "\n\n".join([f"**Question {i+1}:** {q}" for i, q in enumerate(questions)])
547
  initial_question = questions[0]
548
 
549
  interview_state = {
@@ -557,9 +554,8 @@ def start_interview_logic(roles, processed_resume_data, text_model):
557
  "selected_roles": roles
558
  }
559
  return {
560
- "status": "Interview started. All 5 questions are displayed below. Answer them one by one.",
561
- "initial_question": all_questions_text, # Show all questions
562
- "all_questions": all_questions_text,
563
  "interview_state": interview_state,
564
  "ui_updates": {
565
  "audio_input": "gr_show",
@@ -578,7 +574,6 @@ def start_interview_logic(roles, processed_resume_data, text_model):
578
  return {
579
  "status": error_msg,
580
  "initial_question": "",
581
- "all_questions": "",
582
  "interview_state": {},
583
  "ui_updates": {
584
  "audio_input": "gr_hide",
@@ -592,7 +587,6 @@ def start_interview_logic(roles, processed_resume_data, text_model):
592
  }
593
  }
594
 
595
-
596
  def submit_answer_logic(audio, interview_state, text_model):
597
  """Handles submitting an answer via audio logic."""
598
  if not audio or not interview_state:
 
509
  }
510
  }
511
 
 
512
  def start_interview_logic(roles, processed_resume_data, text_model):
513
  """Starts the interview process logic."""
514
  if not roles or (isinstance(roles, list) and not any(roles)) or not processed_resume_data or not processed_resume_data.strip():
515
  return {
516
  "status": "Please select a role and ensure resume is processed.",
517
  "initial_question": "",
 
518
  "interview_state": {},
519
  "ui_updates": {
520
+ "audio_input": "gr_hide",
521
+ "submit_answer_btn": "gr_hide",
522
  "next_question_btn": "gr_hide",
523
  "submit_interview_btn": "gr_hide",
524
  "feedback_display": "gr_hide",
525
  "metrics_display": "gr_hide",
526
+ "question_display": "gr_hide",
527
+ "answer_instructions": "gr_hide"
528
  }
529
  }
530
  try:
 
540
  questions.append(default_questions[len(questions)])
541
  questions = questions[:5] # cap at 5
542
 
543
+ # Show ONLY the first question (not all 5)
 
544
  initial_question = questions[0]
545
 
546
  interview_state = {
 
554
  "selected_roles": roles
555
  }
556
  return {
557
+ "status": f"Interview started. Question 1 of {len(questions)}",
558
+ "initial_question": initial_question, # Only first question
 
559
  "interview_state": interview_state,
560
  "ui_updates": {
561
  "audio_input": "gr_show",
 
574
  return {
575
  "status": error_msg,
576
  "initial_question": "",
 
577
  "interview_state": {},
578
  "ui_updates": {
579
  "audio_input": "gr_hide",
 
587
  }
588
  }
589
 
 
590
  def submit_answer_logic(audio, interview_state, text_model):
591
  """Handles submitting an answer via audio logic."""
592
  if not audio or not interview_state: