add test mode
This commit is contained in:
parent
8efa97d950
commit
6fe463b029
3 changed files with 86 additions and 0 deletions
|
@ -46,6 +46,20 @@
|
||||||
|
|
||||||
<script src="js/script.js"></script> <!-- External JS file -->
|
<script src="js/script.js"></script> <!-- External JS file -->
|
||||||
|
|
||||||
|
<script>
|
||||||
|
fetch('/env')
|
||||||
|
.then(response => response.json())
|
||||||
|
.then(data => {
|
||||||
|
if (data.TEST_MODE === 'true') {
|
||||||
|
const testScript = document.createElement("script");
|
||||||
|
testScript.src = "js/test.js";
|
||||||
|
document.body.appendChild(testScript);
|
||||||
|
console.log("🚀 Test mode enabled");
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(error => console.error("Error fetching environment variables:", error));
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
68
public/js/test.js
Normal file
68
public/js/test.js
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
// This script is used for Testing Purposes
|
||||||
|
// Will only load if ENV TEST_MODE is set to true
|
||||||
|
// Script loads test data, displays all elements as needs, and stops LLM's from running
|
||||||
|
|
||||||
|
const MOCK_CANDIDATE_PROFILE ={
|
||||||
|
name: "James Bond",
|
||||||
|
location: "England",
|
||||||
|
experience: "MI6 British Secret Intelligence Service",
|
||||||
|
skills: ["Espionage", "Multilingual", "Cybersecurity", "Combat"]
|
||||||
|
};
|
||||||
|
|
||||||
|
const MOCK_JOB_DESCRIPTION = "A prestigious private security firm is seeking an experienced professional to provide elite security consulting for high-profile clients.";
|
||||||
|
const MOCK_KEY_POINTS = "Strong skills in security, business intelligence, and combat.";
|
||||||
|
const MOCK_COVER_LETTER = `
|
||||||
|
Dear Hiring Manager,
|
||||||
|
|
||||||
|
As a former MI6 operative, I have conducted global intelligence missions,
|
||||||
|
provided executive protection under extreme conditions,
|
||||||
|
and developed strategic security solutions for sensitive operations.
|
||||||
|
My expertise in counter-surveillance, crisis management,
|
||||||
|
and tactical response makes me uniquely suited to safeguarding elite clients and corporate assets.
|
||||||
|
Additionally, my ability to navigate high-society settings while maintaining vigilance ensures seamless security without disruption.
|
||||||
|
|
||||||
|
Sincerely,
|
||||||
|
James Bond
|
||||||
|
`;
|
||||||
|
|
||||||
|
const MOCK_TAILORED_RESUME = `
|
||||||
|
James Bond
|
||||||
|
England | bond.james@shakennotstired.com | (555)555-5555
|
||||||
|
|
||||||
|
PROFESSIONAL SUMMARY
|
||||||
|
Former MI6 intelligence officer with extensive experience in high-stakes security, risk assessment, and executive protection.
|
||||||
|
|
||||||
|
TECHNICAL SKILLS
|
||||||
|
• Executive Protection & Risk Mitigation
|
||||||
|
• Counterintelligence & Surveillance
|
||||||
|
• Tactical & Evasive Driving
|
||||||
|
`;
|
||||||
|
|
||||||
|
|
||||||
|
// Function to populate test data
|
||||||
|
function populateTestData() {
|
||||||
|
document.getElementById('resumePreviewSection').style.display = "grid"
|
||||||
|
document.getElementById('profileJson').value = JSON.stringify(MOCK_CANDIDATE_PROFILE, null, 2);
|
||||||
|
document.getElementById('jobDescription').value = MOCK_JOB_DESCRIPTION;
|
||||||
|
document.getElementById('keyPoints').value = MOCK_KEY_POINTS;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Function to simulate cover letter and resume generation
|
||||||
|
function simulateGeneration() {
|
||||||
|
document.getElementById('coverLetterOutput').value = MOCK_COVER_LETTER;
|
||||||
|
document.getElementById('tailoredResumeOutput').value = MOCK_TAILORED_RESUME;
|
||||||
|
document.getElementById('keyResumeUpdates').textContent = "• Skills section updated to emphasize SQL, R, and automation.\n• Summary tailored to match job description.";
|
||||||
|
|
||||||
|
document.getElementById('coverLetterSection').style.display = "grid";
|
||||||
|
document.getElementById('tailoredResumeSection').style.display = "grid";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Override the generate button functionality
|
||||||
|
document.getElementById("generateCoverLetterBtn").addEventListener("click", function(event) {
|
||||||
|
event.preventDefault();
|
||||||
|
simulateGeneration();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
populateTestData()
|
|
@ -16,6 +16,10 @@ app.use(express.json());
|
||||||
const generateRoute = require('./routes/generate');
|
const generateRoute = require('./routes/generate');
|
||||||
app.use('/generate', generateRoute);
|
app.use('/generate', generateRoute);
|
||||||
|
|
||||||
|
app.get('/env', (req,res) => {
|
||||||
|
res.json({TEST_MODE: process.env.TEST_MODE || false})
|
||||||
|
})
|
||||||
|
|
||||||
app.listen(PORT, () => {
|
app.listen(PORT, () => {
|
||||||
console.log(`Server running on http://localhost:${PORT}`);
|
console.log(`Server running on http://localhost:${PORT}`);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue