Rehyor commited on
Commit
ab885e8
·
verified ·
1 Parent(s): 360c4aa

Integrate AI Scoring into the Main Logic:

Browse files

Find your generateCandidateData function.

Get the job description text from the text area.

Inside the for...of loop for each file, replace the placeholder score with a call to your new runAiAnalysis function.

Use the real AI score to make the breakdown scores look realistic.

// Inside generateCandidateData...
const jobDescription = document.getElementById('job-description').value;

// Inside the for...of loop, after getting the CV 'content'...
const aiScore = await runAiAnalysis(jobDescription, content);

// Replace the old candidates.push with this new one:
candidates.push({
name: file.name,
score: aiScore,
breakdown: {
mustHave: Math.max(50, aiScore - Math.floor(Math.random() * 8)),
niceToHave: Math.max(55, aiScore - Math.floor(Math.random() * 5)),
experience: Math.max(60, aiScore + Math.floor(Math.random() * 5)),
education: Math.max(65, aiScore - Math.floor(Math.random() * 10))
},
snippets: ["Real AI score generated.", "Breakdown scores are illustrative.", "Further analysis pending."],
flags: []
});

Add Model Loading Feedback:

To give the user feedback while the model loads for the first time, add a status message to the header and disable the buttons until the AI is ready.

// In the header HTML
<h1 id="header-title" class="text-2xl font-bold text-slate-800">AI CV Screener</h1>

// In your main script, add this self-invoking function to load the model on startup
(async () => {
const title = document.getElementById('header-title');
const screenBtn = document.getElementById('screen-cvs-btn');
const extractBtn = document.getElementById('extract-skills-btn');

title.textContent = 'AI Engine: Loading model...';
screenBtn.disabled = true;
extractBtn.disabled = true;

await FeatureExtractionPipeline.getInstance(); // This triggers the model download

title.textContent = 'AI CV Screener';
screenBtn.disabled = false;
extractBtn.disabled = false;
})();

Files changed (0) hide show