Spaces:
Sleeping
Sleeping
fix: resolve TypeError in scoring and plan generation for structured project data
Browse files
backend/app/api/routes/interview_plan.py
CHANGED
|
@@ -447,10 +447,10 @@ async def create_interview_plan(session_id: str):
|
|
| 447 |
questions.append({"id":"intro_1","type":"self_intro","question":_intro(candidate_name,job_role),"skill_target":"self_intro","source":"rule"})
|
| 448 |
|
| 449 |
if resume_projects:
|
| 450 |
-
p1, s1 = _project_info(
|
| 451 |
questions.append({"id":"project_1","type":"project","question":_project_q(p1,s1,job_role,expertise_level),"skill_target":p1,"source":"rule"})
|
| 452 |
if len(resume_projects) > 1:
|
| 453 |
-
p2, s2 = _project_info(
|
| 454 |
questions.append({"id":str(uuid.uuid4()),"type":"project","question":_project_q(p2,s2,job_role,expertise_level),"skill_target":p2,"source":"rule"})
|
| 455 |
else:
|
| 456 |
questions.append({"id":"project_1","type":"project","question":random.choice(["Walk me through the most technically challenging thing you've built and your exact contribution.","Tell me about a significant technical challenge you tackled — from coursework, open source, or self-learning."]),"skill_target":"project_experience","source":"rule"})
|
|
|
|
| 447 |
questions.append({"id":"intro_1","type":"self_intro","question":_intro(candidate_name,job_role),"skill_target":"self_intro","source":"rule"})
|
| 448 |
|
| 449 |
if resume_projects:
|
| 450 |
+
p1, s1 = _project_info(resume_projects[0], 1)
|
| 451 |
questions.append({"id":"project_1","type":"project","question":_project_q(p1,s1,job_role,expertise_level),"skill_target":p1,"source":"rule"})
|
| 452 |
if len(resume_projects) > 1:
|
| 453 |
+
p2, s2 = _project_info(resume_projects[1], 2)
|
| 454 |
questions.append({"id":str(uuid.uuid4()),"type":"project","question":_project_q(p2,s2,job_role,expertise_level),"skill_target":p2,"source":"rule"})
|
| 455 |
else:
|
| 456 |
questions.append({"id":"project_1","type":"project","question":random.choice(["Walk me through the most technically challenging thing you've built and your exact contribution.","Tell me about a significant technical challenge you tackled — from coursework, open source, or self-learning."]),"skill_target":"project_experience","source":"rule"})
|
backend/app/core/interview_reasoning.py
CHANGED
|
@@ -29,7 +29,11 @@ def detect_topic(
|
|
| 29 |
for skill in skills:
|
| 30 |
candidates.append(("skill", skill))
|
| 31 |
for project in projects:
|
| 32 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
|
| 34 |
if not candidates:
|
| 35 |
return None
|
|
|
|
| 29 |
for skill in skills:
|
| 30 |
candidates.append(("skill", skill))
|
| 31 |
for project in projects:
|
| 32 |
+
if isinstance(project, dict):
|
| 33 |
+
text = project.get("details", project.get("name", ""))
|
| 34 |
+
candidates.append(("project", text[:120]))
|
| 35 |
+
else:
|
| 36 |
+
candidates.append(("project", str(project)[:120]))
|
| 37 |
|
| 38 |
if not candidates:
|
| 39 |
return None
|