Skip to content

Commit

Permalink
Updated ATS Tool and Added
Browse files Browse the repository at this point in the history
  • Loading branch information
neerazz committed Jan 26, 2024
1 parent 109d7f0 commit 95ea434
Show file tree
Hide file tree
Showing 2 changed files with 647 additions and 44 deletions.
205 changes: 161 additions & 44 deletions tools/ATS_system.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,19 @@
<title>ATS Score with Gemini PRO</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css">
</head>

<style>
.response-container {
border: 1px solid #ddd; /* Light grey border */
padding: 10px;
height: auto; /* Fixed height, or you can make it auto */
overflow-y: auto; /* Allows scrolling if content is too long */
background-color: #f9f9f9; /* Light background color */
margin-top: 5px;
border-radius: 10px; /* Rounded borders */
}
</style>

<body>
<div class="container">
<h1 class="text-center mt-4">ATS Score Analysis with Gemini PRO</h1>
Expand All @@ -17,7 +30,8 @@ <h1 class="text-center mt-4">ATS Score Analysis with Gemini PRO</h1>
<i class="fas fa-key"></i> Enter API Key
</div>
<div class="card-body">
<input type="text" class="form-control" id="apiKey" placeholder="Enter your Gemini PRO API key">
<label for="geminiApiKey"></label><input type="text" class="form-control" id="geminiApiKey" placeholder="Enter your Gemini PRO API key">
<label for="chatGpTApiKey"></label><input type="text" class="form-control" id="chatGpTApiKey" placeholder="Enter your ChatGPT API key">
</div>
</div>
</div>
Expand Down Expand Up @@ -60,11 +74,23 @@ <h1 class="text-center mt-4">ATS Score Analysis with Gemini PRO</h1>
<div class="card-header">
<i class="fas fa-comment-dots"></i> Prompt Response
</div>
<div class="card-body" id="response">
<div class="card-body row">
<!-- Gemini AI Response Section -->
<div class="col-md-6 mb-3">
<h5>Gemini AI Response:</h5>
<div id="gemini-response" class="response-container"></div>
</div>
<!-- ChatGPT Response Section -->
<div class="col-md-6 mb-3">
<h5>ChatGPT Response:</h5>
<div id="chatgpt-response" class="response-container"></div>
</div>
</div>
</div>
</div>
</div>


</div>

<script src="https://kit.fontawesome.com/a076d05399.js"></script>
Expand All @@ -84,6 +110,8 @@ <h1 class="text-center mt-4">ATS Score Analysis with Gemini PRO</h1>

const generateResponseButton = document.getElementById("generateResponse");
const responseElement = document.getElementById("response");
let CHATGPT_API_KEY = document.getElementById("chatGpTApiKey").value;
let GEMINI_API_KEY = document.getElementById("geminiApiKey").value;

const loadingIcon = document.createElement("i"); // Create a loading icon element
loadingIcon.classList.add("fas", "fa-spinner", "fa-spin");
Expand All @@ -97,75 +125,84 @@ <h1 class="text-center mt-4">ATS Score Analysis with Gemini PRO</h1>
// Get the original values for preservation
const originalResumeText = document.getElementById("resume").value;
const originalJobDescriptionText = document.getElementById("jobDescription").value;
const API_KEY = document.getElementById("apiKey").value;

try{
try {
CHATGPT_API_KEY = document.getElementById("chatGpTApiKey").value;
GEMINI_API_KEY = document.getElementById("geminiApiKey").value;

setLocalStorage(API_KEY,originalResumeText ,originalJobDescriptionText);
setLocalStorage(GEMINI_API_KEY, CHATGPT_API_KEY, originalResumeText, originalJobDescriptionText);
// Disable the button and show the loading icon
generateResponseButton.disabled = true;
generateResponseButton.appendChild(loadingIcon);

const resumeText = document.getElementById("resume").value;
const jobDescriptionText = document.getElementById("jobDescription").value;
const promptPrefix = "Hey, Act Like, a skilled or very experience ATS (Application Tracking System)\n" +
"with a deep understanding of tech field, software engineering, data science, data analyst\n" +
"and big data engineer. Your task is to evaluate the resume based on the given job description.\n" +
"You must consider the job market is very competitive and you should provide. \n" +
"Give your best assistance for improving the resumes.\n" +
"with a deep understanding of tech field, software engineering." +
"Your task is to thoroughly go through the resume line by line Have a get a better understanding of teh context." +
"Evaluate the resume based on the given job description. You must consider the job market is very competitive and you should provide. \n" +
"Give your best assistance for improving the resumes, remember to use the same tone of the resume give me just the points that you want to update in which sections.\n" +
"\n" +
"Assign the percentage Matching based on the below Job Description and the missing keywords with high accuracy.\n" +
"\n" +
"--------------\n" +
"Resume:" +
"\n";

const promptPrefix2 = "--------------\n" +
const resumePromptPrefix = "--------------\n" +
"Job description:" +
"\n";

const jdPromptPrefix = "--------------\n" +
"Job description:" +
"\n";

const promptPrefix3 = "--------------\n" +
"I dont want the complete Updated resume. I am looking for the things that I have to change. " +
"Give it in below format, Dont include the new Company name, and there benefits that they are giving." +
"Focus Primarily on the Essential Duties or Responsibilities and the Qualifications. Understand the requirement first very carefully." +
"Give it in below format." +
"Only then start Generating the response in Below format" +
"JD Match (In %): ?\n" +
"MissingKeywords (as list):?\n" +
"And Updated resume, I dont want the complete Updated resume. I am looking for teh things that I have to chage. Give it in below format:\n" +
"Profile Summary/ Work Experience changes:\n" +
"From:\n" +
"------ So and so -----\n" +
"\n" +
"To:\n" +
"\n" +
"--- So and so ---" +
"And Updated resume, I dont want the complete Updated resume. I am looking for the things that I have to change in my resume:\n " +
"Give me details like: " +
" 1. Summary Section: " +
" Old Content: Seasoned Software Architect with 12+ years of experience in designing and implementing large-scale distributed systems" +
" Updated Content: Experienced Cloud Systems Engineer with over 12 years in software architecture, specializing in cloud solutions, system engineering processes, and data integration for secure, distributed systems. Skilled in aligning software platforms with Department of Defense standards, ensuring robust and scalable solutions for data federation and edge device integration." +
" 2. Work Experience" +
" - In Principal Software Engineer, WAYFAIR, Tampa, FL, USA. " +
" Old Content: {Give the existing content of the Resume.}" +
" Updated Content: {Give the Updated content so that the ATS Score of the resume is improved.}" +
"" +
"Make sure when you create the updated content keeping in mind the ATS score must go above 85 %." +
"\n";

const finalPrompt = promptPrefix + resumePromptPrefix + resumeText + jdPromptPrefix + jobDescriptionText + promptPrefix3;

// Access your API key (see "Set up your API key" above)
const genAI = new GoogleGenerativeAI(API_KEY);
const context = promptPrefix + promptPrefix3

const model = genAI.getGenerativeModel({model: "gemini-pro"});
getGoogleAIResponse(finalPrompt);
getChatGPTResponse(context, resumePromptPrefix + resumeText + jdPromptPrefix + jobDescriptionText);

const finalPrompt = promptPrefix + resumeText + promptPrefix2 + jobDescriptionText + promptPrefix3;
retriveLocalStrorageValues();

const result = await model.generateContent(finalPrompt);
const response = await result.response;
const text = response.text();
console.log(text);
console.log("\n\n");
const formattedResponse = formatMarkdown(text);
responseElement.innerHTML = formattedResponse;
console.log(formattedResponse);
const promises = [
await getGoogleAIResponse(helperPrompt, recordedTextValue),
await getChatGPTResponse(helperPrompt, recordedTextValue)
];

const responses = await Promise.all(promises);
const [geminiAIResponse, chatGPTAIResponse] = responses;

// After the API call, restore the original values
document.getElementById("resume").value = originalResumeText;
document.getElementById("jobDescription").value = originalJobDescriptionText;
document.getElementById("apiKey").value = API_KEY;
console.log("Gemini AI Response : \n" + geminiAIResponse);
console.log("Chat GPT Response : \n" + chatGPTAIResponse);

}catch (error){
generateResponseButton.disabled = false;
generateResponseButton.removeChild(loadingIcon);

} catch (error) {
responseElement.innerHTML = error;
}finally {
} finally {

// Re-enable the button and remove the loading icon
generateResponseButton.disabled = false;
Expand All @@ -176,20 +213,102 @@ <h1 class="text-center mt-4">ATS Score Analysis with Gemini PRO</h1>

});

function setLocalStorage(API_KEY, resumeText, jobDescriptionText){
localStorage.setItem('apiKey', API_KEY);
function updateGeminiResponse(response) {
const geminiResponseElement = document.getElementById('gemini-response');
geminiResponseElement.innerHTML = response; // Assuming HTML formatted response
}

function updateChatGptResponse(response) {
const chatGptResponseElement = document.getElementById('chatgpt-response');
chatGptResponseElement.innerHTML = response; // Assuming HTML formatted response
}


async function getGoogleAIResponse(finalPrompt, aiModel = "gemini-pro") {

// Access your API key (see "Set up your API key" above)
const genAI = new GoogleGenerativeAI(GEMINI_API_KEY);

const model = genAI.getGenerativeModel({model: aiModel});
const result = await model.generateContent(finalPrompt);
const response = await result.response;
const text = response.text();
console.log("------------------------- Original Response ----------------");
console.log(text);
console.log("\n\n");
console.log("------------------------- Formatted Response ----------------");
const formattedResponse = formatMarkdown(text);
console.log(formattedResponse);
updateGeminiResponse(formattedResponse);
return formattedResponse;
}

async function getChatGPTResponse(context, finalPrompt) {
const apiUrl = 'https://api.openai.com/v1/chat/completions';

const payload = {
model: 'gpt-3.5-turbo-0613', // Or any other desired ChatGPT model
messages: [{
role: 'system',
content: context
},
{role: 'user', content: finalPrompt}],
max_tokens: 150, // Adjust as needed for desired response length
temperature: 0.7, // Adjust for creativity and coherence
};

try {
console.log(`Using API Key: ${CHATGPT_API_KEY}`);
const response = await fetch(apiUrl, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${CHATGPT_API_KEY}`,
},
body: JSON.stringify(payload),
});

const data = await response.json();
if (!data.choices || data.choices.length === 0 || !data.choices[0].message) {
console.error('Unexpected response format:', data);
return 'Error: Unexpected response format from ChatGPT.';
}
const chatGPTResponse = data.choices[0].message.content;
console.log('------------------------- Original ChatGPT Response ----------------');
console.log(chatGPTResponse);
console.log("\n\n");
console.log('------------------------- Formatted Response ----------------');
const formattedResponse = formatMarkdown(chatGPTResponse); // Assuming you have a formatMarkdown function
console.log(formattedResponse);
updateChatGptResponse(formattedResponse);
return formattedResponse;
} catch (error) {
console.error('Error fetching ChatGPT response:', error);
return 'Error: Could not retrieve response from ChatGPT.';
}
}


function setLocalStorage(GEMINI_API_KEY, CHATGPT_API_KEY, resumeText, jobDescriptionText) {
localStorage.setItem('geminiApiKey', GEMINI_API_KEY);
localStorage.setItem('chatGpTApiKey', CHATGPT_API_KEY);
localStorage.setItem('resume', resumeText);
localStorage.setItem('jobDescription', jobDescriptionText);
}

function retriveLocalStrorageValues(){
function retriveLocalStrorageValues() {
// Retrieve values from local storage on page load (if they exist)
const storedAPIKey = localStorage.getItem('apiKey');
localStorage.setItem('chatGpTApiKey', CHATGPT_API_KEY);
const chatGpTApiKey = localStorage.getItem('apiKey');
const storedAPIKey = localStorage.getItem('geminiApiKey');
const storedResumeText = localStorage.getItem('resume');
const storedJobDescriptionText = localStorage.getItem('jobDescription');

if (storedAPIKey) {
document.getElementById("apiKey").value = storedAPIKey;
document.getElementById("geminiApiKey").value = storedAPIKey;
}
if (chatGpTApiKey) {
document.getElementById("chatGpTApiKey").value = chatGpTApiKey;
}
if (storedResumeText) {
document.getElementById("resume").value = storedResumeText;
Expand All @@ -212,7 +331,5 @@ <h1 class="text-center mt-4">ATS Score Analysis with Gemini PRO</h1>
</script>




</body>
</html>
Loading

0 comments on commit 95ea434

Please sign in to comment.