Improve resume parser field mapping and markdown JSON extraction
This commit is contained in:
+34
@@ -0,0 +1,34 @@
|
|||||||
|
{
|
||||||
|
"ai_job_portal_profile": {
|
||||||
|
"profile": {
|
||||||
|
"fullName": "Not Provided",
|
||||||
|
"email": "dkifer19@gmail.com",
|
||||||
|
"phone": "",
|
||||||
|
"location": "",
|
||||||
|
"linkedinUrl": "",
|
||||||
|
"githubUrl": "",
|
||||||
|
"portfolioUrl": "",
|
||||||
|
"summary": "",
|
||||||
|
"experience": [],
|
||||||
|
"skills": [],
|
||||||
|
"education": [],
|
||||||
|
"autoApplyCriteria": {
|
||||||
|
"enabled": false,
|
||||||
|
"targetRoles": [],
|
||||||
|
"minMatchScore": 80,
|
||||||
|
"maxDailyApplications": 10,
|
||||||
|
"preferredLocations": [],
|
||||||
|
"minSalary": 100000,
|
||||||
|
"excludedCompanies": [],
|
||||||
|
"preferredPlatforms": [
|
||||||
|
"LinkedIn",
|
||||||
|
"Greenhouse",
|
||||||
|
"Lever",
|
||||||
|
"Workday",
|
||||||
|
"Indeed",
|
||||||
|
"Direct"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -309,18 +309,24 @@ Extract the following fields accurately:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
required: ["fullName", "skills", "experience"]
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const { text, providerUsed } = await generateTextWithLLMFallback(prompt, schema, llmConfig);
|
const { text, providerUsed } = await generateTextWithLLMFallback(prompt, schema, llmConfig);
|
||||||
const parsedProfile = JSON.parse(text || "{}");
|
|
||||||
|
// Extract JSON cleanly in case markdown wrapping was returned
|
||||||
|
const cleanJsonText = text.replace(/```json/gi, '').replace(/```/g, '').trim();
|
||||||
|
const parsedProfile = JSON.parse(cleanJsonText || "{}");
|
||||||
|
|
||||||
// Ensure IDs on experience items
|
// Ensure IDs on experience items
|
||||||
if (Array.isArray(parsedProfile.experience)) {
|
if (Array.isArray(parsedProfile.experience)) {
|
||||||
parsedProfile.experience = parsedProfile.experience.map((exp: any, index: number) => ({
|
parsedProfile.experience = parsedProfile.experience.map((exp: any, index: number) => ({
|
||||||
...exp,
|
...exp,
|
||||||
id: exp.id || `exp_parsed_${Date.now()}_${index}`
|
id: exp.id || `exp_parsed_${Date.now()}_${index}`,
|
||||||
|
title: exp.title || exp.role || exp.position || "Position",
|
||||||
|
company: exp.company || exp.organization || "Company",
|
||||||
|
period: exp.period || exp.dates || exp.duration || "",
|
||||||
|
bullets: Array.isArray(exp.bullets) ? exp.bullets : (exp.description ? [exp.description] : [])
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user