Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c9d9ee75e6 | ||
|
|
15994a64a1 |
71
analyze.php
Normal file
71
analyze.php
Normal file
@ -0,0 +1,71 @@
|
||||
<?php
|
||||
header('Content-Type: application/json');
|
||||
|
||||
require_once __DIR__ . '/ai/LocalAIApi.php';
|
||||
|
||||
if (isset($_FILES['resume']) && $_FILES['resume']['error'] === UPLOAD_ERR_OK) {
|
||||
$fileTmpPath = $_FILES['resume']['tmp_name'];
|
||||
|
||||
// Read the file content
|
||||
$resumeContent = file_get_contents($fileTmpPath);
|
||||
|
||||
if ($resumeContent === false) {
|
||||
echo json_encode(['success' => false, 'message' => 'Failed to read resume file.']);
|
||||
exit;
|
||||
}
|
||||
|
||||
// Define the AI prompt
|
||||
$prompt = <<<PROMPT
|
||||
Act as an expert Applicant Tracking System (ATS) resume analyzer. Analyze the following resume content and return a JSON object with your analysis.
|
||||
|
||||
The JSON object must have the following structure:
|
||||
{
|
||||
"score": <an integer score from 0 to 100 representing ATS compatibility>,
|
||||
"status": "<a short status like 'Strong Candidate', 'Needs Improvement', or 'Poor Fit'>",
|
||||
"strengths": [
|
||||
"<a brief description of a positive aspect of the resume>",
|
||||
"<another positive aspect>"
|
||||
],
|
||||
"weaknesses": [
|
||||
"<a brief description of a negative aspect or area for improvement>",
|
||||
"<another area for improvement>"
|
||||
]
|
||||
}
|
||||
|
||||
Here is the resume content:
|
||||
---
|
||||
{$resumeContent}
|
||||
---
|
||||
PROMPT;
|
||||
|
||||
// Call the AI
|
||||
$response = LocalAIApi::createResponse([
|
||||
'input' => [
|
||||
['role' => 'system', 'content' => 'You are an expert ATS resume analyzer that only responds with JSON.'],
|
||||
['role' => 'user', 'content' => $prompt],
|
||||
],
|
||||
]);
|
||||
|
||||
if (empty($response['success'])) {
|
||||
error_log('AI API Error: ' . ($response['error'] ?? 'Unknown error'));
|
||||
echo json_encode(['success' => false, 'message' => 'AI analysis failed. Please try again later.']);
|
||||
exit;
|
||||
}
|
||||
|
||||
$analysisJson = LocalAIApi::decodeJsonFromResponse($response);
|
||||
|
||||
if ($analysisJson === null) {
|
||||
error_log('AI API JSON Decode Error: ' . LocalAIApi::extractText($response));
|
||||
echo json_encode(['success' => false, 'message' => 'Failed to parse AI response. The response may not be valid JSON.']);
|
||||
exit;
|
||||
}
|
||||
|
||||
echo json_encode(['success' => true, 'data' => $analysisJson]);
|
||||
|
||||
} else {
|
||||
echo json_encode([
|
||||
'success' => false,
|
||||
'message' => 'File upload failed or no file was uploaded.'
|
||||
]);
|
||||
}
|
||||
?>
|
||||
61
assets/css/custom.css
Normal file
61
assets/css/custom.css
Normal file
@ -0,0 +1,61 @@
|
||||
:root {
|
||||
--primary-color: #4A90E2;
|
||||
--accent-color: #50E3C2;
|
||||
--dark-text: #212529;
|
||||
--light-gray-bg: #F8F9FA;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: 'Inter', sans-serif;
|
||||
background-color: var(--light-gray-bg);
|
||||
}
|
||||
|
||||
.primary-accent {
|
||||
color: var(--primary-color);
|
||||
}
|
||||
|
||||
.bg-gradient-primary {
|
||||
background: linear-gradient(135deg, var(--primary-color) 0%, #357ABD 100%);
|
||||
}
|
||||
|
||||
.btn-primary-accent {
|
||||
background-color: var(--accent-color);
|
||||
border-color: var(--accent-color);
|
||||
color: var(--dark-text);
|
||||
font-weight: 600;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.btn-primary-accent:hover {
|
||||
background-color: #45c9a9;
|
||||
border-color: #45c9a9;
|
||||
color: var(--dark-text);
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.card {
|
||||
border-radius: .5rem;
|
||||
}
|
||||
|
||||
.shadow-lg {
|
||||
box-shadow: 0 1rem 3rem rgba(0,0,0,.175)!important;
|
||||
}
|
||||
|
||||
.score-circle {
|
||||
width: 150px;
|
||||
height: 150px;
|
||||
border-radius: 50%;
|
||||
background-color: var(--light-gray-bg);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border: 8px solid var(--accent-color);
|
||||
box-shadow: 0 0 20px rgba(80, 227, 194, 0.5);
|
||||
}
|
||||
|
||||
.score-circle span {
|
||||
font-size: 3.5rem;
|
||||
font-weight: 700;
|
||||
color: var(--dark-text);
|
||||
}
|
||||
101
assets/js/main.js
Normal file
101
assets/js/main.js
Normal file
@ -0,0 +1,101 @@
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
const uploadForm = document.getElementById('upload-form');
|
||||
const analyzeBtn = document.getElementById('analyze-btn');
|
||||
const uploadSection = document.getElementById('upload-section');
|
||||
const analysisSection = document.getElementById('analysis-section');
|
||||
const resumeFileInput = document.getElementById('resume-file');
|
||||
|
||||
if (uploadForm) {
|
||||
uploadForm.addEventListener('submit', function(event) {
|
||||
event.preventDefault();
|
||||
|
||||
if (!resumeFileInput.files || resumeFileInput.files.length === 0) {
|
||||
alert('Please select a resume file to analyze.');
|
||||
return;
|
||||
}
|
||||
|
||||
const formData = new FormData();
|
||||
formData.append('resume', resumeFileInput.files[0]);
|
||||
|
||||
// Show loading state
|
||||
analyzeBtn.disabled = true;
|
||||
analyzeBtn.innerHTML = '<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span> Analyzing...';
|
||||
|
||||
fetch('analyze.php', {
|
||||
method: 'POST',
|
||||
body: formData
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
// Hide loading state
|
||||
analyzeBtn.disabled = false;
|
||||
analyzeBtn.innerHTML = '<i class="bi bi-magic me-2"></i>Analyze My Resume';
|
||||
|
||||
if (data.success && data.data) {
|
||||
const analysis = data.data;
|
||||
|
||||
// Update Score and Status
|
||||
document.getElementById('ats-score').textContent = analysis.score;
|
||||
const scoreCircle = document.querySelector('.score-circle');
|
||||
const statusElement = scoreCircle.parentElement.parentElement.querySelector('.fw-semibold');
|
||||
statusElement.textContent = analysis.status;
|
||||
|
||||
if (analysis.score >= 80) {
|
||||
statusElement.className = 'fw-semibold text-success';
|
||||
} else if (analysis.score >= 60) {
|
||||
statusElement.className = 'fw-semibold text-warning';
|
||||
} else {
|
||||
statusElement.className = 'fw-semibold text-danger';
|
||||
}
|
||||
|
||||
// Update Strengths
|
||||
const strengthsList = document.querySelector('#analysis-section .bg-success').parentElement.querySelector('.list-group');
|
||||
strengthsList.innerHTML = ''; // Clear existing items
|
||||
if (analysis.strengths && analysis.strengths.length > 0) {
|
||||
analysis.strengths.forEach(item => {
|
||||
const li = document.createElement('li');
|
||||
li.className = 'list-group-item';
|
||||
li.textContent = item;
|
||||
strengthsList.appendChild(li);
|
||||
});
|
||||
} else {
|
||||
const li = document.createElement('li');
|
||||
li.className = 'list-group-item';
|
||||
li.textContent = 'No specific strengths identified.';
|
||||
strengthsList.appendChild(li);
|
||||
}
|
||||
|
||||
// Update Weaknesses
|
||||
const weaknessesList = document.querySelector('#analysis-section .bg-warning').parentElement.querySelector('.list-group');
|
||||
weaknessesList.innerHTML = ''; // Clear existing items
|
||||
if (analysis.weaknesses && analysis.weaknesses.length > 0) {
|
||||
analysis.weaknesses.forEach(item => {
|
||||
const li = document.createElement('li');
|
||||
li.className = 'list-group-item';
|
||||
li.textContent = item;
|
||||
weaknessesList.appendChild(li);
|
||||
});
|
||||
} else {
|
||||
const li = document.createElement('li');
|
||||
li.className = 'list-group-item';
|
||||
li.textContent = 'No specific areas for improvement identified.';
|
||||
weaknessesList.appendChild(li);
|
||||
}
|
||||
|
||||
// Show the analysis
|
||||
uploadSection.style.display = 'none';
|
||||
analysisSection.style.display = 'block';
|
||||
} else {
|
||||
alert('Error: ' + data.message);
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
// Hide loading state
|
||||
analyzeBtn.disabled = false;
|
||||
analyzeBtn.innerHTML = '<i class="bi bi-magic me-2"></i>Analyze My Resume';
|
||||
alert('An unexpected error occurred. Please try again.');
|
||||
console.error('Error:', error);
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
240
index.php
240
index.php
@ -1,150 +1,114 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
@ini_set('display_errors', '1');
|
||||
@error_reporting(E_ALL);
|
||||
@date_default_timezone_set('UTC');
|
||||
|
||||
$phpVersion = PHP_VERSION;
|
||||
$now = date('Y-m-d H:i:s');
|
||||
?>
|
||||
<!doctype html>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>New Style</title>
|
||||
<?php
|
||||
// Read project preview data from environment
|
||||
$projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? '';
|
||||
$projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? '';
|
||||
?>
|
||||
<?php if ($projectDescription): ?>
|
||||
<!-- Meta description -->
|
||||
<meta name="description" content='<?= htmlspecialchars($projectDescription) ?>' />
|
||||
<!-- Open Graph meta tags -->
|
||||
<meta property="og:description" content="<?= htmlspecialchars($projectDescription) ?>" />
|
||||
<!-- Twitter meta tags -->
|
||||
<meta property="twitter:description" content="<?= htmlspecialchars($projectDescription) ?>" />
|
||||
<?php endif; ?>
|
||||
<?php if ($projectImageUrl): ?>
|
||||
<!-- Open Graph image -->
|
||||
<meta property="og:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
|
||||
<!-- Twitter image -->
|
||||
<meta property="twitter:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
|
||||
<?php endif; ?>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>AI Resume & Job Match</title>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap" rel="stylesheet">
|
||||
<style>
|
||||
:root {
|
||||
--bg-color-start: #6a11cb;
|
||||
--bg-color-end: #2575fc;
|
||||
--text-color: #ffffff;
|
||||
--card-bg-color: rgba(255, 255, 255, 0.01);
|
||||
--card-border-color: rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
body {
|
||||
margin: 0;
|
||||
font-family: 'Inter', sans-serif;
|
||||
background: linear-gradient(45deg, var(--bg-color-start), var(--bg-color-end));
|
||||
color: var(--text-color);
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
min-height: 100vh;
|
||||
text-align: center;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
}
|
||||
body::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><path d="M-10 10L110 10M10 -10L10 110" stroke-width="1" stroke="rgba(255,255,255,0.05)"/></svg>');
|
||||
animation: bg-pan 20s linear infinite;
|
||||
z-index: -1;
|
||||
}
|
||||
@keyframes bg-pan {
|
||||
0% { background-position: 0% 0%; }
|
||||
100% { background-position: 100% 100%; }
|
||||
}
|
||||
main {
|
||||
padding: 2rem;
|
||||
}
|
||||
.card {
|
||||
background: var(--card-bg-color);
|
||||
border: 1px solid var(--card-border-color);
|
||||
border-radius: 16px;
|
||||
padding: 2rem;
|
||||
backdrop-filter: blur(20px);
|
||||
-webkit-backdrop-filter: blur(20px);
|
||||
box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
.loader {
|
||||
margin: 1.25rem auto 1.25rem;
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
border: 3px solid rgba(255, 255, 255, 0.25);
|
||||
border-top-color: #fff;
|
||||
border-radius: 50%;
|
||||
animation: spin 1s linear infinite;
|
||||
}
|
||||
@keyframes spin {
|
||||
from { transform: rotate(0deg); }
|
||||
to { transform: rotate(360deg); }
|
||||
}
|
||||
.hint {
|
||||
opacity: 0.9;
|
||||
}
|
||||
.sr-only {
|
||||
position: absolute;
|
||||
width: 1px; height: 1px;
|
||||
padding: 0; margin: -1px;
|
||||
overflow: hidden;
|
||||
clip: rect(0, 0, 0, 0);
|
||||
white-space: nowrap; border: 0;
|
||||
}
|
||||
h1 {
|
||||
font-size: 3rem;
|
||||
font-weight: 700;
|
||||
margin: 0 0 1rem;
|
||||
letter-spacing: -1px;
|
||||
}
|
||||
p {
|
||||
margin: 0.5rem 0;
|
||||
font-size: 1.1rem;
|
||||
}
|
||||
code {
|
||||
background: rgba(0,0,0,0.2);
|
||||
padding: 2px 6px;
|
||||
border-radius: 4px;
|
||||
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
||||
}
|
||||
footer {
|
||||
position: absolute;
|
||||
bottom: 1rem;
|
||||
font-size: 0.8rem;
|
||||
opacity: 0.7;
|
||||
}
|
||||
</style>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
|
||||
<link rel="stylesheet" href="assets/css/custom.css">
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
<div class="card">
|
||||
<h1>Analyzing your requirements and generating your website…</h1>
|
||||
<div class="loader" role="status" aria-live="polite" aria-label="Applying initial changes">
|
||||
<span class="sr-only">Loading…</span>
|
||||
|
||||
<nav class="navbar navbar-expand-lg navbar-light bg-white shadow-sm">
|
||||
<div class="container-fluid">
|
||||
<a class="navbar-brand fw-bold" href="#">
|
||||
<i class="bi bi-robot me-2 primary-accent"></i>
|
||||
ResumeWiz
|
||||
</a>
|
||||
</div>
|
||||
<p class="hint"><?= ($_SERVER['HTTP_HOST'] ?? '') === 'appwizzy.com' ? 'AppWizzy' : 'Flatlogic' ?> AI is collecting your requirements and applying the first changes.</p>
|
||||
<p class="hint">This page will update automatically as the plan is implemented.</p>
|
||||
<p>Runtime: PHP <code><?= htmlspecialchars($phpVersion) ?></code> — UTC <code><?= htmlspecialchars($now) ?></code></p>
|
||||
</nav>
|
||||
|
||||
<main class="container my-5">
|
||||
<!-- Upload Section -->
|
||||
<section id="upload-section" class="text-center">
|
||||
<div class="card p-5 shadow-lg border-0 bg-gradient-primary text-white">
|
||||
<h1 class="display-5 fw-bold">Get Your Resume ATS-Ready</h1>
|
||||
<p class="lead mb-4">Upload your resume to see your ATS compatibility score and get actionable insights in seconds.</p>
|
||||
<div class="col-lg-6 mx-auto">
|
||||
<form id="upload-form">
|
||||
<div class="mb-3">
|
||||
<label for="resume-file" class="visually-hidden">Upload Resume</label>
|
||||
<input class="form-control form-control-lg" type="file" id="resume-file" name="resume" required>
|
||||
</div>
|
||||
<div class="d-grid">
|
||||
<button id="analyze-btn" type="submit" class="btn btn-primary-accent btn-lg">
|
||||
<i class="bi bi-magic me-2"></i>Analyze My Resume
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- Analysis Section (Initially Hidden) -->
|
||||
<section id="analysis-section" style="display: none;">
|
||||
<div class="text-center mb-5">
|
||||
<h2 class="fw-bold">Your ATS Analysis Report</h2>
|
||||
<p class="text-muted">Based on leading Applicant Tracking Systems.</p>
|
||||
</div>
|
||||
|
||||
<div class="row g-4">
|
||||
<!-- Score -->
|
||||
<div class="col-lg-4">
|
||||
<div class="card h-100 shadow-sm border-0 text-center p-4">
|
||||
<div class="mx-auto">
|
||||
<div class="score-circle mb-3">
|
||||
<span id="ats-score">82</span>%
|
||||
</div>
|
||||
</div>
|
||||
<h4 class="fw-bold mb-1">ATS Compatibility Score</h4>
|
||||
<p class="text-success fw-semibold">Strong Candidate</p>
|
||||
<p class="small text-muted">Your resume is well-structured for most modern ATS platforms.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- What's Working -->
|
||||
<div class="col-lg-4">
|
||||
<div class="card h-100 shadow-sm border-0">
|
||||
<div class="card-header bg-success text-white">
|
||||
<h5 class="mb-0 fw-semibold"><i class="bi bi-check-circle-fill me-2"></i>What's Working</h5>
|
||||
</div>
|
||||
<ul class="list-group list-group-flush">
|
||||
<li class="list-group-item">Clear contact information</li>
|
||||
<li class="list-group-item">Standard section headings (Experience, Education)</li>
|
||||
<li class="list-group-item">Readable, standard font</li>
|
||||
<li class="list-group-item">Good keyword density for your industry</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Areas for Improvement -->
|
||||
<div class="col-lg-4">
|
||||
<div class="card h-100 shadow-sm border-0">
|
||||
<div class="card-header bg-warning text-dark">
|
||||
<h5 class="mb-0 fw-semibold"><i class="bi bi-exclamation-triangle-fill me-2"></i>For Improvement</h5>
|
||||
</div>
|
||||
<ul class="list-group list-group-flush">
|
||||
<li class="list-group-item">Action verbs could be stronger</li>
|
||||
<li class="list-group-item">Missing a dedicated "Skills" section</li>
|
||||
<li class="list-group-item">Dates are in an inconsistent format</li>
|
||||
<li class="list-group-item">Lacks quantifiable achievements</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="text-center mt-5">
|
||||
<button class="btn btn-secondary btn-lg" onclick="window.location.reload()">
|
||||
<i class="bi bi-arrow-left me-2"></i>Start Over
|
||||
</button>
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
<footer>
|
||||
Page updated: <?= htmlspecialchars($now) ?> (UTC)
|
||||
|
||||
<footer class="text-center text-muted py-4 mt-auto">
|
||||
<p>© 2025 ResumeWiz. All Rights Reserved.</p>
|
||||
</footer>
|
||||
|
||||
<script src="assets/js/main.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
x
Reference in New Issue
Block a user